ip address

Configures an IP address on an interface.
Syntax
ip address ip-address/mask [ dynamic | ospf-ignore | ospf-passive ] [ replace ]
ip address { ip-address mask | ip-address/mask } [ secondary ]
no ip address { ip-address mask | ip-address/mask } [ secondary ] [ dynamic | ospf-ignore | ospf-passive ] [ replace ]
no ip address [ * ]
Parameters
ip-address
Specifies the IP address.
mask
IP address or subnet mask length. The subnet mask can be in dotted decimal notation or in CIDR notation. For CIDR, enter a forward slash (/) between the ip address and the mask.
dynamic
Specifies the interface IP address is dynamic.
ospf-ignore
Disables adjacency formation with OSPF neighbors and disables advertisement of the interface to OSPF.
ospf-passive
Disables adjacency formation with OSPF neighbors but does not disable advertisement of the interface to OSPF.
replace
Replaces the configured primary IP address on the interface.
secondary
Specifies that the configured address is a secondary IP address. If this keyword is omitted, the configured address is the primary IP address.
*
Specifies all configured IP addresses.
Modes

Interface configuration mode

Management interface configuration mode

Usage Guidelines
  • Use this command to configure a primary or secondary IP address for a specific interface.
  • You can also use this command to prevent OSPF from running on specified subnets. Multiple primary IP addresses are supported on an interface.
  • You can use this command to configure a primary or secondary IP address for a management interface.
  • For a management interface, only one primary IP address is supported. Secondary IP addresses are not supported.
  • A primary IP address cannot overlap with a previously configured IP subnet.
  • A primary IP address must be configured before you configure a secondary IP address in the same subnet.
  • To remove the configured static or DHCP address, enter no ip address. This resets the address to 0.0.0.0/0.
  • The no form of the command removes a specific IP address from the interface.
  • The * option to represent all IP addresses is only supported for the no form of the command.
Examples

The following example configures a primary IP address on a specified Ethernet interface.

device(config)# interface ethernet 1/1/1
device(config-if-e1000-1/1/1)# ip address 10.1.1.1 255.255.255.0

The following example configures a primary IP address on a specified Ethernet interface using CIDR format.

device(config)# interface ethernet 1/3/1
device(config-if-e1000-1/1/1)# ip address 10.1.1.1/24

The following example replaces the primary IP address of an interface.

device# configure terminal
device (config)# interface ethernet 1/1/21
device(config-if-e1000-1/1/21)# ip address 10.1.1.2/24 replace  

The following example removes all the configured IP addresses on an interface.

device(config)# interface ethernet 1/3/1
device(config-if-e1000-1/1/1)# no ip address *