Problem
You want to connect two serial devices through an IP network.
Solution
STUN provides the ability to emulate an SDLC circuit through an IP network. To simply connect two SDLC or two HDLC ports on different routers, you can use the following:
Stun-A#configure terminal Enter configuration commands, one per line. End with CNTL/Z. Stun-A(config)#interface Loopback0 Stun-A(config-if)#ip address 10.1.15.5 255.255.255.252 Stun-A(config-if)#exit Stun-A(config)#stun peer-name 10.1.15.5 Stun-A(config)#stun protocol-group 1 basic Stun-A(config)#interface Serial1 Stun-A(config-if)#encapsulation stun Stun-A(config-if)#nrzi-encoding Stun-A(config-if)#clock rate 19200 Stun-A(config-if)#stun group 1 Stun-A(config-if)#stun route all tcp 10.1.15.9 Stun-A(config-if)#exit Stun-A(config)#end Stun-A#
And this router would connect this serial port to a port on a second router that is configured as follows:
Stun-B#configure terminal Enter configuration commands, one per line. End with CNTL/Z. Stun-B(config)#interface Loopback0 Stun-B(config-if)#ip address 10.1.15.9 255.255.255.252 Stun-B(config-if)#exit Stun-B(config)#stun peer-name 10.1.15.9 Stun-B(config)#stun protocol-group 1 basic Stun-B(config)#interface Serial1 Stun-B(config-if)#encapsulation stun Stun-B(config-if)#nrzi-encoding Stun-B(config-if)#clock rate 19200 Stun-B(config-if)#stun group 1 Stun-B(config-if)#stun route all tcp 10.1.15.5 Stun-B(config-if)#exit Stun-B(config)#end Stun-B#
You can also do more interesting things with STUN. For example, if you wanted to create a virtual multidrop SDLC circuit, you could do something like this. The first router would connect to the controller, and the other two would hold the SDLC devices:
Stun-A#configure terminal Enter configuration commands, one per line. End with CNTL/Z. Stun-A(config)#interface Loopback0 Stun-A(config-if)#ip address 10.1.15.5 255.255.255.252 Stun-A(config-if)#exit Stun-A(config)#stun peer-name 10.1.15.5 Stun-A(config)#stun protocol-group 1 sdlc Stun-A(config)#interface Serial1 Stun-A(config-if)#encapsulation stun Stun-A(config-if)#nrzi-encoding Stun-A(config-if)#clock rate 19200 Stun-A(config-if)#stun group 1 Stun-A(config-if)#stun sdlc role secondary Stun-A(config-if)#sdlc address 20 Stun-A(config-if)#sdlc address 21 Stun-A(config-if)#stun route address 20 tcp 10.1.15.9 local-ack Stun-A(config-if)#stun route address 21 tcp 10.1.15.13 local-ack Stun-A(config-if)#exit Stun-A(config)#end Stun-A#
And you would configure the second router like this:
Stun-B#configure terminal Enter configuration commands, one per line. End with CNTL/Z. Stun-B(config)#interface Loopback0 Stun-B(config-if)#ip address 10.1.15.9 255.255.255.252 Stun-B(config-if)#exit Stun-B(config)#stun peer-name 10.1.15.9 Stun-B(config)#stun protocol-group 1 sdlc Stun-B(config)#interface Serial1 Stun-B(config-if)#encapsulation stun Stun-B(config-if)#nrzi-encoding Stun-B(config-if)#clock rate 19200 Stun-B(config-if)#stun group 1 Stun-B(config-if)#stun sdlc role primary Stun-B(config-if)#sdlc address 20 Stun-B(config-if)#stun route address 20 tcp 10.1.15.5 local-ack Stun-B(config-if)#exit Stun-B(config)#end Stun-B#
And you would set up the third peer as follows:
Stun-C#configure terminal Enter configuration commands, one per line. End with CNTL/Z. Stun-C(config)#interface Loopback0 Stun-C(config-if)#ip address 10.1.15.13 255.255.255.252 Stun-C(config-if)#exit Stun-C(config)#stun peer-name 10.1.15.13 Stun-C(config)#stun protocol-group 1 sdlc Stun-C(config)#interface Serial1 Stun-C(config-if)#encapsulation stun Stun-C(config-if)#nrzi-encoding Stun-C(config-if)#clock rate 19200 Stun-C(config-if)#stun group 1 Stun-C(config-if)#stun sdlc role primary Stun-C(config-if)#sdlc address 21 Stun-C(config-if)#stun route address 21 tcp 10.1.15.5 local-ack Stun-C(config-if)#exit Stun-C(config)#end Stun-C#
Discussion
In principle, you could configure DLSw to connect two SDLC ports across an IP network by using a slight variation of Recipe 15.6. But there is a simpler way to accomplish this. Cisco IOS includes two features called Serial Tunnel (STUN) and Block Serial Tunnel (BSTUN). STUN is useful for connecting things like SDLC ports, even to the extent of building virtual SDLC multidrop links. BSTUN, on the other hand, is most useful when connecting ports running the IBM Bisync protocol. BSTUN is discussed in Recipe 15.8.
The first example in this recipe shows how to simply connect two serial ports through an IP network by using an emulated serial line. This type of configuration can be useful when dealing with applications that use the serial data link protocols in a nonstandard way. It can also sometimes be useful if you have to provide a serial connection between two locations that are already in your IP network.
This example first defines a single STUN protocol group, as number 1 on each router. Then, in the interface configuration blocks, you reference this number to tell STUN how to interpret the data it receives on this interface. You could define several different protocol groups supporting different protocols if required. Note that the protocol group number is purely local to the router. So what appears as protocol group number 1 on the first router could be group number 5 on the second router.
The second example shows a somewhat more complicated configuration. In this case, STUN is used to emulate not a single circuit through an IP cloud, but rather a multidrop circuit for use with SDLC devices. In more complex situations like this, it is often better to use DLSw, but sometimes the SDLC devices need to see one another directly for one reason or another.
The only tricky part to this type of configuration is to understand which routers are primary and which are secondary for SDLC. It's a little bit easier to understand if you envision the primary as the top of the network. Everything feeds into the primary. So if a router interface connects to downstream SDLC devices, as in routers Stun-B and Stun-C, the serial port is configured as primary because it is controlling everything downstream. On Stun-A, however, the router is acting as the network for the real controller device, so this router's serial interface is configured as secondary.
This example also includes local acknowledgement to prevent SDLC polling from crossing the IP network:
Stun-C(config-if)#stun route address 21 tcp 10.1.15.5 local-ack
This means simply that the router will respond to polls on behalf of devices that are on the other end of the tunnel to save bandwidth and improve performance. Allowing acknowledgement frames to cross the IP network sometimes introduces large latencies to the SDLC network because the devices must wait longer before sending the next data frame.
See Also
Recipe 15.8
Router Configuration and File Management
Router Management
User Access and Privilege Levels
TACACS+
IP Routing
RIP
EIGRP
OSPF
BGP
Frame Relay
Handling Queuing and Congestion
Tunnels and VPNs
Dial Backup
NTP and Time
DLSw
Router Interfaces and Media
Simple Network Management Protocol
Logging
Access-Lists
DHCP
NAT
First Hop Redundancy Protocols
IP Multicast
IP Mobility
IPv6
MPLS
Security
Appendix 1. External Software Packages
Appendix 2. IP Precedence, TOS, and DSCP Classifications
Index