Name
ip address — interface
Synopsis
ip addressaddress subnet-mask
[secondary] no ip addressaddress subnet-mask
[secondary]
Configures
The IP address for an interface
Default
No IP address
Description
This command sets the IP address for the interface to address
; the network mask used on the network is subnet-mask
. The secondary
keyword is used to apply a second (or third, or fourth... ) address to an interface. It is allowed only if the interface allows multiple IP addresses.
Example
This command sets the IP address of the ethernet0
interface to 10.10.1.1 and the subnet mask to 255.255.255.0:
interface ethernet0 ip address 10.10.1.1 255.255.255.0
The following commands use the secondary
keyword to add a second IP address to the ethernet0
interface:
interface ethernet0 ip address 10.10.1.1 255.255.255.0 ip address 10.10.2.1 255.255.255.0 secondary
This interface will now answer and provide routing for both the 10.10.1.0/24 and 10.10.2.0/24 subnets.
Get Cisco IOS in a Nutshell, 2nd Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.