CCNA online course

Configure an IP Address on a Cisco Router Interface

Learn how to configure and verify IPv4 and IPv6 addresses on Cisco IOS router interfaces, enable interfaces, verify routes, save changes, and troubleshoot connectivity.

A routed interface is a Layer 3 interface that can hold an IP address and forward packets between networks. Before a router can send and receive IP traffic on a connected network, the interface needs a valid address, an appropriate subnet mask or prefix length, and an operational link.

In a common LAN design, the router interface is also the default gateway for hosts on that subnet. For example, hosts in 192.168.10.0/24 might use 192.168.10.1 as their default gateway.

How Interface IP Addressing Works

An IPv4 address is a 32-bit logical address written in dotted-decimal form, such as 192.168.10.1. A subnet mask identifies which bits represent the network and which bits represent hosts. The CIDR form expresses the same boundary as a prefix length, such as /24.

For example, 192.168.10.1 255.255.255.0 is equivalent to 192.168.10.1/24. The connected network is 192.168.10.0/24, and the router address can be used as the default gateway by hosts on that network.

Every routed interface should normally connect to a different IP subnet. Avoid duplicate addresses and overlapping subnets. Both ends of an Ethernet or point-to-point link must use compatible addresses from the same subnet. For example, 10.0.0.1/30 and 10.0.0.2/30 can be used on opposite ends of a point-to-point link.

Cisco IOS Configuration Modes

Cisco IOS uses command modes to control which commands are available. The prompt gives a quick indication of the current mode.

ModeTypical promptHow to enterPurpose
User EXECRouter>Initial mode after loginBasic monitoring and limited commands
Privileged EXECRouter#enableAdvanced show commands and access to configuration mode
Global configurationRouter(config)#configure terminalSettings that affect the device globally
Interface configurationRouter(config-if)#interface gigabitethernet 0/0Settings for one selected interface

Use exit to move back one configuration level. Use end or press Ctrl+Z to return directly to privileged EXEC mode.

Router> enable
Router# configure terminal
Router(config)# interface gigabitethernet 0/0
Router(config-if)# exit
Router(config)# end
Router#

Identify the Target Interface

Before changing an address, identify the exact interface name, slot, and port number. A typo can configure a different interface or produce an invalid command.

Common Cisco interface names include:

  • FastEthernet, often written as FastEthernet0/0
  • GigabitEthernet, often written as GigabitEthernet0/0
  • Ethernet, used on some platforms
  • Serial, commonly used for WAN or point-to-point links
  • Loopback, a logical software interface such as Loopback0

A loopback interface is not connected to a physical cable. It remains available while the router is operating and is often used for router identification, testing, or routing protocols.

Router# show ip interface brief
Router# show interfaces

show ip interface brief provides a compact inventory of interface names, assigned IPv4 addresses, and status. show interfaces provides detailed physical, data-link, error, and traffic information.

Configure an IPv4 Address

The IOS ip address command assigns an IPv4 address and dotted-decimal subnet mask to the selected interface.

Router> enable
Router# configure terminal
Router(config)# interface gigabitethernet 0/0
Router(config-if)# ip address 192.168.10.1 255.255.255.0
Router(config-if)# no shutdown
Router(config-if)# end

This example assigns 192.168.10.1/24 to GigabitEthernet0/0. Hosts on 192.168.10.0/24 can use this address as their default gateway, provided the interface and connected Layer 2 network are operational.

The address must match the addressing plan, must belong to the intended subnet, and must not be assigned to another device. An interface can support a secondary IPv4 address, but secondary addressing is a special-use configuration. The normal design is one primary subnet per routed interface.

Replace or Remove an IPv4 Address

Entering a new primary address generally replaces the existing primary address on that interface. To explicitly remove the configured IPv4 address, use no ip address in interface configuration mode.

Router(config)# interface gigabitethernet 0/0
Router(config-if)# no ip address
Router(config-if)# ip address 192.168.20.1 255.255.255.0

Use care when changing an address remotely: the current management connection may be lost as soon as the interface address changes.

Enable the Interface

The shutdown command places an interface in an administratively disabled state. The command no shutdown removes that administrative shutdown.

Router(config)# interface gigabitethernet 0/0
Router(config-if)# no shutdown

Enabling an interface does not guarantee that it will become operational. Cabling, the peer interface, switch-port state, VLAN placement, encapsulation, and other Layer 1 or Layer 2 conditions can still prevent communication.

Verify IPv4 Configuration

Verification should confirm the configured address, administrative state, physical state, line protocol, routing table, and reachability.

Router# show ip interface brief
Router# show running-config interface gigabitethernet 0/0
Router# show ip route connected
Router# ping 192.168.10.2

show running-config interface displays the active configuration for one interface. The connected-route command confirms whether IOS installed a route for the directly connected network.

Interface statusLine protocol statusLikely meaningInitial troubleshooting action
UpUpThe interface and data link are operational.Test the neighbor and confirm the connected route.
Administratively downDownThe interface is disabled by configuration, usually by shutdown.Enter interface mode and issue no shutdown.
UpDownThe physical signal exists, but the data-link or Layer 2 protocol is not operational.Check the peer, cabling, encapsulation, VLAN, and other Layer 2 conditions.
DownDownNo physical signal is detected, or the interface or peer is not operating.Check cabling, hardware, switch-port state, and the remote interface.

A directly connected route is normally installed only when the interface has a valid address and is operational. If the expected route is missing, check the address, mask, and interface state.

