Configuring Serial Interfaces

Configuring Serial Interfaces

Problem

You want to configure a serial interface for a WAN connection.

Solution

When you configure a router's serial interface, you need to specify the encapsulation, the IP address, and whether the interface will be the DCE or DTE:

Router3#configure terminal 
Enter configuration commands, one per line. End with CNTL/Z.
Router3(config)#interface Serial1
Router3(config-if)#description WAN Connection to Chicago
Router3(config-if)#ip address 192.168.99.5 255.255.255.252
Router3(config-if)#encapsulation hdlc
Router3(config-if)#clock rate 56000
Router3(config-if)#no shutdown
Router3(config-if)#exit
Router3(config)#end
Router3#

Discussion

There are a couple of extremely important commands in this sample configuration. The first sets the serial encapsulation protocol. In this case, we have used the High-Level Data Link Control (HDLC) protocol, which is a standard Layer 2 protocol for synchronous serial connections:

Router3(config-if)#encapsulation hdlc

In fact, HDLC is the default encapsulation type for synchronous serial interfaces on Cisco routers, so we could have omitted this command. Because it is the default, this command does not show up in the configuration when we show the configuration:

Router3#show running-config interface Serial1 
Building configuration...

Current configuration : 123 bytes
!
interface Serial1
description WAN Connection to Chicago
ip address 192.168.99.5 255.255.255.252
clock rate 56000
end

Router3#

If you prefer to use a different encapsulation type, there are several other options that are appropriate in different situations. They are all set using the interface configuration command encapsulation, followed by one of the keywords shown in Table 16-1.

Table 16-1. Synchronous serial encapsulation types
Command Description
Router3(config-if)#
encapsulation hdlc
The default synchronous serial encapsulation type for Cisco routers.
Router3(config-if)#
encapsulation sdlc
Sets SDLC encapsulation for use with SNA related protocols. Please refer to Chapter 15 for more information.
Router3(config-if)#
encapsulation frame-relay
Sets Frame-Relay encapsulation. Please refer to Chapter 10 for more information.
Router3(config-if)#
encapsulation ppp
Sets the standard PPP encapsulation.
Router3(config-if)#
encapsulation x25
Sets X.25 encapsulation.
Router3(config-if)#
encapsulation lapb
Sets LAPB encapsulation, which is commonly used with X.25 circuits.
Router3(config-if)#
encapsulation atm-dxi
Sets ATM encapsulation for a serial interface.
Router3(config-if)#
encapsulation smds
Sets SMDS encapsulation.


The last two of these options allow you to do things that are somewhat unusual. For example, the atm-dxi keyword sets up the serial interface to use an HDLC-like protocol called Data Exchange Interface (DXI) to carry ATM cells. This requires a special external ATM Data Service Unit (ADSU) that you connect to the router via a standard serial cable.

The last option in Table 16.1 uses the smds keyword to enable the Switched Multi-megabit Data Service (SMDS) protocol. This is a high-speed WAN protocol used by some WAN service providers. If you use SMDS, you will require SMDS address information from your WAN vendor. SMDS is a relatively rare protocol, which makes it unfortunately beyond the scope of this book.

The second extremely important part of the example configuration is the clock rate command:

Router3(config-if)#clock rate 56000

This command sets the interface's line speed to 56 Kbps. Most Cisco synchronous serial interfaces can support line speeds between 1.2 Kbps and 4 Mbps, although they generally only accept specific round number values rather than arbitrary values: 1,200, 2,400, 4,800, 9,600, 14,400, 19,200, 28,800, 32,000, 38,400, 56,000, 57,600, 64,000, 72,000, 115,200, 125,000, 128,000, 148,000, 192,000, 250,000, 256,000, 384,000, 500,000, 512,000, 768,000, 800,000, 1,000,000, 1,300,000, 2,000,000, 4,000,000, and, on interfaces that support higher speeds, 8,000,000. Note, in particular, that there is no conventional T1 setting at 1,544 Kbps, the closest substitutes for a T1 being 1,300 Kbps or 2,000 Kbps. This is usually not an issue, however, because in real carrier-provided T1 circuits, the carrier's equipment generally supplies the clock.

But this clock rate command has another important effect. Because only Data Communication Equipment (DCE) interfaces can supply the clock signal on synchronous serial connections, configuring this command on an interface implies that this interface is the DCE device. If you want the router to be a Data Terminal Equipment (DTE) device, you must omit the clock rate command.

Note also that with serial cables, DTE has a male connector, while DCE is female on the equipment end. On the router end, all Cisco high density serial connectors look alike, regardless of whether the equipment end uses a V.35, RS 232, or any other standard serial connector. We should mention in passing that even though the router end of these cables uses a trapezoidal shaped connector to help ensure that the right pins go into the right holes, it is remarkably easy to inadvertently connect these cables to your router upside down. If you can't get the interface to come up, even though you're sure it is configured properly, try removing the cable and rotating the connector 180 degrees. You can also use the show controller command to see what kind of cable the router thinks you have connected:

