InterfacesInterface Config

ip address [ip] [mask]

Assigns an IPv4 address and subnet mask to an interface, enabling IP communication on that interface.

Syntax·Interface Config
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 shutdown
Router(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 secondary
Router(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

1.

Remember that the 'ip address' command is configured in interface configuration mode; you must first enter 'interface <type> <number>'.

2.

The 'secondary' keyword allows multiple IPs on one interface; CCNA may test that secondary IPs are used for legacy multi-networking.

3.

Always use 'no shutdown' after assigning an IP to bring the interface up; exam questions often forget this step.

4.

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

Practice for the CCNA 200-301

Test your knowledge with hundreds of CCNA practice questions covering all exam domains.

Practice CCNA Questions