04-Layer 3-IP Services Configuration Guide

HomeSupportResource CenterConfigure & DeployConfiguration GuidesH3C S12500-X & S12500X-AF Switch Series Configuration Guides(R115x)-6W10204-Layer 3-IP Services Configuration Guide
02-IP addressing configuration
Title Size Download
02-IP addressing configuration 92.95 KB

Configuring IP addressing

This chapter describes IP addressing basic and manual IP address assignment for interfaces. Dynamic IP address assignment (DHCP) is beyond the scope of this chapter. The IP addresses in this chapter refer to IPv4 addresses unless otherwise specified.

 

 

NOTE:

The term "interface" in this chapter collectively refers to Layer 3 interfaces, including VLAN interfaces and Layer 3 Ethernet interfaces. You can set an Ethernet port as a Layer 3 interface by using the port link-mode route command (see Layer 2—LAN Switching Configuration Guide).

 

Overview

This section describes the IP addressing basics.

IP addressing uses a 32-bit address to identify each host on an IPv4 network. To make addresses easier to read, they are written in dotted decimal notation, each address being four octets in length. For example, address 00001010000000010000000100000001 in binary is written as 10.1.1.1.

IP address classes

Each IP address breaks down into the following sections:

·          Net IDIdentifies a network. The first several bits of a net ID, known as the class field or class bits, identify the class of the IP address.

·          Host IDIdentifies a host on a network.

IP addresses are divided into five classes, as shown in Figure 1. The shaded areas represent the address class. The first three classes are most commonly used.

Figure 1 IP address classes

 

Table 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 startup 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

N/A

C

192.0.0.0 to 223.255.255.255

N/A

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 cannot be used as host IP addresses:

·          IP address with an all-zero net IDIdentifies 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 IDIdentifies a network.

·          IP address with an all-one host IDIdentifies a directed broadcast address. For example, a packet with the destination address of 192.168.1.255 will be broadcast to all the hosts on the network 192.168.1.0.

Subnetting and masking

Subnetting divides a network into smaller networks called subnets by using some bits of the host ID to create a subnet ID.

Masking identifies the boundary between the host ID and the combination of net ID and subnet ID.

Each subnet mask comprises 32 bits that correspond to the bits in an IP address. In a subnet mask, consecutive ones represent the net ID and subnet ID, and consecutive zeros represent the host ID.

Before being subnetted, Class A, B, and C networks use these default masks (also called natural masks): 255.0.0.0, 255.255.0.0, and 255.255.255.0, respectively.

Figure 2 Subnetting a Class B network

 

Subnetting increases the number of addresses that cannot be assigned to hosts. Therefore, using subnets means accommodating fewer hosts.

For example, a Class B network without subnetting can accommodate 1022 more hosts than the same network subnetted into 512 subnets.

·          Without subnetting65534 hosts (216 – 2). (The two deducted addresses are the broadcast address, which has an all-one host ID, and the network address, which has an all-zero host ID.)

·          With subnettingUsing the first nine bits of the host-id for subnetting provides 512 (29) subnets. However, only seven bits remain available for the host ID. This allows 126 (27 – 2) hosts in each subnet, a total of 64512 hosts (512 × 126).

Assigning an IP address to an interface

An interface must have an IP address to communicate with other hosts. You can either manually assign an IP address to an interface, or configure the interface to obtain an IP address through DHCP. If you change the IP address assignment method, the new IP address will overwrite the previous address.

An interface can have one primary address and multiple secondary addresses.

Typically, you need to configure a primary IP address for an interface. If the interface connects to multiple subnets, configure primary and secondary IP addresses on the interface so the subnets can communicate with each other through the interface.

In an IRF fabric, you can assign an IP address to the management Ethernet port of each member in the management Ethernet port view of the master. Only the IP address assigned to the management Ethernet port of the master takes effect. After an IRF fabric split, the IP addresses assigned to the management Ethernet ports of the new masters (original subordinates) take effect. Then you can use these IP addresses to log in to the new masters for troubleshooting.

 

 

NOTE:

After an IRF split, the routing information on the original master might not be updated immediately. As a result, the management Ethernet port of the original master cannot be pinged from the master (original subordinate) in another IRF fabric. To resolve the problem, wait until route synchronization between the devices is completed or enable NSR for the routing protocol. For information about NSR, see Layer 3—IP Routing Configuration Guide.

 

Configuration guidelines

Follow these guidelines when you assign an IP address to an interface:

·          An interface can have only one primary IP address. A newly configured primary IP address overwrites the previous one.

·          You cannot assign secondary IP addresses to an interface that obtains an IP address through DHCP.

