02-IP Services Volume

01-IP Addressing Configuration

Chapters Download  (99.95 KB)

01-IP Addressing Configuration


When assigning IP addresses to interfaces on your device, go to these sections for information you are interested in:

l          IP Addressing Overview

l          Configuring IP Addresses

l          Displaying and Maintaining IP Addressing

IP Addressing Overview

This section covers these topics:

l          IP Address Classes

l          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:

l          Net ID: The first several bits of the IP address defining a network, also known as class bits.

l          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.

Table 1-1 IP address classes and ranges

Class

Address range

Remarks

A

0.0.0.0 to 127.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.

B

128.0.0.0 to 191.255.255.255

––

C

192.0.0.0 to 223.255.255.255

––

D

224.0.0.0 to 239.255.255.255

Multicast addresses.

E

240.0.0.0 to 255.255.255.255

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:

l          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.

l          IP address with an all-zero host ID: Identifies a network.

l          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

 

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 (216 – 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 (29) 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 (27 – 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. 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 the other three approaches, refer to DHCP Configuration in the IP Services Volume .

 

This section includes:

l          Assigning an IP Address to an Interface

l          IP Addressing Configuration Example

Assigning an IP Address to an Interface

You may assign an interface multiple IP addresses, one primary and multiple secondaries, to connect multiple logical subnets on the same physical subnet.

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

interface interface-type interface-number

––

Assign an IP address to the interface

ip address ip-address { mask | mask-length } [ sub ]

Required

No IP address is assigned by default.

 

 

l          The primary IP address you assigned to the interface can overwrite the old one if there is any.

l          You cannot assign secondary IP addresses to an interface that has BOOTP, DHCP.

 

IP Addressing Configuration Example

Network requirements

As shown in Figure 1-3, a port in VLAN 1 on a switch is connected to a LAN comprising two segments: 172.16.1.0/24 and 172.16.2.0/24.

To enable the hosts on the two network segments to communicate with the external network through the switch, and the hosts on the LAN can communicate with each other, do the following:

l          Assign two IP addresses to VLAN-interface 1 on the switch.

l          Set the switch as the gateway on all PCs in the two networks.

Figure 1-3 Network diagram for IP addressing configuration

 

Configuration procedure

# Assign a primary IP address and a secondary IP address to VLAN-interface 1.

<Switch> system-view

[Switch] interface vlan-interface 1

[Switch-Vlan-interface1] ip address 172.16.1.1 255.255.255.0

[Switch-Vlan-interface1] ip address 172.16.2.1 255.255.255.0 sub

# Set the gateway address to 172.16.1.1 on the PCs attached to subnet 172.16.1.0/24, and to 172.16.2.1 on the PCs attached to subnet 172.16.2.0/24.

# Ping a host on subnet 172.16.1.0/24 from the switch to check the connectivity.

<Switch> ping 172.16.1.2

  PING 172.16.1.2: 56  data bytes, press CTRL_C to break

    Reply from 172.16.1.2: bytes=56 Sequence=1 ttl=255 time=25 ms

    Reply from 172.16.1.2: bytes=56 Sequence=2 ttl=255 time=27 ms

    Reply from 172.16.1.2: bytes=56 Sequence=3 ttl=255 time=26 ms

    Reply from 172.16.1.2: bytes=56 Sequence=4 ttl=255 time=26 ms

    Reply from 172.16.1.2: bytes=56 Sequence=5 ttl=255 time=26 ms

 

  --- 172.16.1.2 ping statistics ---

    5 packet(s) transmitted

    5 packet(s) received

    0.00% packet loss

    round-trip min/avg/max = 25/26/27 ms

The output information shows that the switch can communicate with the hosts on subnet 172.16.1.0/24.

# Ping a host on subnet 172.16.2.0/24 from the switch to check the connectivity.

<Switch> ping 172.16.2.2

  PING 172.16.2.2: 56  data bytes, press CTRL_C to break

    Reply from 172.16.2.2: bytes=56 Sequence=1 ttl=255 time=25 ms

    Reply from 172.16.2.2: bytes=56 Sequence=2 ttl=255 time=26 ms

    Reply from 172.16.2.2: bytes=56 Sequence=3 ttl=255 time=26 ms

    Reply from 172.16.2.2: bytes=56 Sequence=4 ttl=255 time=26 ms

    Reply from 172.16.2.2: bytes=56 Sequence=5 ttl=255 time=26 ms

 

  --- 172.16.2.2 ping statistics ---

    5 packet(s) transmitted

    5 packet(s) received

    0.00% packet loss

    round-trip min/avg/max = 25/25/26 ms

The output information shows that the switch can communicate with the hosts on subnet 172.16.2.0/24.

# Ping a host on subnet 172.16.1.0/24 from a host on subnet 172.16.2.0/24 to check the connectivity. Host B can be successfully pinged from Host A.

Displaying and Maintaining IP Addressing

To do…

Use the command…

Remarks

Display information about a specified or all Layer 3 interfaces

display ip interface [ interface-type interface-number ]

Available in any view

Display brief information about a specified or all Layer 3 interfaces

display ip interface brief [ interface-type [ interface-number ] ]

Available in any view

 

H3C reserves the right to modify its collaterals without any prior notice. For the latest information of the collaterals, please consult H3C sales or call 400 hotline.