The primary IP address you assigned to the interface can overwrite the old one if there is any.
You cannot assign secondary IP addresses to an interface that has BOOTP or DHCP configured.
The primary and secondary IP addresses you assign to the interface can be located on the same
network segment. However, this should not violate the rule that different physical interfaces on your
device must reside on different network segments.
IP Addressing Configuration Example
As shown in
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:
Assign two IP addresses to VLAN-interface 1 on the switch.
Set the switch as the gateway on all PCs in the two networks.
Figure 1-3 Network diagram for IP addressing configuration
# Assign a primary IP address and a secondary IP address to VLAN-interface 1.
[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.
1-3, a port in VLAN 1 on a switch is connected to a LAN comprising two segments: