Router and Switch Interfaces
Interface configuration is arguably the most important router configuration because without interfaces, a router is a pretty useless object. Furthermore, interface configurations must be totally precise
to enable communication with other devices. Network layer addresses, media type, bandwidth, and other administrator commands are all used to configure an interface.
On a layer 2 switch, interface configurations typically involve a lot less work than router interface configuration. Check out the output from the powerful verification command show ip interface brief , which
reveals all the interfaces on my 3560 switch:
tod # sh ip interface brief
Interface IP-Address OK? Method Status
Protocol
Vlan1 192.168.255.8 YES DHCP up
up
FastEthernet0/1 unassigned YES unset up
up
FastEthernet0/2 unassigned YES unset up
up
FastEthernet0/3 unassigned YES unset down
down
FastEthernet0/4 unassigned YES unset down
down
FastEthernet0/5 unassigned YES unset up
up
FastEthernet0/6 unassigned YES unset up
up
FastEthernet0/7 unassigned YES unset down
down
FastEthernet0/8 unassigned YES unset down
down
GigabitEthernet0/1 unassigned YES unset down
down
The previous output shows the default routed port found on all Cisco switches (VLAN 1), plus nine switch FastEthernet interface ports, with one port being a Gigabit Ethernet port used for uplinks to other switches.
Different routers use different methods to choose the interfaces used on them. For instance, the following command shows one of my 2800 ISR Cisco routers with two FastEthernet interfaces along with two serial WAN interfaces:
Router> sh ip int brief
Interface IP-Address OK? Method Status
Protocol
FastEthernet0/0 192.168.255.11 YES DHCP up
up
FastEthernet0/1 unassigned YES unset administratively down
down
Serial0/0/0 unassigned YES unset administratively down
down
Serial0/1/0 unassigned YES unset administratively down
down
Router>
Previously, we always used the interface type number sequence to configure an interface, but the newer routers come with an actual physical slot and include a port number on the module plugged into it. So on a modular router, the configuration would be interface type slot/port , as demonstrated here:
tod # config t
tod (config)# interface GigabitEthernet 0/1 tod (config-if)#
You can see that we are now at the Gigabit Ethernet slot 0, port 1 prompt, and from here we can make configuration changes to the interface. Make note of the fact that you can’t just type int gigabitethernet 0 . No shortcuts on the slot/port—you’ve got to type the slot/port variables in the command: type slot/port or, for example, intgigabitethernet 0/1 (or just int g0/1 ).
Once in interface configuration mode, we can configure various options. Keep in mind that speed and duplex are the two factors to be concerned with for the LAN:
tod # config t
tod (config)# interface GigabitEthernet 0/1 tod (config-if)# speed 1000 tod (config-if)# duplex full
So what’s happened here? Well basically, this has shut off the auto- detect mechanism on the port, forcing it to only run gigabit speeds at full duplex. For the ISR series router, it’s basically the same, but you get even more options! The LAN interfaces are the same, but the rest of the modules are different—they use three numbers instead of two. The three numbers used here can represent slot/subslot/port , but this depends on the card used in the ISR router. For the objectives, you just need to remember this: The first 0 is the router itself. You then choose the slot and then the port. Here’s an example of a serial interface on my 2811:tod (config)# interface serial ?
<0-2> Serial interface number
tod (config)# interface serial 0/0/?
<0-1> Serial interface number
tod (config)# interface serial 0/0/0 tod (config-if)#
This might look a little dicey to you, but I promise it’s really not that hard! It helps to remember that you should always view the output of the show ip interface brief command or a show running-config output first so you know the exact interfaces you have to deal with. Here’s one of my 2811’s output that has even more serial interfaces installed:
tod (config-if)# do show run
Building configuration...
[output cut]
!
interface FastEthernet0/0
no ip address
shutdown
duplex auto
speed auto
!
interface FastEthernet0/1
no ip address
shutdown
duplex auto
speed auto
!
interface Serial0/0/0
no ip address
shutdown
no fair-queue
!
interface Serial0/0/1
no ip address
shutdown
!
interface Serial0/1/0
no ip address
shutdown
!
interface Serial0/2/0
no ip address
shutdown
clock rate 2000000
!
[output cut]
For the sake of brevity, I didn’t include my complete running-config, but I’ve displayed all you really need. You can see the two built-in FastEthernet interfaces, the two serial interfaces in slot 0 (0/0/0 and 0/0/1), the serial interface in slot 1 (0/1/0), and the serial interface in slot 2 (0/2/0). And once y ou see the interfaces like this, it makes it a lot easier to understand how the modules are inserted into the router.
Just understand that if you type interface e0 on an old 2500 series router, interface fastethernet 0/0 on a modular router (such as the 2800 series router), or interface serial 0/1/0 on an ISR router, all you’re actually doing is choosing an interface to configure. Essentially, they’re all configured the same way after that.
Let’s delve deeper into our router interface discussi on by exploring how to bring up the interface and set an IP address on it next.
Bringing Up an Interface
You can disable an interface with the interface command shutdown and enable it with the no shutdown command. Just to remind you, all switch ports are enabled by default and all router ports are disabled by default, so we’re going to talk more about router ports than switch ports in the next few sections.
If an interface is shut down, it’ll display as administratively down
when you use the show interfaces command ( sh int for short):Router# sh int f0/0
FastEthernet0/1 is administratively down, line protocol is down
[output cut]
Another way to check an interface’s status is via the show running- config command. You can bring up the router interface with the no shutdown command ( no shut for short):
Router(config)# int f0/0
Router(config-if)# no shutdown
*August 21 13:45:08.455: %LINK-3-UPDOWN: Interface
FastEthernet0/0,
changed state to up
Router(config-if)# do show int f0/0
FastEthernet0/0 is up, line protocol is up
[output cut]
Configuring an IP Address on an Interface
Even though you don’t have to use IP on your routers, it’s usually what everyone uses. To configure IP addresses on an interface, use the ip address command from interface configuration mode and remember that you do not set an IP address on a layer 2 switch port!
tod (config)# int f0/1
tod (config-if)# ip address 172.16.10.2 255.255.255.0
Also, don’t forget to enable the interface with the no shutdown command. Remember to look at the command show interface int output to see if the interface is administratively shut down or not. Show ip int brief and show running-config will also give you this information.
The ip address address mask command starts the IP
processing on the router interface. Again, you do not configure an IP address on a layer 2 switch interface!
Okay—now if you want to add a second subnet address to an interface, you have to use the secondary parameter. If you type another IP
address and press Enter, it will replace the existing primary IP address and mask. This is definitely one of the Cisco IOS’s coolest features!So let’s try it. To add a secondary IP address, just use the secondary parameter:
tod (config-if)# ip address 172.16.20.2 255.255.255.0 ?
secondary Make this IP address a secondary address
<cr>
tod (config-if)# ip address 172.16.20.2 255.255.255.0 secondary tod (config-if)# do sh run
Building configuration...
[output cut]
interface FastEthernet0/1
ip address 172.16.20.2 255.255.255.0 secondary
ip address 172.16.10.2 255.255.255.0
duplex auto
speed auto
!
But I’ve got to stop here to tell you that I really wouldn’t recommend having multiple IP addresses on an interface because it’s really inefficient. I showed you how anyway just in case you someday find yourself dealing with an MIS manager who’s in love with really bad network design and makes you administer it! And who knows? Maybe someone will ask you about it someday and you’ll get to seem really smart because you know this.