Thursday, May 28, 2009

Lab Setup for MPLS and BGP on Dynamips

Introduction

In this lab setup, I will enable a complete virtual lab for CCIP study on a single laptop running Windows XP, dual-core 1.8 GHz CPU with 1.5 GB RAM. Thanks to the Dynamips/Dynagen creators, this is now possible.


Scenario


I have adopted the simple design given in Sybex’s CCIP MPLS Study Guide, by James Reagan. It is rather dated but his approach and clarity of presentation makes it still relevant to the design of MPLS core networks today. In this setup, a customer wants to connect his two remote sides through a service provider’s core network. I will use Cisco 3640 router for both the customer and SP use. At each site, the customer’s network is connected to a provider edge router (PE1 and PE2, respectively). The SP’s core has a single router linked PE1 and PE2, named P1.



Dynagen .net file

To map the above design for emulation, you need to understand how the syntax of dynagen’s .net. I have realized the setup using the following:

autostart = false
model = 3640
ghostios = true
sparsesmem = true
mmap = true

[localhost:7200]
[[3640]]
image = \Program Files\Dynamips\images\C3640-JK.image
ram = 96
idlepc = 0x603bc51c # change this accordingly
[[ROUTER C1]]
s1/0 = PE1 s1/0
f0/0 = S1 1
[[ROUTER PE1]]
s1/1 = P1 s1/0
[[ROUTER P1]]
s1/1 = PE2 s1/0
[[ROUTER PE2]]
s1/1 = C2 s1/0
[[ROUTER C2]]
f0/0 = S2 1

[[ETHSW S1]]
1 = access 1
2 = dot1q 1 NIO_gen_eth:\Device\NPF_{192F6952-5AEA-4B4A-8AC0-B07086BA6FAC} #loopback0
[[ETHSW S2]]
1 = access 1

This should be rather straight-forward to understand. I just want to note about the link to NIO_gen_eth… device. This device represents a Microsoft Loopback Adapter (loopback0) on my machine. I linked it to the virtual network to allow testing from the command prompt, and to use the TFTP client on XP to download the configs from the virtual lab routers, which then allows me to display them here. ;)


Overview of Overall Configurations

You need to devise a plan to structure your configuration efforts. This is very important to deal with any reasonable sized networks. At every significant stage, you need to test to ensure that what you have configured so far works. If you do not follow a particular strategy and waited for all configurations to be done first before testing, it will take too much time to troubleshoot if something goes wrong. Using a structured way, you can resolve issues as they arise and discount their effect in subsequent settings. This is how I did it:

1. Start with IP addressing and enabling interfaces from left to right. I have indicated the network address for each segment on the diagram. I always started the numbering from left, and from the first valid number. Use the above diagram as your guide. Once done, check with “show ip interface brief” command.
2. Complete the configuration at C1 and C2. Since there is only a single link to the SP’s network, install a static default route to the outside networks. Once done, C1 and C2 configurations are over.
3. It is good practice to use loopback interfaces for routing for better reliability whenever there are multiple paths to others. So, configure a loopback interface for each SP router.
4. Enable RIP 2 routing protocol on all SP routers to work on the 172.22.1.0 network. Check expected routes are populated. Do some pings tests.
5. Enable MPLS switching in the core and use LDP as the label distribution protocol. Check for MPLS peering and LFIB is corrected populated.
6. Install a static route to the client network at PE1 and PE2. Test.
7. Finally, configure BGP on PE1 and PE2. BGP will carry customer routes across the core. Since PE routers are not exchanging routes with customer routers, use static and connected redistribution.

Detail Configuration

Configure IP addresses and static routes at C1 and C2. The static route for C1 is shown below:

ip route 0.0.0.0 0.0.0.0 192.168.1.2

Verify this configuration:
C1#sh ip rou
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
text snipped...
Gateway of last resort is 192.168.1.2 to network 0.0.0.0

10.0.0.0/24 is subnetted, 1 subnets
C 10.1.1.0 is directly connected, FastEthernet0/0
192.168.1.0/30 is subnetted, 1 subnets
C 192.168.1.0 is directly connected, Serial1/0
S* 0.0.0.0/0 [1/0] via 192.168.1.2

Configure the loopback interfaces for SP routers. To configure lo0 for PE1:
interface Loopback0
ip address 172.22.1.1 255.255.255.255