Save and Review the Configuration

The running configuration is the active configuration in memory. The startup configuration is the saved configuration stored in NVRAM and loaded when the device starts.

Router# show running-config interface gigabitethernet 0/0
Router# copy running-config startup-config

Save after validating the change. Unsaved changes in the running configuration are lost if the router reloads or loses power before they are copied to the startup configuration.

Configure IPv6 on a Routed Interface

An IPv6 global unicast address is a globally routable IPv6 address. IPv6 uses a prefix length, such as /64, instead of an IPv4 dotted-decimal mask.

If the router must forward IPv6 traffic between networks, enable IPv6 unicast routing globally. Assigning an IPv6 address alone does not necessarily enable the router to route IPv6 packets between interfaces.

Router# configure terminal
Router(config)# ipv6 unicast-routing
Router(config)# interface gigabitethernet 0/0
Router(config-if)# ipv6 address 2001:db8:10:1::1/64
Router(config-if)# no shutdown
Router(config-if)# end

IPv6 interfaces also commonly have a link-local address. A link-local address is used only on the local link and begins in fe80::/10. Neighbor communication, routing protocols, and some next-hop operations use link-local addresses. IOS can automatically create a link-local address when IPv6 is enabled on an interface, or one can be configured explicitly.

Router# show ipv6 interface brief
Router# show ipv6 interface gigabitethernet 0/0
Router# show ipv6 route connected
Router# ping ipv6 2001:db8:10:1::2
TaskIPv4 command or conceptIPv6 command or conceptVerification method
Assign an addressip address 192.168.10.1 255.255.255.0ipv6 address 2001:db8:10:1::1/64Show the interface summary.
Enable forwardingIPv4 forwarding is normally available on a router.ipv6 unicast-routingReview the global running configuration and IPv6 routes.
Verify interface stateshow ip interface briefshow ipv6 interface briefConfirm the interface is operational and has the expected address.
Verify a connected routeshow ip route connectedshow ipv6 route connectedConfirm the expected directly connected prefix.
Test a neighborping 192.168.10.2ping ipv6 2001:db8:10:1::2Confirm local-link reachability.

Address-Planning Constraints

  • Assign each routed interface to the correct planned subnet.
  • Do not reuse an address already assigned to another device.
  • Use the correct IPv4 mask or IPv6 prefix length.
  • Do not create overlapping subnets unless the design specifically requires a supported special case.
  • Place both ends of a point-to-point or Ethernet segment in compatible portions of the same subnet.
  • Ensure attached hosts use the correct address, mask or prefix, VLAN, and default gateway.
  • Treat secondary IPv4 addresses as an exception, not as the normal method for designing routed interfaces.

Point-to-Point Example

For a 10.0.0.0/30 point-to-point network, configure one router as 10.0.0.1 255.255.255.252 and the peer as 10.0.0.2 255.255.255.252. After both interfaces are enabled, each router should be able to ping the other interface address.

Address Boundary Error Example

Two endpoints may fail to communicate when one uses a /24 mask and the other uses an incompatible /25 boundary or an address from the wrong subnet. Compare the addresses and masks with the addressing plan rather than assuming that similar-looking addresses are on the same network.

Basic Troubleshooting Workflow

  1. Confirm the intended interface name, address, mask, or IPv6 prefix.
  2. Use show ip interface brief or show ipv6 interface brief to check administrative and protocol status.
  3. Review the specific interface configuration with show running-config interface.
  4. Check cabling, the switch-port state, VLAN placement, the peer interface, and Layer 2 requirements.
  5. Check for duplicate addresses, incorrect masks, and incorrect default gateways on attached hosts.
  6. Confirm the expected connected route in the appropriate routing table.
  7. Use targeted pings, starting with the directly connected neighbor or host, then test more distant destinations.
SymptomLikely causeHow to verifyCorrective action
Administratively down/downThe interface is disabled with shutdown.Check the brief interface summary and interface configuration.Enter the interface and issue no shutdown.
Up/downA data-link or Layer 2 problem exists.Inspect detailed output and the peer or switch port.Correct cabling, peer state, encapsulation, VLAN, or other Layer 2 settings.
Host cannot ping the routerIncorrect host address, mask, gateway, VLAN, or router interface state.Compare both configurations and check interface status.Correct the addressing plan, VLAN connection, or interface configuration.
Connected route is missingNo valid address, incorrect prefix, or interface is not up/up.Review the running configuration, interface summary, and routing table.Correct the address or prefix and restore interface operation.
IPv6 is configured but remote IPv6 networks failIPv6 forwarding is disabled, no route exists, or the peer is misconfigured.Check ipv6 unicast-routing, IPv6 routes, and peer reachability.Enable forwarding, add or learn the required route, and correct peer addressing.

Exam-Relevant Notes

  • enable moves from user EXEC to privileged EXEC.
  • configure terminal moves from privileged EXEC to global configuration mode.
  • interface ... selects the interface and enters interface configuration mode.
  • no shutdown administratively enables an interface; it does not repair a physical or Layer 2 fault.
  • up/up indicates that both the interface and line protocol are operational.
  • A connected route is associated with an operational interface and its configured network.
  • copy running-config startup-config preserves validated changes across a reload.
  • IPv6 routing between interfaces requires ipv6 unicast-routing on platforms where it is not already enabled.

For related fundamentals, review the OSI Reference Model and computer networking concepts. Interface addressing also supports later work with OSPF and Cisco IOS configuration management.