Wednesday, 26 August 2009

L2TPv3 over IPSec with VLANS

Here is the Lab:
From GNS:


Then from Opendraw:


Not sure which I prefer yet, the Cisco-ish one is pretty but GNS is functional..hmm

DMVPN - How to

After seeing a few requests for this, I thought it would be good to do a "Dynamic Multipoint Virtual Private Network".

Which is a nice TLA for Multipoint GRE(Tunnel), NHRP(Next Hop Routing Protocol) and IPSEC.

So here is the lab:


Very boring compared to the MPLS L2 lab however there are some important techs to get used to.

For the purposes of the lab, R1 is not under our control.

Therefore all the spoke routers have a default route to the R1 and that is it.
It is up to the DMVPN to fill in the gaps.

Here is R10 which is the HQ or "Hub" router.

interface Tunnel0
!All the tunnels have to be in the same subnet
ip address 10.0.234.10 255.255.255.0
no ip redirects
ip mtu 1400
!Dynamically map to the spokes
ip nhrp map multicast dynamic
!Network-id has to be the same on all routers
ip nhrp network-id 1
ip nhrp holdtime 450
ip tcp adjust-mss 1360
!This is needed as OSPF auto-configs a "tunnel int" as point-to-point which is wrong !here
ip ospf network point-to-multipoint
!Exit interface
tunnel source FastEthernet1/0
!Tunnel mode
tunnel mode gre multipoint


R2

interface Tunnel0
ip address 10.0.234.2 255.255.255.0
no ip redirects
ip mtu 1400
ip nhrp map multicast 10.0.110.10
ip nhrp map 10.0.234.10 10.0.110.10
ip nhrp network-id 1
ip nhrp holdtime 450
ip nhrp nhs 10.0.234.10
ip tcp adjust-mss 1360
ip ospf network point-to-multipoint
tunnel source FastEthernet1/0
tunnel mode gre multipoint


R3

!
interface Tunnel0
ip address 10.0.234.3 255.255.255.0
no ip redirects
ip mtu 1400
ip nhrp map multicast 10.0.110.10
ip nhrp map 10.0.234.10 10.0.110.10
ip nhrp network-id 1
ip nhrp holdtime 450
ip nhrp nhs 10.0.234.10
ip tcp adjust-mss 1360
ip ospf network point-to-multipoint
tunnel source FastEthernet1/0
tunnel mode gre multipoint


R4

interface Tunnel0
ip address 10.0.234.4 255.255.255.0
no ip redirects
ip mtu 1400
ip nhrp map multicast 10.0.234.10
ip nhrp map 10.0.234.10 10.0.110.10
ip nhrp network-id 1
ip nhrp holdtime 450
ip nhrp nhs 10.0.234.10
ip tcp adjust-mss 1360
ip ospf network point-to-multipoint
tunnel source FastEthernet1/0
tunnel mode gre multipoint


That should be the tunnel up. At this point you can test the tunnel by ping the Hub tunnel address 10.0.234.10 from each of the spokes.

Now encryption:
R10

crypto isakmp policy 100
encr aes
authentication pre-share
group 2
crypto isakmp key letmein address 0.0.0.0 0.0.0.0
!
!
crypto ipsec transform-set TUN-TRANSFORM esp-aes esp-sha-hmac
!
crypto ipsec profile TUN-PROFILE
set transform-set TUN-TRANSFORM



Then applied to the Tunnel inteface:

interface Tunnel0
ip address 10.0.234.10 255.255.255.0
no ip redirects
ip mtu 1400
ip nhrp map multicast dynamic
ip nhrp network-id 1
ip nhrp holdtime 450
ip tcp adjust-mss 1360
ip ospf network point-to-multipoint
tunnel source FastEthernet1/0
tunnel mode gre multipoint
tunnel protection ipsec profile TUN-PROFILE
!



then the same for R2,R3,R4:

crypto isakmp policy 100
encr aes
authentication pre-share
group 2
crypto isakmp key letmein address 0.0.0.0 0.0.0.0
!
!
crypto ipsec transform-set TUN-TRANSFORM esp-aes esp-sha-hmac
!
crypto ipsec profile TUN-PROFILE
set transform-set TUN-TRANSFORM
!


~Under the Tunnel0 interface:

!
tunnel protection ipsec profile TUN-PROFILE
!


This is identicial for each spoke.

Then an example OSPF config on R2:

!
router ospf 1
router-id 2.2.2.2
log-adjacency-changes
network 2.2.2.2 0.0.0.0 area 0
network 10.0.234.0 0.0.0.255 area 0
network 192.168.2.0 0.0.0.255 area 2
!


Done!

MPLS L2VPN with 2 Customers-How to

Well its been a couple of weeks since my last post, partly due to a weeks holiday in Wales:


And although I didnt live under a bridge for a week like some sort of troll, I did go walking my dog near where this picture was taken, and this church:




Anyway..enough about my holiday and on to MPLS L2VPNs.

Diagram here


First thing to say about L2VPNs is that they are sometimes called "pseudowire". This bascially means that the idea of the L2VPN be it over MPLS (or L2TPv3) is to bridge the ethernet frame arriving on the PE interface over the MPLS network to the exiting
PE router.

So from the diagram the ethernet packet arrives at R1 int f2/1 and leaves R7 int f2/0.

Once you have set up the Provider IGP which in this case is OSPF, make sure that each router has a loopback with a 32bit mask and that loopback is brought into OSPF area 0
like this for R6:

!
interface Loopback0
ip address 6.6.6.6 255.255.255.255

!

!
router ospf 1
router-id 6.6.6.6
log-adjacency-changes
network 6.6.6.6 0.0.0.0 area 0
network 10.0.36.0 0.0.0.255 area 0
network 10.0.46.0 0.0.0.255 area 0
network 10.0.56.0 0.0.0.255 area 0
network 10.0.67.0 0.0.0.255 area 0
network 10.0.68.0 0.0.0.255 area 0
!


Then each interface which you want to run MPLS on has it enabled:
(again from R6)
(obviously this will need to be done on each provider router (interface) in the MPLS network)


!
interface FastEthernet1/0
ip address 10.0.46.6 255.255.255.0
duplex auto
speed auto
mpls ip
!
interface FastEthernet1/1
ip address 10.0.36.6 255.255.255.0
duplex auto
speed auto
mpls ip
!
interface FastEthernet2/0
ip address 10.0.56.6 255.255.255.0
duplex auto
speed auto
mpls ip
!
interface FastEthernet2/1
ip address 10.0.67.6 255.255.255.0
duplex auto
speed auto
mpls ip
!
interface FastEthernet3/0
ip address 10.0.68.6 255.255.255.0
duplex auto
speed auto
mpls ip
!
interface FastEthernet3/1
no ip address
shutdown
duplex auto
speed auto
!



Once the IGP is fully functional and you can for example ping from 1.1.1.1 to 7.7.7.7
you have a LSP (Label Switched Path) you can confirm its using MPLS (LFIB) by doing a
trace 7.7.7.7 and you will see it taking the LSP.


So how do I do this L2VPN then...well its so simply once you have the provider network up:
R1

interface FastEthernet2/0
description Customer1-R11
no ip address
duplex auto
speed auto
xconnect 8.8.8.8 101 encapsulation mpls
!



8.8.8.8 is the exit router

then on 8.8.8.8 (R8)

interface FastEthernet2/0
no ip address
duplex auto
speed auto
xconnect 1.1.1.1 101 encapsulation mpls
!


1.1.1.1 being the router on the other end.
Notice that the VC "101" is identicial as this is label within a label that follows the packet within the MPLS network.



...now for the fun bit!

High Avaliablity with Psuedowire is done via the "backup" command when in the "xconnect" context.

Here is how:
(This is for the Customer 2 (R21-R22)

R2

interface FastEthernet2/0
no ip address
duplex auto
speed auto
xconnect 7.7.7.7 301 encapsulation mpls
backup peer 8.8.8.8 302
!


R1

interface FastEthernet2/1
no ip address
duplex auto
speed auto
xconnect 8.8.8.8 201 encapsulation mpls
backup peer 7.7.7.7 202
!

R7

interface FastEthernet2/0
no ip address
duplex auto
speed auto
xconnect 2.2.2.2 301 encapsulation mpls
backup peer 1.1.1.1 202
!


R8

interface FastEthernet1/1
no ip address
duplex auto
speed auto
xconnect 1.1.1.1 201 encapsulation mpls
backup peer 2.2.2.2 302
!




One thing is that interesting is that without extra configuration the PE router will not switch to the backup peer unless the LSP is detected as being dead.

As so with this amount of redundency you maybe left with the situation where
the 10.0.12.0 network is plugged into the 10.0.21.0 network which would require the customer to make a config change before service would return.

Friday, 14 August 2009

MPLS L2VPN with 2 Customers

Here is a cool lab that I will be explaining:

Bit of humour

Genius:

Unequal Traffic Sharing with OSPF

Another day another lab :)