Enable RIP 2 on the SP routers:
router rip
version 2
network 172.22.0.0
no auto-summary

Check the routes are correctly populated. Here is the routing table of P1:
P1#sh ip rou
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
text snipped...

Gateway of last resort is not set

172.22.0.0/16 is variably subnetted, 5 subnets, 2 masks
C 172.22.1.8/30 is directly connected, Serial1/1
R 172.22.1.3/32 [120/1] via 172.22.1.10, 00:00:05, Serial1/1
C 172.22.1.2/32 is directly connected, Loopback0
R 172.22.1.1/32 [120/1] via 172.22.1.5, 00:00:18, Serial1/0
C 172.22.1.4/30 is directly connected, Serial1/0

Enable MPLS switching and select LDP globally. Then, enable MPLS on the relevant serial interfaces. Below is the configuration for PE1:
ip cef
mpls label protocol ldp
interface Serial1/1
mpls ip

When MPLS peering is enabled, IOS displays a debug statement. The following is shown on P1:
P1(config)#
*Mar 1 00:11:56.547: %LDP-5-NBRCHG: LDP Neighbor 172.22.1.1:0 is UP
*Mar 1 00:12:16.451: %LDP-5-NBRCHG: LDP Neighbor 172.22.1.3:0 is UP

You can also check the MPLS forwarding table:
PE2#sh mpls f
Local Outgoing Prefix Bytes tag Outgoing Next Hop
tag tag or VC or Tunnel Id switched interface
16 Pop tag 172.22.1.2/32 0 Se1/0 point2point
17 Pop tag 172.22.1.4/30 0 Se1/0 point2point
18 Untagged 10.2.2.0/24 0 Se1/1 point2point
19 17 172.22.1.1/32 0 Se1/0 point2point

Install a static route for the client network at PEs (PE1 to C1 and PE2 to C2). At PE1:
ip route 10.1.1.0 255.255.255.0 192.168.1.1

At PE2:
ip route 10.2.2.0 255.255.255.0 192.168.2.2

You are now ready to configure BGP at PEs. Since this is a single SP’s network, it is iBGP and all routes will be advertised with their configured loopback address. Thus, at PE1, you need to configure this:
router bgp 65000
no synchronization
bgp log-neighbor-changes
network 172.22.1.1 mask 255.255.255.255
redistribute connected
redistribute static
neighbor 172.22.1.3 remote-as 65000
neighbor 172.22.1.3 update-source Loopback0
no auto-summary

When iBGP peering succeeds, IOS displays a debug message. You can also check your BGP peer using:
PE2#sh ip bgp neighbor
BGP neighbor is 172.22.1.1, remote AS 65000, internal link
BGP version 4, remote router ID 172.22.1.1
BGP state = Established, up for 00:26:49
Last read 00:00:49, hold time is 180, keepalive interval is 60 seconds
Neighbor capabilities:
Route refresh: advertised and received(old & new)
Address family IPv4 Unicast: advertised and received
Address family VPNv4 Unicast: advertised and received
text snipped...

That’s it! If all configured correctly, you will see BGP routes on the routing table:
PE1#sh ip rou
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
text snipped...

Gateway of last resort is not set

172.22.0.0/16 is variably subnetted, 5 subnets, 2 masks
R 172.22.1.8/30 [120/1] via 172.22.1.6, 00:00:24, Serial1/1
R 172.22.1.3/32 [120/2] via 172.22.1.6, 00:00:24, Serial1/1
R 172.22.1.2/32 [120/1] via 172.22.1.6, 00:00:24, Serial1/1
C 172.22.1.1/32 is directly connected, Loopback0
C 172.22.1.4/30 is directly connected, Serial1/1
10.0.0.0/24 is subnetted, 2 subnets
B 10.2.2.0 [200/0] via 192.168.2.2, 00:04:47
S 10.1.1.0 [1/0] via 192.168.1.1
192.168.1.0/30 is subnetted, 1 subnets
C 192.168.1.0 is directly connected, Serial1/0
192.168.2.0/30 is subnetted, 1 subnets
B 192.168.2.0 [200/0] via 172.22.1.3, 00:05:47

Ping from clients connected to C1 to C2 for final comfirmation.

Good luck with your setup!