Router3#show controller serial 0
HD unit 0, idb = 0x1BC830, driver structure at 0x1C1CC0
buffer size 1524 HD unit 0, V.35 DCE cable, clockrate 1300000
cpb = 0x2, eda = 0x40B4, cda = 0x40C8
RX ring with 16 entries at 0x4024000
00 bd_ptr=0x4000 pak=0x1C3D38 ds=0x402AEE8 status=80 pak_size=92
01 bd_ptr=0x4014 pak=0x1C4D58 ds=0x402E4C8 status=80 pak_size=14
02 bd_ptr=0x4028 pak=0x1C4344 ds=0x402C31C status=80 pak_size=80

Router3#

Unfortunately, the exact syntax and the output structure of this command varies somewhat from router to router, depending on the specific serial hardware. Note that you generally have to put a space between the interface type and the interface number, as we did. If the output says something like "No DCE cable," it is likely that you have not connected the cable correctly.

If you configure a serial interface with a clock rate command, and then connect a DTE cable, the router will ignore the clock rate command. And, if you already have a DTE cable connected to the interface, the router will reject this command. Furthermore, just using a null modem connector will not fool the router into thinking a DTE cable is DCE, you must use the right cable.

This particular feature confuses many people who are used to equipment that supports non-standard DTE clocking. Cisco routers strictly enforce the relationship between cable type and clocking.

There are a few other useful commands in the configuration example, as well:

Router3(config-if)#description WAN Connection to Chicago

The description command accepts an arbitrary text string that you can use for any purpose that will help you to manage your network. The comment in the example says where this particular circuit connects to, but you might also put other useful information, such as circuit numbers or emergency contact information.

Next is the IP address. This command takes as an argument the IP address of this particular interface, and the corresponding netmask:

Router3(config-if)#ip address 192.168.99.5 255.255.255.252

In this case, because we are dealing with a simple point-to-point link that can only have two devices on it, we have used a netmask of 255.255.255.252, or /30 in slash notation. There is nothing to prevent you from using a larger subnet on such a link, but we recommend using a more conservative approach to help ensure that you won't run out of addresses.

And, finally, we have included a no shutdown command:

Router3(config-if)#no shutdown 

This is necessary because, by default, the router will keep all of its interfaces in an administratively disabled state until you configure them.

You can see the current state of this interface with the show interfaces command:

Router3#show interfaces Serial1
Serial1 is down, line protocol is down
Hardware is HD64570
Description: WAN Connection to Chicago
Internet address is 192.168.99.5/30
MTU 1500 bytes, BW 1544 Kbit, DLY 20000 usec,
reliability 255/255, txload 1/255, rxload 1/255
Encapsulation HDLC, loopback not set
Keepalive set (10 sec)
Last input never, output never, 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: weighted fair
Output queue: 0/1000/64/0 (size/max total/threshold/drops)
Conversations 0/0/256 (active/max active/max total)
Reserved Conversations 0/0 (allocated/max allocated)
Available Bandwidth 1158 kilobits/sec
5 minute input rate 0 bits/sec, 0 packets/sec
5 minute output rate 0 bits/sec, 0 packets/sec
0 packets input, 0 bytes, 0 no buffer
Received 0 broadcasts, 0 runts, 0 giants, 0 throttles
0 input errors, 0 CRC, 0 frame, 0 overrun, 0 ignored, 0 abort
0 packets output, 0 bytes, 0 underruns
0 output errors, 0 collisions, 2 interface resets
0 output buffer failures, 0 output buffers swapped out
0 carrier transitions
DCD=down DSR=down DTR=down RTS=down CTS=down
Router3#

Note that this interface is configured, but it is not yet active because the circuit is not yet connected. It is also interesting to note that the router thinks that this interface has a bandwidth of 1,544 Kbps, which is indicated by the BW field above. This is in spite of the fact that we have explicitly configured this interface to be the DCE and to supply a much lower clock speed. This bandwidth number affects two things: routing protocol metrics and utilization statistics. If you want to configure a more realistic value here, you can do so with the bandwidth interface configuration command:

Router3(config)#interface Serial1
Router3(config-if)#bandwidth 56

Note that the argument of this command must be in Kilobits per second, rather than the bits per second format used for the clock rate command.

Change the MTU of an interface using the mtu interface configuration command:

Router3(config)#interface Serial1
Router3(config-if)#shutdown
Router3(config-if)#mtu 18000
Router3(config-if)#no shutdown

Changing the MTU will reset the interface. So it is usually a good idea to issue a shutdown command to disable the interface before making the change, as we have done here. Bear in mind that having a larger MTU on an interface does not necessarily mean that the router will be able to take advantage of this larger frame size. If this interface never originates packets, but just acts as a link to send IP packets between two routers, then the routers will not attempt to join smaller packets to accommodate the larger MTU. The only time this is really useful is when this interface connects directly to serial equipment that generates larger frames.

Note also that the serial interface mtu command is subtly different from the ip mtu command. The command we used here sets the Layer 2 MTU, which applies to all protocols, while the ip mtu command only affects IP packets.

See Also