Now typically when you say to someone "hi i'm doing unequal traffic sharing with OSPF"
they will often say "no no you fool, thats not possible EIGRP is the only one to do unequal traffic"....but they would be wrong.

Using MPLS OSPF-Traffic Engineering you can indeed do Unequal Traffic Sharing.

And here is how:




As you can see this follows on directly from here


The only changes are to R2 and R5.


So R2:

!
interface Tunnel2
ip unnumbered Loopback1
mpls traffic-eng tunnels
tunnel destination 50.50.50.50
tunnel mode mpls traffic-eng
tunnel mpls traffic-eng autoroute announce
tunnel mpls traffic-eng priority 2 2
tunnel mpls traffic-eng bandwidth 512
tunnel mpls traffic-eng path-option 1 explicit name R2-R4-R5
no routing dynamic
!


and R5


interface Tunnel2
ip unnumbered Loopback1
mpls traffic-eng tunnels
tunnel destination 20.20.20.20
tunnel mode mpls traffic-eng
tunnel mpls traffic-eng autoroute announce
tunnel mpls traffic-eng priority 2 2
tunnel mpls traffic-eng bandwidth 512
tunnel mpls traffic-eng path-option 1 explicit name R5-R4-R2
no routing dynamic
!


Notice the command:
tunnel mpls traffic-eng bandwidth 512

The ensures that packets are sent in the ratio 2:1 down the two tunnels (Tunnel 1 and Tunnel 2)

Now to prove it:

R2#sh ip route 50.50.50.50
Routing entry for 50.50.50.50/32
Known via "ospf 1", distance 110, metric 3, type intra area
Last update from 50.50.50.50 on Tunnel2, 00:20:05 ago
Routing Descriptor Blocks:
* 50.50.50.50, from 5.5.5.5, 00:20:05 ago, via Tunnel2
Route metric is 3, traffic share count is 2
50.50.50.50, from 5.5.5.5, 00:20:05 ago, via Tunnel1
Route metric is 3, traffic share count is 1


and from R5

R5#sh ip route 20.20.20.20
Routing entry for 20.20.20.20/32
Known via "ospf 1", distance 110, metric 3, type intra area
Last update from 20.20.20.20 on Tunnel2, 00:20:57 ago
Routing Descriptor Blocks:
* 20.20.20.20, from 2.2.2.2, 00:20:57 ago, via Tunnel1
Route metric is 3, traffic share count is 1
20.20.20.20, from 2.2.2.2, 00:20:57 ago, via Tunnel2
Route metric is 3, traffic share count is 2


Looks good but what about debugs?
From R5 to R2:

R5#trace 20.20.20.20

Type escape sequence to abort.
Tracing the route to 20.20.20.20

1 10.0.35.3 [MPLS: Label 25 Exp 0] 48 msec
10.0.45.4 [MPLS: Label 25 Exp 0] 44 msec 8 msec
2 10.0.23.2 32 msec
10.0.24.2 36 msec *


and debugs from R4 and R3:
R4

R4#
*Aug 14 13:50:04.199: MPLS turbo: Fa1/1: rx: Len 60 Stack {25 0 1} - ipv4 data
*Aug 14 13:50:04.219: MPLS turbo: Fa1/0: rx: Len 186 Stack {17 6 253} - ipv4 data
*Aug 14 13:50:04.227: MPLS turbo: Fa1/1: rx: Len 60 Stack {25 0 1} - ipv4 data
*Aug 14 13:50:04.231: MPLS turbo: Fa1/0: rx: Len 186 Stack {17 6 253} - ipv4 data
*Aug 14 13:50:04.271: MPLS turbo: Fa1/1: rx: Len 60 Stack {25 0 2} - ipv4 data
*Aug 14 13:50:04.295: MPLS turbo: Fa1/0: rx: Len 74 Stack {17 6 255} - ipv4 data
*Aug 14 13:50:04.311: MPLS turbo: Fa1/1: rx: Len 60 Stack {25 0 2} - ipv4 data



and R3:

R3#
*Aug 14 13:50:04.035: MPLS turbo: Fa1/1: rx: Len 60 Stack {25 0 1} - ipv4 data
*Aug 14 13:50:04.051: MPLS turbo: Fa1/0: rx: Len 186 Stack {17 6 253} - ipv4 data
*Aug 14 13:50:04.127: MPLS turbo: Fa1/1: rx: Len 60 Stack {25 0 2} - ipv4 data
*Aug 14 13:50:04.159: MPLS turbo: Fa1/0: rx: Len 74 Stack {17 6 255} - ipv4 data




A ratio of 7:4..pretty good! :)

Wednesday, 12 August 2009

My First MPLS blog

I have a feeling ill be doing a few of these, MPLS is such a huge topic that simply doing a few labs does not seem to do it justice, however its better than doing none at all!

After playing around with my real lab a little I decided to virtualise this one, not to be confused with a router simulator, GNS is a great tool for knocking up a lab and playing around with ideas.

In light of that this is my latest idea:



One of the fun this that this lab was able to do was to separate the OSPF router ID from the MPLS traffic engineering router ID, this was done to hopefully better show which error/events were MPLS related those that were OSPF related and those that were a result of OSPF-TE.


I would kinda of expect you to be able to setup ip connectivity between the routers by now, after all this is basically CCIE stuff :)

Most of the below is fairly standard OSPF, however it is important to note the areas that I place the OSPF-TE router-ID and the OSPF router ID.

Setting up OSPF:
R2:

router ospf 1
router-id 2.2.2.2
log-adjacency-changes
network 2.2.2.2 0.0.0.0 area 2
network 10.0.23.0 0.0.0.255 area 0
network 10.0.24.0 0.0.0.255 area 0
network 192.168.12.0 0.0.0.255 area 12


R3

router ospf 1
router-id 3.3.3.3
log-adjacency-changes
network 3.3.3.3 0.0.0.0 area 3
network 10.0.23.0 0.0.0.255 area 0
network 10.0.35.0 0.0.0.255 area 0
!



R4

router ospf 1
router-id 4.4.4.4
log-adjacency-changes
network 4.4.4.4 0.0.0.0 area 4
network 10.0.24.0 0.0.0.255 area 0
network 10.0.45.0 0.0.0.255 area 0
!



R5

router ospf 1
router-id 5.5.5.5
log-adjacency-changes
passive-interface FastEthernet2/0
network 5.5.5.5 0.0.0.0 area 5
network 10.0.35.0 0.0.0.255 area 0
network 10.0.45.0 0.0.0.255 area 0
network 192.168.56.0 0.0.0.255 area 56
!


Ok thats ospf done.

Now MPLS, first step is to setup another loopback for MPLS and bring it into MPLS.

R2

! global
mpls traffic-eng tunnels
!
interface Loopback1
ip address 20.20.20.20 255.255.255.255
!
router ospf 1
mpls traffic-eng router-id Loopback1
mpls traffic-eng area 0

router-id 2.2.2.2
log-adjacency-changes
network 2.2.2.2 0.0.0.0 area 2
network 10.0.23.0 0.0.0.255 area 0
network 10.0.24.0 0.0.0.255 area 0
network 20.20.20.20 0.0.0.0 area 0
network 192.168.12.0 0.0.0.255 area 12
!


Now we could cheat and use "mpls ldp autoconfig area 0" here to enable LDP on all the area 0 interfaces however I like to do it manually.
While we're in the interface mode we might as well configure RSVP too :)


interface FastEthernet1/1
ip address 10.0.23.2 255.255.255.0
duplex auto
speed auto
mpls traffic-eng tunnels
mpls ip

ip rsvp bandwidth 75000 75000
!
interface FastEthernet2/0
ip address 10.0.24.2 255.255.255.0
duplex auto
speed auto
mpls traffic-eng tunnels
mpls ip

ip rsvp bandwidth 75000 75000
!




R3

mpls traffic-eng tunnels
interface Loopback1
ip address 30.30.30.30 255.255.255.255
!
interface FastEthernet1/0
ip address 10.0.23.3 255.255.255.0
duplex auto
speed auto
mpls traffic-eng tunnels
mpls ip
ip rsvp bandwidth 75000 75000
!
interface FastEthernet1/1
ip address 10.0.35.3 255.255.255.0
duplex auto
speed auto
mpls traffic-eng tunnels
mpls ip
ip rsvp bandwidth 75000 75000
!
router ospf 1
mpls traffic-eng router-id Loopback1
mpls traffic-eng area 0
router-id 3.3.3.3
log-adjacency-changes
network 3.3.3.3 0.0.0.0 area 3
network 10.0.23.0 0.0.0.255 area 0
network 10.0.35.0 0.0.0.255 area 0
network 30.30.30.30 0.0.0.0 area 0
!


