Posts Tagged ‘loopback’
This weekend while working on content updates for CCIE R&S Version 5, I ran into an interesting problem. In order to test some nuances of routing protocol updates and packet fragmentation, I was trying to generate BGP UPDATE messages that would exceed the transit MTU. To do this I manually created a bunch of Loopback interfaces and did a redistribute connected into BGP. When I looked at the packet capture details, I started to realize how many routes I’d actually need in order to fill up the packet sizes. After wasting about 30 minutes copying and pasting new Loopbacks over and over, I decided to come up with a better automated solution instead. I thought, “why not just have the router generate its own random Loopback addresses and then advertise them into BGP?” Well surprisingly I actually got it to work, despite my amateur at best coding skills.
The following TCL script is used to generate a given number of Loopback interfaces with random IPv4 and IPv6 addresses. To use it simply start the tclsh from the IOS CLI, paste the procedure in, then invoke it with generate_loopbacks X, where “X” is the number of routes you want to generate.
Note that I didn’t add any error checking for overlapping addresses or invalid address and mask combinations. If someone wants to update the script to account for this, please feel free to do so and I’ll throw 100 rack rental tokens your way for the trouble. Edit: Special thanks to Jason Cook for adding the error checking for me.
A quick demo of the script in action can be found after the jump.
A voice lab rack usually utilizes dedicated piece of hardware to simulate PSTN switch. Commonly, you can find a Cisco router in this role, with a number of E1/T1 cards set to emulate ISDN network side. It perfectly suits the function, switching ISDN connections between the endpoints. Additionally, it is often required to have an “independent” PSTN phone connected to the PSTN switch, in order to represent “outside” dialing patterns – such as 911, 999, 411 1-800/900 numbers. The most obvious way to do this is to enable a CallManager Express on the PSTN router, and register either hardware IP Phone or any of IP Soft-phones (such as IP Blue or CIPC) with the CME system.
However, there is another way to accomplish the same goal using IOS functionality solely. It relies on the IP-to-IP gateway feature, called “RTP loopback” session target. It is intended to be used for VoIP call testing, but could be easily utilized to loopback incoming PSTN calls to themselves. Let’s say we want PSTN router to respond to incoming calls to an emergency number 911. Here is how a configuration would look like:
PSTN: voice service voip allow-connections h323 to h323 ! interface Loopback0 ip address 22.214.171.124 255.255.255.255 ! dial-peer voice 911 voip destination-pattern 911 session target ipv4:126.96.36.199 incoming called-number 999 tech-prefix 1# ! dial-peer voice 1911 voip destination-pattern 1#911 session target loopback:rtp incoming called-number 1#911
The trick is that only IP-to-IP calls could be looped back. Because of that, we need to redirect the incoming PSTN call to the router itself first, in order to establish an incoming VoIP call leg.
While this approach permits VoIP call testing, it lacks one important feature, available with the “real” PSTN phone: placing calls from the PSTN phone to the in-rack phones. However, you can always use “csim start” command on the PSTN router to overcome this obstacle. Have fun!
Let’s say you get a bunch of inexpensive (but a bit outdated) routers (36XX or 72Xx) and some really nice (maybe not so cheap) Cisco switches (e.g. 3550/3560) and you would like to provide a VPLS-like service to your customers. Since VPLS is a service available only on more powerful Cisco platforms, we have to figure a way to simulate Multipoint Ethernet L2 VPN over a packet switching network (PSN) using only “convenient” point-to-point L2 VPN services.
Let model a situation where we have a number of routers connected over (PSN), with an ethernet switch connected to router at every location:
What we can do, is connect ethernet ports using pseudowires to form a virtual ring topology over PSN. That is, refeferring to our picture, xconnect routers’ ethernet ports counter-clockwise, say xconnect E0/0 of R3 with E0/1 of R4, then E0/0 of R4 with E0/1 of R5 and finally E0/0 of R5 with E0/1 of R3. Effectively, we will form an ethernet ring, partially connected over convenient switches, and partially using L2VPN pseudowires. Router configurations look pretty much similar, for example at R3 we would have something like this
R3: pseudowire-class PW_CLASS encapsulation l2tpv3 ip local interface Loopback0 ! interface Loopback0 ip address 188.8.131.52 255.255.255.255 ! ! Xconnecting E0/0 of R3 with E0/1 of R4 ! interface Ethernet0/0 no ip address xconnect 184.108.40.206 34 encapsulation l2tpv3 pw-class PW_CLASS ! ! Xconnecting E0/1 of R3 with E0/0 of R5 ! interface Ethernet0/1 no ip address xconnect 220.127.116.11 35 pw-class PW_CLASS ! ! Frame-Relay is used to connect to other routers (PSN network) ! interface Serial1/0 no ip address encapsulation frame-relay ! interface Serial1/0.34 point-to-point ip address 18.104.22.168 255.255.255.0 frame-relay interface-dlci 304 ! interface Serial1/0.35 point-to-point ip address 22.214.171.124 255.255.255.0 frame-relay interface-dlci 305 ! ! OSPF is used as a sample IGP ! router ospf 1 router-id 126.96.36.199 log-adjacency-changes network 0.0.0.0 255.255.255.255 area 0
Speaking honestly, it’s not “classic” VPLS in true sense:
Firstly, STP should be running over ring topology, in order to block redundant ports. One can use star topology and disable STP, but this will introduce a single point of failure into the network. Classic VPLS does not run STP over packet core, only a full-mesh of pseudowires.
Secondly, there is no MAC-address learning for pseudowires, since they are point-to-point in essense. MAC addresses are learned by switches, and this impose a usual scalability restriction (though cisco switches may allow you to scale to a few thousands of MAC addresses in their tables).
However, this is funny and simple example of how you can use a simple concept to come up with a more complicated solution.