Configure an IPv4 Address on a Cisco Router Interface

Learn how to assign, enable, verify, replace, remove, and save an IPv4 address on a Cisco IOS router interface.

A router interface needs an IPv4 address to participate in IPv4 communication on its attached network. The address identifies the interface at Layer 3 and allows the router to send and receive packets on that subnet.

Each routed interface on a router belongs to a separate IP subnet. For a local-area network, the router interface address commonly serves as the default gateway: the address hosts use when they need to reach a destination outside their own subnet.

Example topology

In this example, a router connects through a switch to a host on the 192.168.5.0/24 network.

  • Router interface: 192.168.5.44 with mask 255.255.255.0
  • Host: 192.168.5.10 with mask 255.255.255.0
  • Host default gateway: 192.168.5.44
  • Network address: 192.168.5.0
  • Usable host range: 192.168.5.1 through 192.168.5.254
  • Broadcast address: 192.168.5.255

The router address 192.168.5.44 is a valid host address in the 192.168.5.0/24 subnet. Do not assign the network address or broadcast address to an interface. Also ensure that the subnet assigned to this interface does not overlap the subnet assigned to another routed interface on the same router.

Cisco IOS configuration modes

Cisco IOS uses different command contexts. The prompt helps identify the current mode.

ModePrompt exampleHow to enterPurpose
User EXECRouter>Initial CLI modeBasic monitoring commands and limited testing
Privileged EXECRouter#enableFull show commands, troubleshooting, and entry to configuration mode
Global configurationRouter(config)#configure terminalDevice-wide configuration
Interface configurationRouter(config-if)#interface fastethernet 0/0Configuration for one specific interface

To reach a specific interface, navigate through the modes in order:

Router> enable
Router# configure terminal
Router(config)# interface fastethernet 0/0
Router(config-if)#

The command exit moves back one configuration level. The command end, or the key sequence Ctrl+Z, returns to privileged EXEC mode.

Select the target interface

Use the interface command from global configuration mode. Common examples include:

Router(config)# interface fastethernet 0/0
Router(config)# interface gigabitethernet 0/1

Interface names and numbering vary by router platform and IOS version. A device may use names such as FastEthernet0/0, GigabitEthernet0/0, or a different slot/port format. Before configuring an interface, identify the valid names with:

Router# show ip interface brief

You can also use IOS command completion by typing part of a command and pressing the Tab key. If the interface name is invalid, IOS reports an input error rather than entering the intended interface configuration context.

Assign an IPv4 address and subnet mask

In interface configuration mode, use this syntax:

ip address <ipv4-address> <subnet-mask>

For the example LAN, configure FastEthernet0/0 as follows:

Router(config)# interface fastethernet 0/0
Router(config-if)# ip address 192.168.5.44 255.255.255.0

The mask 255.255.255.0 is equivalent to /24. It places the interface in the 192.168.5.0 network, leaves 192.168.5.1 through 192.168.5.254 as usable host addresses, and reserves 192.168.5.255 as the broadcast address.

Choose an address from the intended subnet that is not already in use. The address must also be a valid host address, not the network or broadcast address. A router must not have overlapping routed interface subnets because overlapping routes can create ambiguous forwarding behavior.

Enable the interface with no shutdown

New or unused interfaces may be administratively disabled. In interface configuration mode, remove that administrative disablement with:

Router(config-if)# no shutdown

Administratively down means the interface is disabled by configuration, usually because the configuration contains shutdown. The no shutdown command removes that condition.

no shutdown does not guarantee a working link. The interface still needs a connected cable, a powered and enabled peer, and compatible physical settings. A physical or Layer 2 problem can leave the interface operationally down even after it has been enabled.

Complete router LAN configuration

This sequence assigns the address, enables the interface, and returns to privileged EXEC mode:

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

When the interface is connected to an active peer, IOS may display messages indicating that the interface and line protocol changed state. The expected final state is normally up/up.

Verify the IPv4 address and interface state

Use show ip interface brief

The most useful first check is:

Router# show ip interface brief

This summary displays the interface name, assigned IP address, administrative Status, and operational Protocol state.

StatusProtocolLikely meaningRecommended next check
administratively downdownThe interface is disabled by configuration.Enter the correct interface and issue no shutdown.
downdownThe interface is enabled but has no working physical or Layer 2 connection.Check the cable, remote device, remote port, power, and physical settings.
updownThe physical link is detected, but the line protocol is not operational.Check encapsulation, VLAN or Layer 2 compatibility, and the peer configuration.
upupThe interface is enabled and operational at the physical and line-protocol levels.Test addressing and reachability with ping.

The line protocol is the operational Layer 2 state reported as the Protocol column. It is separate from the administrative state controlled by commands such as shutdown and no shutdown.

Inspect the interface configuration

To display the configuration applied to one interface, use:

Router# show running-config interface fastethernet 0/0

The running-config is the active configuration currently held in device memory. Confirm that the expected ip address and no shutdown state are present.

Test with ping

After the interface is operational, test connectivity. From the router, you can test the interface address:

Router# ping 192.168.5.44

A more useful end-to-end test is to ping from the directly connected host to 192.168.5.44. The host should use an address such as 192.168.5.10/24 and set its default gateway to 192.168.5.44.

Remove or replace an IPv4 address