·          The primary and secondary IP addresses assigned to the interface can be located on the same network segment. The following interfaces on the device must reside on different network segments:

¡  Different interfaces.

¡  Main interfaces and their subinterfaces.

¡  Subinterfaces of the same main interface.

·          The following commands are mutually exclusive. You can configure only one of these commands on the management Ethernet port of the IRF master.

¡  The ip address command with the irf-member member-id option that specifies the master.

¡  The ip address command that does not contain the irf-member member-id option.

¡  The mad ip address command.

¡  The ip address dhcp-alloc command.

·          Exclude the management Ethernet port of the master from being shut down if MAD is enabled in the IRF fabric. The port can be kept in up state when the MAD status transits to Recovery.

Configuration procedure

To assign an IP address to an interface:

 

Step

Command

Remarks

1.       Enter system view.

system-view

N/A

2.       Enter interface view.

interface interface-type interface-number

N/A

3.       Assign an IP address to the interface.

·         In standalone mode:
ip address ip-address { mask | mask-length } [ sub ]

·         In IRF mode:
ip address ip-address { mask-length | mask } [ irf-member member-id | sub ]

By default, no IP address is assigned to the interface.

To assign an IP address to the management Ethernet port of an IRF member device, enter the master's management Ethernet port view and specify the irf-member member-id option.

 

Displaying and maintaining IP addressing

Execute display commands in any view.

 

Task

Command

Display IP configuration and statistics for the specified or all Layer 3 interfaces.

display ip interface [ interface-type interface-number ]

Display brief IP configuration information for the specified or all Layer 3 interfaces.

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

 

IP address configuration example

Network requirements

As shown in Figure 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 to enable the hosts on the LAN to communicate with each other:

·          Assign a primary IP address and a secondary IP address to VLAN-interface 1 on the switch.

·          Set the primary IP address of the switch as the gateway address of the PCs on subnet 172.16.1.0/24. Set the secondary IP address of the switch as the gateway address of the PCs on subnet 172.16.2.0/24.

Figure 3 Network diagram

 

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.

Verifying the configuration

# Verify the connectivity between a host on subnet 172.16.1.0/24 and the switch.

<Switch> ping 172.16.1.2

Ping 172.16.1.2 (172.16.1.2): 56 data bytes, press CTRL_C to break

56 bytes from 172.16.1.2: icmp_seq=0 ttl=128 time=7.000 ms

56 bytes from 172.16.1.2: icmp_seq=1 ttl=128 time=2.000 ms

56 bytes from 172.16.1.2: icmp_seq=2 ttl=128 time=1.000 ms

56 bytes from 172.16.1.2: icmp_seq=3 ttl=128 time=1.000 ms

56 bytes from 172.16.1.2: icmp_seq=4 ttl=128 time=2.000 ms

 

--- Ping statistics for 172.16.1.2 ---

5 packet(s) transmitted, 5 packet(s) received, 0.0% packet loss

round-trip min/avg/max/std-dev = 1.000/2.600/7.000/2.245 ms

# Verify the connectivity between a host on subnet 172.16.2.0/24 and the switch.

<Switch> ping 172.16.2.2

Ping 172.16.2.2 (172.16.2.2): 56 data bytes, press CTRL_C to break

56 bytes from 172.16.2.2: icmp_seq=0 ttl=128 time=2.000 ms

56 bytes from 172.16.2.2: icmp_seq=1 ttl=128 time=7.000 ms

56 bytes from 172.16.2.2: icmp_seq=2 ttl=128 time=1.000 ms

56 bytes from 172.16.2.2: icmp_seq=3 ttl=128 time=2.000 ms

56 bytes from 172.16.2.2: icmp_seq=4 ttl=128 time=1.000 ms

 

--- Ping statistics for 172.16.2.2 ---

5 packet(s) transmitted, 5 packet(s) received, 0.0% packet loss

round-trip min/avg/max/std-dev = 1.000/2.600/7.000/2.245 ms

# Verify the connectivity between a host on subnet 172.16.1.0/24 and a host on subnet 172.16.2.0/24. The ping operation succeeds.

  • Cloud & AI
  • InterConnect
  • Intelligent Computing
  • Security
  • SMB Products
  • Intelligent Terminal Products
  • Product Support Services
  • Technical Service Solutions
All Services
  • Resource Center
  • Policy
  • Online Help
All Support
  • Become a Partner
  • Partner Resources
  • Partner Business Management
All Partners
  • Profile
  • News & Events
  • Online Exhibition Center
  • Contact Us
All About Us
新华三官网