28CHAPTER 3: IP ADDRESS CONFIGURATION GUIDE
Configuration Procedure | Assign a primary and secondary IP addresses to |
| ensure that all the hosts on the LAN can access external networks through Switch. |
| Set Switch as the gateway on all the hosts of the two network segments to ensure |
| that they can communicate with each other. |
| # Assign a primary IP address and a secondary IP address to |
| <Switch> |
| [Switch] interface |
| |
| |
| # Set the gateway address to 172.16.1.1 on the hosts in subnet 172.16.1.0/24, |
| and to 172.16.2.1 on the hosts in subnet 172.16.2.0/24. |
| # Ping Host B on Host A to verify the connectivity. |
Complete Configuration | # |
| interface |
| ip address 172.16.1.1 255.255.255.0 |
| ip address 172.16.2.1 255.255.255.0 sub |
| # |
Precautions | ■ You can assign at most five IP addresses to an interface, among which one is |
| the primary IP address and the others are secondary IP addresses. A newly |
| specified primary IP address overwrites the previous one. |
| ■ The primary and secondary IP addresses of an interface cannot reside on the |
| same network segment; an IP address of a VLAN interface must not be on the |
| same network segment as that of a loopback interface on a device. |
| ■ A VLAN interface cannot be configured with a secondary IP address if the |
| interface has obtained an IP address through BOOTP or DHCP. |