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!

Wednesday, April 22, 2009

A Cisco CCNA-Voice Lab

Voip Configuration for a CCNA-Voice Lab

Prerequisite

You need to know how to work with dynamips/dynagen for general network emulation. If you are not that familiar or new to this, there are some excellent tutorials out there. Some basic voip concepts especially from CCNA-Voice would be very useful. That’s it!

Scenario

In this lab, I will show how to setup a voip connection using two laptops running Windows XP and dynamips/dynagen emulating offices connected over a WAN link. IP Blue softphones will be used here, so you need install them on both laptops if you have not done so. Physically the two laptops are connected with a crossover UTP cable. You can also use a layer-2 switch if you want. The topology of the overall network is shown in Figure 1. This setup does not require a high-end laptop. One of my laptops just has a single-core Intel Pentium M 1.5 GHz with 512 MB RAM!

Figure 1: Logical layout and

Laptop1 will emulate Office1 network with a Cisco 2691 router as the gateway and CME, an LAN Ethernet switch and an IP Blue softphone instance. You are free to use any other router with the CME feature, if you don’t have the 2691 IOS image. Laptop2 will emulate Office2 with a similar network layout. To emulate the WAN connection, the egress connection of both routers will connect to another Ethernet switch (wan1 and wan2), which are then bridged across each laptop’s physical RJ-45 port. I just used this simple WAN point-to-point connection to keep the focus on the subject matter.

Dynagen’s .net file

Here is the .net file setup for the laptop1’s setup (very similar to laptop’s 2):

autostart = false

ghostios = true

sparsesmem = true

mmap = true

[localhost:7200]


[[2691]]


image = \Program Files\Dynamips\images\C2691-AD.image

ram = 128

idlepc = 0x60a49150 # change accordingly


[[ROUTER C1]]


model = 2691

f0/0 = L1 1

f0/1 = W1 1


[[ETHSW L1]]


1 = access 1

# change the following line, according to your laptop’s loopback address (use dynagen’s “Network device list.cmd”)

2 = access 1 NIO_gen_eth:\Device\NPF_{924ADD11-A35B-420B-BC79-ED058973BB53}


[[ETHSW W1]]

1 = access 1

# change next line to your laptop’s Ethernet port

2 = dot1q 1 NIO_gen_eth:\Device\NPF_{A91A2A20-659A-4291-8C10-E727878AEFF7}


CME Configuration

In order to be sure that your understand each step of the router’s configuration, I have given the logic behind each step.

1. Start with the ip address configurations of the involved interfaces.
interface FastEthernet0/0
description ***LAN connection***
ip address 10.10.10.1 255.255.255.0
!
interface FastEthernet0/1
description ***WAN connection***
ip address 192.168.100.1 255.255.255.0

2. Setup the DHCP server on the CME.
ip dhcp excluded-address 10.10.10.1 10.10.10.10
!
ip dhcp pool voice
network 10.10.10.0 255.255.255.0
default-router 10.10.10.1
option 150 ip 172.16.1.1

3. Since the best practice is to use a loopback address for CME access, lets configure a loopback interface.
interface Loopback0
ip address 172.16.1.1 255.255.255.255

4. Now, comes the configurations related to the CME function itself. You need to specify the max number of directory numbers and ephones required. The source address to be used by cme1 (i.e. lo0) and a system message that appears cool on the phone display.. ;)
telephony-service
max-ephones 2
max-dn 4
ip source-address 172.16.1.1 port 2000
system message KSD Voip System

5. Now configure the specific directory numbers you need. These are the numbers to dialed to reach certain phones. In my case, I created two dns, one for its normal line and another for the emergency line (000). The longer number stated as secondary will be used by external caller for DID.
ephone-dn 1 dual-line
number 1000 secondary 11111000
!
ephone-dn 4
number 000

6. These directory numbers are now ready to be assigned to specific ephones. You can imagine an ephone like a phone descriptor.
ephone 1
mac-address 0200.4C4F.4F50
button 1:1 3:4

The above MAC address is a loopback interface address created in Windows XP, not the same as lo0 in the CME. If you don’t have one (can be checked on XP’s “Network Connections”), you can easily create it. This address will then be used by IP Blue phone for network access. The router is now ready to serve as call processing agent!

7. You can now start IP Blue phone on laptop1, and if you have not used it before, a setup wizard will start to walk you through its basic setup. Just make sure that you use the loopback address specified in step 6 for its interface. If all goes well, the phone will register with cme1, and the following message should appear:

*Mar 1 00:02:47.303: %IPPHONE-6-REGISTER: ephone-1:SEP02004C4F4F50 IP:10.10.10.11 Socket:3 DeviceType:Phone has registered.

Here is the screenshot of ip blue after it has successfully registered. See the cool text above Redial button… Also, note button 1 shows “1000” and the third button “000”.

Figure 2: IP Blue screenshot after successfully registering to CME.

8. Now, repeat steps 1-7 on laptop2. Just remember to change the IP addresses accordingly as well as the directory numbers. I used the following for the directory number.
ephone-dn 1 dual-line
number 2000 secondary 22222000

Verify that phone2’s registration succeeds as above in Office2. At this stage, all basic local configurations are complete. To enable voip calls across our WAN connection, we now face the most important concept in voip, i.e. the dial plan.

9. The dial plan is like a routing table for a router. When CME receives a call, it needs to know how to forward it correctly. For the real world use, we need SIP proxies from voice service providers to enable an end to end voip connection. However, in our example, we just need to indicate to the CME which numbers will invoke SIP messages to the other CME. For example, to enable phone1 to call phone2, we need the following dial plan in cme1.
dial-peer voice 2000 voip
destination-pattern 2222....
session protocol sipv2
session target ipv4:172.17.1.1
dtmf-relay sip-notify
no vad

Since cme1 does not know how to reach cme2’s lo0, instead of using a routing protocol, I just installed a static default route.
ip route 0.0.0.0 0.0.0.0 192.168.100.2

10. Repeat step 9 for cme2, and you are done! You are ready to call away… This is just the basic configuration to get you going. You can now try all the other cool features like intercom, paging and much much more. I did not have access to Cisco Unity Express, so I was not able to include voice mail configurations here, but it should be quite easy too.