Previous section   Next section

Recipe 16.2 Configuring Serial Interfaces

16.2.1 Problem

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

16.2.2 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)#exit

16.2.3 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:

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 discussion of it 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 56Kbps. Most Cisco synchronous serial interfaces can support line speeds between 1.2Kbps and 4Mbps, although they generally only accept specific round number values rather than arbitrary values: 1200, 2400, 4800, 9600, 14400, 19200, 28000, 32000, 38400, 56000, 57600, 64000, 72000, 115200, 125000, 128000, 148000, 192000, 250000, 256000, 384000, 500000, 512000, 768000, 800000, 1000000, 1300000, 2000000, 4000000 and, on interfaces that support higher speeds, 8000000. Note that there is no conventional T1 setting at 1544Kbps; the closest substitutes for a T1 are 1300 or 2000Kbps. 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 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 DTE device, you must omit the clock rate command.

When using serial cables, remember that 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. 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 1
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
<lines deleted for brevity>
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, 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 nonstandard DTE clocking. Cisco routers strictly enforce the relationship between cable type and clocking.

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

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

The description command accepts an arbitrary text string that you can use for any purpose to help you 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.

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 1544Kbps, which is indicated by the BW field. This is in spite of the fact that though 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, 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.

You can 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

Because changing the MTU will reset the interface, 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 together to accommodate the larger MTU. The only time this is really useful is when the interface connects directly to serial equipment that generates larger frames.

Also note 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. The ip mtu command only affects IP packets.

16.2.4 See Also

Chapter 10; Chapter 15


  Previous section   Next section
Top