Remove the address

To remove IPv4 addressing from an interface, enter interface configuration mode and use:

Router(config)# interface fastethernet 0/0
Router(config-if)# no ip address

Afterward, verify the result:

Router# show ip interface brief

The former address should no longer appear for that interface. Removing an address is different from shutting down the interface: no ip address removes Layer 3 addressing, while shutdown administratively disables the interface.

Replace the address

In common Cisco IOS configurations, entering a new primary ip address command replaces the existing primary IPv4 address:

Router(config)# interface fastethernet 0/0
Router(config-if)# ip address 192.168.5.50 255.255.255.0

Verify the replacement with show ip interface brief and inspect the interface configuration if necessary. Be careful when changing an address: connected hosts may need a new default gateway or may temporarily lose connectivity.

Router interfaces, switchports, and SVIs

A router routed interface is different from a normal Layer 2 switch port. A Layer 2 access or trunk port forwards Ethernet frames according to VLAN and switching configuration; it does not normally receive an IP address directly for Layer 3 forwarding.

A Layer 2 switch can have an IP address on a switched virtual interface (SVI). An SVI is a virtual interface associated with a VLAN and is commonly used for switch management. For example:

Switch(config)# interface vlan 1
Switch(config-if)# ip address 192.168.5.2 255.255.255.0
Switch(config-if)# no shutdown

This management address belongs to the VLAN interface, not directly to each physical access port. The physical ports remain Layer 2 switchports.

A multilayer switch can convert a supported physical port into a routed port with no switchport. After that conversion, the port operates at Layer 3 and can receive an IP address:

Switch(config)# interface gigabitethernet 0/1
Switch(config-if)# no switchport
Switch(config-if)# ip address 192.168.5.44 255.255.255.0
Switch(config-if)# no shutdown
FeatureRouter routed interfaceLayer 2 switch physical portSwitch virtual interface
Physical or virtualPhysical interfacePhysical interfaceVirtual VLAN interface
Normal roleLayer 3 routingLayer 2 frame switchingSwitch management or Layer 3 VLAN gateway
Direct IP address configurationYesNormally noYes
Typical configuration contextinterface gigabitethernet 0/0interface fastethernet 0/1interface vlan 1 or another VLAN

Commands for configuration and verification

TaskIOS commandConfiguration modeExpected result
Enter privileged EXEC modeenableUser EXECPrompt changes from > to #.
Enter global configurationconfigure terminalPrivileged EXECPrompt changes to (config)#.
Select the interfaceinterface fastethernet 0/0Global configurationPrompt changes to (config-if)#.
Assign an addressip address 192.168.5.44 255.255.255.0Interface configurationPrimary IPv4 address is applied.
Enable the interfaceno shutdownInterface configurationAdministrative shutdown is removed.
Summarize interfacesshow ip interface briefPrivileged EXECShows addresses and Status/Protocol states.
Inspect one interfaceshow running-config interface fastethernet 0/0Privileged EXECShows the active interface configuration.
Remove IPv4 addressingno ip addressInterface configurationRemoves the interface IPv4 address.
Save changescopy running-config startup-configPrivileged EXECCopies the active configuration to persistent storage.

Troubleshooting common problems

Administratively down/down

The interface is still disabled by configuration. Confirm that you selected the correct interface, then issue:

Router(config)# interface fastethernet 0/0
Router(config-if)# no shutdown
Router# show ip interface brief

Down/down after no shutdown

The interface is enabled but has no operational connection. Check the cable, the remote device, the remote port, power, and physical-layer conditions. Both ends should be connected and enabled. Inspect more detailed interface status and counters if needed.

The ip address command is rejected on a switch physical port

The port is probably operating as a Layer 2 switchport. Use an SVI for switch management. On a supported multilayer switch, enter no switchport first to convert the physical port to a routed port, then configure its IP address.

The address does not appear in show ip interface brief

You may have configured the wrong interface, entered the command unsuccessfully, or removed or replaced the address later. Check the interface name and numbering, inspect show running-config interface <interface-id>, and reapply the correct address if necessary.

A directly connected host cannot ping the router

Confirm that the host and router use addresses in the same subnet with compatible masks. Verify that the router interface is up/up. Then check the host settings, switch VLAN assignment, cabling, and any Layer 2 mismatch between the host and router.

The configuration disappears after reload

Changes made to the running configuration are lost after a reload unless they are saved. After successful verification, save the configuration:

Router# copy running-config startup-config

The startup-config is the saved configuration that the device loads after a restart. Always distinguish it from the active running-config.

Recommended configuration workflow

  1. Identify the correct interface with show ip interface brief and confirm the platform's interface naming.
  2. Calculate the intended subnet's network, usable host range, and broadcast address.
  3. Choose a valid, non-overlapping host address.
  4. Enter privileged EXEC, global configuration, and interface configuration modes.
  5. Apply ip address <ipv4-address> <subnet-mask>.
  6. Enable the interface with no shutdown.
  7. Verify the address and state with show ip interface brief.
  8. Inspect the exact configuration with show running-config interface <interface-id>.
  9. Test reachability with ping from the router or a directly connected host.
  10. Save the verified configuration with copy running-config startup-config.

For a concise reference while practicing, see Configure an IP Address for an Interface.