Table of Contents 1 IP Addressing Configuration 1-1 IP Addressing Overview 1-1 IP Address Classes 1-1 Special IP Addresses 1-2 Subnetting and Masking 1-2 Configuring IP Addresses 1-3 Assigning an IP Address to an Interface 1-3 Displaying and Maintaining IP Addressing 1-4 i
1 IP Addressing Configuration When assigning IP addresses to interfaces on your device, go to these sections for information you are interested in: IP Addressing Overview Configuring IP Addresses Displaying and Maintaining IP Addressing IP Addressing Overview This section covers these topics: IP Address Classes Special IP Addresses IP Address Classes On an IP network, a 32-bit address is used to identify a host. An example is 01010000100000001000000010000000 in binary. To make IP addresses in 32-bit form easier to read, they are written in dotted decimal notation, each being four octets in length, for example, 10.1.1.1 for the address just mentioned. Each IP address breaks down into two parts: Net ID: The first several bits of the IP address defining a network, also known as class bits. Host-id: Identifies a host on a network. IP addresses are divided into five classes, as shown in the following figure (in which the blue parts represent the address class). Figure 1-1 IP address classes Table 1-1 describes the address ranges of these five classes. 1-1
Table 1-1 IP address classes and ranges Class Address range Remarks A B C D E 0.0.0.0 to 127.255.255.255 128.0.0.0 to 191.255.255.255 192.0.0.0 to 223.255.255.255 224.0.0.0 to 239.255.255.255 240.0.0.0 to 255.255.255.255 The IP address 0.0.0.0 is used by a host at bootstrap for temporary communication. This address is never a valid destination address. Addresses starting with 127 are reserved for loopback test. Packets destined to these addresses are processed locally as input packets rather than sent to the link. Multicast addresses. Reserved for future use except for the broadcast address 255.255.255.255. Special IP Addresses The following IP addresses are for special use, and they cannot be used as host IP addresses: IP address with an all-zero net ID: Identifies a host on the local network. For example, IP address 0.0.0.16 indicates the host with a host ID of 16 on the local network. IP address with an all-zero host ID: Identifies a network. IP address with an all-one host ID: Identifies a directed broadcast address. For example, a packet with the destination address of 192.168.1.255 will be broadcasted to all the hosts on the network 192.168.1.0. Subnetting and Masking Subnetting was developed to address the risk of IP address exhaustion resulting from fast expansion of the Internet. The idea is to break a network down into smaller networks called subnets by using some bits of the host ID to create a subnet ID. To identify the boundary between the host ID and the combination of net ID and subnet ID, masking is used. Each subnet mask comprises 32 bits related to the corresponding bits in an IP address. In a subnet mask, the part containing consecutive ones identifies the combination of net ID and subnet ID whereas the part containing consecutive zeros identifies the host ID. Figure 1-2 shows how a Class B network is subnetted. Figure 1-2 Subnet a Class B network 1-2
In the absence of subnetting, some special addresses such as the addresses with the net ID of all zeros and the addresses with the host ID of all ones, are not assignable to hosts. The same is true for subnetting. When designing your network, you should note that subnetting is somewhat a tradeoff between subnets and accommodated hosts. For example, a Class B network can accommodate 65,534 (2 16 2. Of the two deducted Class B addresses, one with an all-one host ID is the broadcast address and the other with an all-zero host ID is the network address) hosts before being subnetted. After you break it down into 512 (2 9 ) subnets by using the first 9 bits of the host ID for the subnet, you have only 7 bits for the host ID and thus have only 126 (2 7 2) hosts in each subnet. The maximum number of hosts is thus 64,512 (512 126), 1022 less after the network is subnetted. Class A, B, and C networks, before being subnetted, use these default masks (also called natural masks): 255.0.0.0, 255.255.0.0, and 255.255.255.0 respectively. Configuring IP Addresses An interface can communicate with other hosts after it obtains an IP address. Besides directly assigning an IP address to an interface, you may configure the interface to obtain one through BOOTP, DHCP, address negotiation as alternatives. If you change the way an interface obtains an IP address, from manual assignment to BOOTP for example, the IP address obtained from BOOTP will overwrite the old one manually assigned. This chapter only covers how to assign an IP address manually. For how to obtain an IP address through BOOTP or DHCP, refer to DHCP Configuration. Assigning an IP Address to an Interface Follow these steps to assign an IP address to an interface: To do Use the command Remarks Enter system view system-view Enter interface view Assign an IP address to the interface interface interface-type interface-number ip address ip-address { mask mask-length } Required No IP address is assigned by default. 1-3
Displaying and Maintaining IP Addressing To do Use the command Remarks Display information about a specified or all Layer 3 interfaces Display brief information about a specified or all Layer 3 interfaces display ip interface [ interface-type interface-number ] display ip interface brief [ interface-type [ interface-number ] ] Available in any view Available in any view 1-4