ip address
Use the ip address Interface Configuration (Ethernet, VLAN, Port-channel) mode command to define an IP address for an interface. Use the no form of this command to remove an IP address definition.
Syntax
OOB port:
ip address ip-address {mask | /prefix-length} [default-gateway-ip-address]
no ip address
In-Band interfaces:
ip address ip-address {mask | /prefix-length}
no ip address [ip-address]
Parameters
-
ip-address—Specifies the IP address.
-
mask—Specifies the network mask of the IP address.
-
prefix-length—Specifies the number of bits that comprise the IP address prefix. The prefix length must be preceded by a forward slash (/). (Range: 8–30)
-
default-gateway-ip-address—Specifies the default gateway IP address. The route is gotten a metric of 4 for an In-Band interface and 2 for OOB.
Default Configuration
No IP address is defined for interfaces.
Command Mode
Interface Configuration mode
User Guidelines
Use the ip address command to define a static IP address on an interface.
In-Band interfaces
Multiple IP addresses are supported. A new defined IP address is added on the interface.
Defining a static IP address on an interface stops a DHCP client running on the interface and removes the IP address assigned by the DHCP client.
If a configured IP address overlaps another configured one a warning message is displayed. To change an existed IP address, delete the existed one and add the new one.
While no IP address is assigned either by DHCP client or manually the default IP address 192.168.1.254 is assigned on the Default VLAN.
OOB port
One IP address is supported. A new IP address defined on the OOB port overrides the previously defined IP address on the OOB port.
Defining a static IP address on the OOB port stops a DHCP client running on the OOB port and deletes an IP address assigned by the DHCP client.
While no IP address is assigned either by DHCP client or manually the default IP address 192.168.1.254 is assigned on the OOB port
Examples
Example 1. The following example configures VLAN 1 with IP address 131.108.1.27 and subnet mask 255.255.255.0.
switchxxxxxx(config)# interface vlan 1
switchxxxxxx(config-if)# ip address 131.108.1.27 255.255.255.0
Example 2. The following example configures 3 overlapped IP addresses.
switchxxxxxx(config)# interface vlan 1
switchxxxxxx(config-if)# ip address 1.1.1.1 255.0.0.0
switchxxxxxx(config)# exit
switchxxxxxx(config)# interface vlan 2
switchxxxxxx(config-if)# ip address 1.2.1.1 255.255.0.0
switchxxxxxx(config)# This IP address overlaps IP address 1.1.1.1/8 on vlan1, are you sure? [Y/N]Y
switchxxxxxx(config)# exit
switchxxxxxx(config)# interface vlan 3
switchxxxxxx(config-if)# ip address 1.3.1.1 255.255.0.0
switchxxxxxx(config)# This IP address overlaps IP address 1.1.1.1/8 on vlan1, are you sure? [Y/N]Y
switchxxxxxx(config)# exit
Example 3. The following example configures IP address on OOB:
switchxxxxxx(config)# interface oob
switchxxxxxx(config-if)# ip address 131.108.1.27 255.255.255.0 131.108.1.100