Configuring IP Address on a Cisco Router
After you have played a little with some basic commands on your Cisco router you probably want to take it to the next level and connect it to a network so the real fun can begin! Now to be able to TELENT into the router or even just PING it you have to configure at least one of the interfaces with an IP address. Preferably the one you want to plug the cable into…
required steps
If it’s a serial interface check out the Configuring Serial Interfaces tutorial as the steps are slightly different. For ethernet interfaces you only need to do two things:
1. Assigning an IP address and subnet mask
2. Enabling the interface(bringing it up).
If you have a DHCP server running on your network the router might gets an IP Address from the server before you can configure it manually.
optional commands
It’s always good practice to hard-code the speed and duplex and to give the interface some sort of description!
configuration
First check which interfaces are available on the router.
R1#show ip interface brief Interface IP-Address OK? Method Status Protocol FastEthernet0/0 unassigned YES unset administratively down down Serial0/0 unassigned YES unset administratively down down
Now select the interface and add a description.
R1#conf terminal Enter configuration commands, one per line. End with CNTL/Z. R1(config)#interface FastEthernet 0/0 R1(config-if)#description LINK TO LAN
Set interface speed and duplex.
R1(config-if)#speed ? 10 Force 10 Mbps operation 100 Force 100 Mbps operation auto Enable AUTO speed configuration R1(config-if)#speed 100 R1(config-if)#duplex ? auto Enable AUTO duplex configuration full Force full duplex operation half Force half-duplex operation R1(config-if)#duplex full
And finally set the IP Address and subnet mask.
R1(config-if)#ip address ? A.B.C.D IP address dhcp IP Address negotiated via DHCP pool IP Address autoconfigured from a local DHCP pool R1(config-if)#ip address 10.0.0.5 ? A.B.C.D IP subnet mask R1(config-if)#ip address 10.0.0.5 255.255.255.224 R1(config-if)#no shutdown R1(config-if)#end R1# *Mar 1 10:07:08.766: %SYS-5-CONFIG_I: Configured from console by console *Mar 1 10:07:09.175: %LINK-3-UPDOWN: Interface FastEthernet0/0, changed state to up *Mar 1 10:07:10.994: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed state to up R1#
As you can see the link state and the line protocol almost immediately changed to up/up.
verification
Verify status and IP Address
R1#show ip interface brief Interface IP-Address OK? Method Status Protocol FastEthernet0/0 10.0.0.5 YES manual up up Serial0/0 unassigned YES unset administratively down down R1#
Verify interface description
R1#show interface description Interface Status Protocol Description Fa0/0 up up LINK TO LAN Se0/0 admin down down R1#
Detailed information about the interface
R1#show interfaces FastEthernet 0/0 FastEthernet0/0 is up, line protocol is up Hardware is AmdFE, address is 000d.bdf6.39a0 (bia 000d.bdf6.39a0) Description: LINK TO LAN Internet address is 10.0.0.5/27 MTU 1500 bytes, BW 100000 Kbit, DLY 100 usec, reliability 255/255, txload 1/255, rxload 1/255 Encapsulation ARPA, loopback not set Keepalive set (10 sec) Full-duplex, 100Mb/s, 100BaseTX/FX ARP type: ARPA, ARP Timeout 04:00:00 Last input 00:00:02, output 00:00:02, output hang never Last clearing of "show interface" counters never Input queue: 0/75/0/0 (size/max/drops/flushes); Total output drops: 0 Queueing strategy: fifo Output queue: 0/40 (size/max) 5 minute input rate 1000 bits/sec, 1 packets/sec 5 minute output rate 0 bits/sec, 0 packets/sec 948 packets input, 58686 bytes Received 944 broadcasts, 0 runts, 0 giants, 0 throttles 0 input errors, 0 CRC, 0 frame, 0 overrun, 0 ignored 0 watchdog 0 input packets with dribble condition detected 194 packets output, 18734 bytes, 0 underruns 0 output errors, 0 collisions, 1 interface resets 0 babbles, 0 late collision, 0 deferred 3 lost carrier, 0 no carrier 0 output buffer failures, 0 output buffers swapped out R1#
Verify using show run
R1#show run | section interface FastEthernet0/0 interface FastEthernet0/0 description LINK TO LAN ip address 10.0.0.5 255.255.255.224 speed 100 full-duplex R1#
The section output modifier requires IOS version 12.3(2)T or higher!
The output modifiers are case sensitive! The command show run | section interface fastethernet0/0 wouldn’t work. Also, mind the spaces!
Another version of show run
R1#show run interface FastEthernet0/0 Building configuration... Current configuration : 119 bytes ! interface FastEthernet0/0 description LINK TO LAN ip address 10.0.0.5 255.255.255.224 speed 100 full-duplex end R1#
Of course the ultimate test is ping, so let’s ping something!
R1#ping 10.0.0.1 Type escape sequence to abort. Sending 5, 100-byte ICMP Echos to 10.0.0.1, timeout is 2 seconds: !!!!! Success rate is 100 percent (5/5), round-trip min/avg/max = 1/2/4 ms R1#
And finally let’s ping from a PC
Microsoft Windows [Version 6.1.7600] Copyright (c) 2009 Microsoft Corporation. All rights reserved. C:\Users\Szilard>ping 10.0.0.5 Pinging 10.0.0.5 with 32 bytes of data: Reply from 10.0.0.5: bytes=32 time=2ms TTL=255 Reply from 10.0.0.5: bytes=32 time=1ms TTL=255 Reply from 10.0.0.5: bytes=32 time=1ms TTL=255 Reply from 10.0.0.5: bytes=32 time=1ms TTL=255 Ping statistics for 10.0.0.5: Packets: Sent = 4, Received = 4, Lost = 0 (0% loss), Approximate round trip times in milli-seconds: Minimum = 1ms, Maximum = 2ms, Average = 1ms C:\Users\Szilard>
commands explained
Commands used with a brief explanation.
interface FastEthernet 0/0: Selects interface FastEthernet 0/0
description LINK TO LAN: Sets the description on the interface
speed 100: Hard-codes the speed of the interface
duplex full: Hard-codes full duplex operation on the interface
ip address 10.0.0.5 255.255.255.224: Assigns the IP Address
show ip interface brief: Shows all available interfaces on the router, they IP Address and status
show interface description: Shows the interface description
show interfaces FastEthernet 0/0: Shows a very detailed information about the interface
show run | section interface FastEthernet0/0: Show a section of the running configuration that is relevant to us
show run interface FastEthernet0/0: Show the FastEthernet0/0 section of the running configuration