ip address [ip] [mask]
Assigns an IPv4 address and subnet mask to an interface, enabling IP communication on that interface.
ip address [ip] [mask]When to Use This Command
- Configuring a router's GigabitEthernet interface with an IP address to connect to a local subnet.
- Setting up a management IP on a switch VLAN interface for remote access.
- Assigning a secondary IP address to an interface for multi-networking.
- Configuring an IP address on a loopback interface for router identification or OSPF router-id.
Command Examples
Assign primary IP address to GigabitEthernet0/0
interface GigabitEthernet0/0
ip address 192.168.1.1 255.255.255.0
no shutdownRouter(config-if)#ip address 192.168.1.1 255.255.255.0 Router(config-if)#no shutdown Router(config-if)# *Mar 1 00:01:23.456: %LINK-3-UPDOWN: Interface GigabitEthernet0/0, changed state to up *Mar 1 00:01:24.456: %LINEPROTO-5-UPDOWN: Line protocol on Interface GigabitEthernet0/0, changed state to up
The command assigns IP 192.168.1.1 with mask 255.255.255.0. 'no shutdown' activates the interface. Syslog messages confirm interface and line protocol are up.
Assign secondary IP address to an interface
interface GigabitEthernet0/0
ip address 10.0.0.1 255.255.255.0 secondaryRouter(config-if)#ip address 10.0.0.1 255.255.255.0 secondary Router(config-if)#
Adds a secondary IP 10.0.0.1/24 to the same interface. No output besides the prompt; use 'show ip interface brief' to verify.
Understanding the Output
The 'ip address' command itself produces no direct output; success is indicated by the prompt returning without error. Use 'show ip interface brief' to verify the IP is assigned: the 'IP-Address' column shows the primary IP, 'Method' shows 'manual', 'Status' and 'Protocol' should be 'up' for a working interface. For secondary IPs, use 'show ip interface' to see all addresses. A common issue is an overlapping subnet error if the IP conflicts with another interface on the same router.
CCNA Exam Tips
Remember that the 'ip address' command is configured in interface configuration mode; you must first enter 'interface <type> <number>'.
The 'secondary' keyword allows multiple IPs on one interface; CCNA may test that secondary IPs are used for legacy multi-networking.
Always use 'no shutdown' after assigning an IP to bring the interface up; exam questions often forget this step.
The subnet mask can be in dotted decimal (e.g., 255.255.255.0) or prefix length (e.g., /24) — both are valid but CCNA typically uses dotted decimal.
Common Mistakes
Forgetting to enter interface configuration mode before typing 'ip address' — results in '% Invalid input detected'.
Using the wrong subnet mask, causing IP address overlap or incorrect subnetting.
Assigning an IP address without using 'no shutdown' — interface remains administratively down.
Attempting to assign a secondary IP without the 'secondary' keyword, which overwrites the primary IP.
Related Commands
interface [type] [number]
Enters interface configuration mode for a specific interface (e.g., GigabitEthernet0/1) to configure Layer 2 or Layer 3 parameters.
no shutdown
Enables an interface that has been administratively disabled, allowing it to forward traffic and participate in network operations.
show ip interface
Displays the status and configuration of all IP interfaces on a Cisco router, including IP address, protocol status, and interface statistics, used for verifying interface IP configuration and troubleshooting connectivity issues.
show ip interface brief
Displays a summary of all IP interfaces on the device, including their IP address, status, and protocol state, used for quick verification of interface configuration and connectivity.
Practice for the CCNA 200-301
Test your knowledge with hundreds of CCNA practice questions covering all exam domains.
Practice CCNA Questions