R4
!
mpls traffic-eng tunnels
!
!
interface Loopback1
ip address 40.40.40.40 255.255.255.255
!
interface FastEthernet1/0
ip address 10.0.24.4 255.255.255.0
duplex auto
speed auto
mpls traffic-eng tunnels
mpls ip
ip rsvp bandwidth 75000 75000
!
interface FastEthernet1/1
ip address 10.0.45.4 255.255.255.0
duplex auto
speed auto
mpls traffic-eng tunnels
mpls ip
ip rsvp bandwidth 75000 75000
!
router ospf 1
mpls traffic-eng router-id Loopback1
mpls traffic-eng area 0
router-id 4.4.4.4
log-adjacency-changes
network 4.4.4.4 0.0.0.0 area 4
network 10.0.24.0 0.0.0.255 area 0
network 10.0.45.0 0.0.0.255 area 0
network 40.40.40.40 0.0.0.0 area 0
!



R5
mpls traffic-eng tunnels
!
interface Loopback1
ip address 50.50.50.50 255.255.255.255
!
!
interface FastEthernet1/0
ip address 10.0.35.5 255.255.255.0
duplex auto
speed auto
mpls traffic-eng tunnels
mpls ip
ip rsvp bandwidth 75000 75000
!
interface FastEthernet1/1
ip address 10.0.45.5 255.255.255.0
duplex auto
speed auto
mpls traffic-eng tunnels
mpls ip
ip rsvp bandwidth 75000 75000
!
!
router ospf 1
mpls traffic-eng router-id Loopback1
mpls traffic-eng area 0
router-id 5.5.5.5
log-adjacency-changes
passive-interface FastEthernet2/0
network 5.5.5.5 0.0.0.0 area 5
network 10.0.35.0 0.0.0.255 area 0
network 10.0.45.0 0.0.0.255 area 0
network 50.50.50.50 0.0.0.0 area 0
network 192.168.56.0 0.0.0.255 area 56
!


Now the actual Tunnels!
As they are uni-directional we need one from R2-R5 and another from R5-R2

R2-R5
interface Tunnel1
ip unnumbered Loopback1
mpls traffic-eng tunnels
tunnel destination 50.50.50.50
tunnel mode mpls traffic-eng
tunnel mpls traffic-eng autoroute announce
tunnel mpls traffic-eng priority 1 1
tunnel mpls traffic-eng bandwidth 256
tunnel mpls traffic-eng path-option 1 explicit name R2-R3-R5
!
ip explicit-path name R2-R3-R5 enable
next-address 10.0.23.3
next-address 10.0.35.5
!

and R5-R2:
!
ip explicit-path name R5-R3-R2 enable
next-address 10.0.35.3
next-address 10.0.23.2
!

Proving it works!......


R6#ping 192.168.12.1 repeat 2

Type escape sequence to abort.
Sending 2, 100-byte ICMP Echos to 192.168.12.1, timeout is 2 seconds:
!!
Success rate is 100 percent (2/2), round-trip min/avg/max = 44/48/52 ms


Results of an "debug mpls packet" from R3:

R3#
*Aug 12 20:23:59.407: MPLS turbo: Fa1/1: rx: Len 118 Stack {23 0 254} - ipv4 data
*Aug 12 20:23:59.427: MPLS turbo: Fa1/0: rx: Len 118 Stack {22 0 254} - ipv4 data
*Aug 12 20:23:59.459: MPLS turbo: Fa1/1: rx: Len 118 Stack {23 0 254} - ipv4 data
*Aug 12 20:23:59.491: MPLS turbo: Fa1/0: rx: Len 118 Stack {22 0 254} - ipv4 data


Note all 4 packets using the same route and all MPLS switched.
..and one final test:


R6#trace 192.168.12.1

Type escape sequence to abort.
Tracing the route to 192.168.12.1

1 192.168.56.5 28 msec 16 msec 4 msec
2 10.0.35.3 [MPLS: Label 23 Exp 0] 28 msec 12 msec 12 msec
3 10.0.23.2 28 msec 32 msec 12 msec
4 192.168.12.1 32 msec



Done!