Skip to content
Oct 12 / Greg

Cisco – IPSec Tunnel Termination via HSRP

hsrpIpsec

James ran into this one the other day, and I found it interesting. If you have routers configured for high availability(HA) using hot stand-by routing protocol(HSRP) and you are doing straight IPSec tunnels, how would one go about terminating the tunnel on the virtual HSRP IP address? First, why would you want to do this?

You would most likely want to do this so that you can create a policy at remote sites that won’t break. With straight IPSec tunnels, you can’t specify multiple crypto maps that leverage identical address space in the match ACLs. An easy fix in the scenario is to peer your IPSec tunnel with the HSRP address of your hub site. This way when the routers fail over, your VPN tunnel will failover also.

How do we configure all of this goodness?

Remote Config:

  1. !apply the crypto map to the outside interface
  2. interface Fa0/0
  3. ip address 1.1.1.1 255.255.255.252
  4. crypto map to-hub
  5. desc outside
  6. interface Fa0/1
  7. ip address 192.168.1.1 255.255.255.0
  8. desc inside
  9. !route map to clear the do not fragment bit on tunnel traffic
  10. ip policy route-map clear-df
  11. !our policy
  12. crypto isakmp policy 1
  13. encr 3des
  14. authentication pre-share
  15. group 2
  16. lifetime 14400
  17. !key for hub
  18. crypto isakmp key test address 2.2.2.4
  19. !transform set
  20. crypto ipsec transform-set to-hub esp-3des esp-sha-hmac
  21. !the actual crypto map
  22. crypto map to-hub 10 ipsec-isakmp
  23. set peer 2.2.2.4
  24. set transform-set to-hub
  25. match address hub
  26. !interesting traffic ACL
  27. ip access-list extended hub
  28. remark Allow access though tunnel to hub
  29. permit ip 192.168.1.0 0.0.0.255 192.168.2.0 0.0.0.255
  30. !nat acl. We are denying access to tunnel traffic
  31. ip access-list extended NAT
  32. deny ip any 192.168.0.0 0.0.255.255
  33. permit ip any any
  34. !this is the ACL for the clear DF routemap
  35. ip access-list extended clear-df
  36. permit tcp any 192.168.0.0 0.0.255.255
  37. !nat statement
  38. ip nat inside source list NAT interface FastEthernet0/0 overload
  39. !clear DF route map
  40. route-map clear-df permit 10
  41. match ip address clear-df
  42. set ip df 0


The remote config is straight forward.

RTR-1 Config:

  1. !apply the crypto map to the outside interface
  2. interface Fa0/0
  3. ip address 2.2.2.2 255.255.255.248
  4. !notice that the crypto map is using the redundancy command
  5. ! we specify the name of the standby group
  6. ! this will source the tunnel from the standby address
  7. crypto map to-remote redundancy ha-out
  8. desc outside
  9. !here's the HSRP config info
  10. standby delay minimum 30 reload 60
  11. standby 1 ip 2.2.2.4
  12. standby 1 timers 1 10
  13. standby 1 preempt
  14. !name of the hsrp group reference by the crypto map
  15. standby 1 name ha-out
  16. standby 1 track fa0/1
  17. interface Fa0/1
  18. ip address 192.168.2.1 255.255.255.0
  19. desc inside
  20. !route map to clear the do not fragment bit on tunnel traffic
  21. ip policy route-map clear-df
  22. !our policy
  23. crypto isakmp policy 1
  24. encr 3des
  25. authentication pre-share
  26. group 2
  27. lifetime 14400
  28. !key for remote
  29. crypto isakmp key test address 1.1.1.1
  30. !transform set
  31. crypto ipsec transform-set to-remote esp-3des esp-sha-hmac
  32. !the actual crypto map
  33. crypto map to-remote 10 ipsec-isakmp
  34. set peer 1.1.1.1
  35. set transform-set to-remote
  36. match address remote
  37. !interesting traffic ACL
  38. ip access-list extended remote
  39. remark Allow access though tunnel to remote
  40. permit ip 192.168.2.0 0.0.0.255 192.168.1.0 0.0.0.255
  41. !nat acl. We are denying access to tunnel traffic
  42. ip access-list extended NAT
  43. deny ip any 192.168.0.0 0.0.255.255
  44. permit ip any any
  45. !this is the ACL for the clear DF routemap
  46. ip access-list extended clear-df
  47. permit tcp any 192.168.0.0 0.0.255.255
  48. !nat statement
  49. ip nat inside source list NAT interface FastEthernet0/0 overload
  50. !clear DF route map
  51. route-map clear-df permit 10
  52. match ip address clear-df
  53. set ip df 0

RTR-2 Config:

  1. !apply the crypto map to the outside interface
  2. interface Fa0/0
  3. ip address 2.2.2.3 255.255.255.248
  4. !notice that the crypto map is using the redundancy command
  5. ! we specify the name of the standby group
  6. ! this will source the tunnel from the standby address
  7. crypto map to-remote redundancy ha-out
  8. desc outside
  9. !here's the HSRP config info
  10. standby delay minimum 30 reload 60
  11. standby 1 ip 2.2.2.4
  12. standby 1 timers 1 10
  13. standby 1 preempt
  14. !name of the hsrp group reference by the crypto map
  15. standby 1 name ha-out
  16. standby 1 track fa0/1
  17. interface Fa0/1
  18. ip address 192.168.2.2 255.255.255.0
  19. desc inside
  20. !route map to clear the do not fragment bit on tunnel traffic
  21. ip policy route-map clear-df
  22. !our policy
  23. crypto isakmp policy 1
  24. encr 3des
  25. authentication pre-share
  26. group 2
  27. lifetime 14400
  28. !key for remote
  29. crypto isakmp key test address 1.1.1.1
  30. !transform set
  31. crypto ipsec transform-set to-remote esp-3des esp-sha-hmac
  32. !the actual crypto map
  33. crypto map to-remote 10 ipsec-isakmp
  34. set peer 1.1.1.1
  35. set transform-set to-remote
  36. match address remote
  37. !interesting traffic ACL
  38. ip access-list extended remote
  39. remark Allow access though tunnel to remote
  40. permit ip 192.168.2.0 0.0.0.255 192.168.1.0 0.0.0.255
  41. !nat acl. We are denying access to tunnel traffic
  42. ip access-list extended NAT
  43. deny ip any 192.168.0.0 0.0.255.255
  44. permit ip any any
  45. !this is the ACL for the clear DF routemap
  46. ip access-list extended clear-df
  47. permit tcp any 192.168.0.0 0.0.255.255
  48. !nat statement
  49. ip nat inside source list NAT interface FastEthernet0/0 overload
  50. !clear DF route map
  51. route-map clear-df permit 10
  52. match ip address clear-df
  53. set ip df 0


Here in the HSRP router configs you will notice that there are two new commands. The redundancy command was added to the cyrpto map interface command and the name command was used on the standby group. You name the standby group and then reference this in the crypto statement. What this does is source the IPSec tunnel from the HSRP virtual IP.

Oct 12 / Greg

Cisco ASA IP SLA – Failover Routing

It seems like everytime I want to do something funky with an ASA, Cisco says “ASAs are not routers, use them what they are designed for.” This really doesn’t help me…heh. ASAs can’t do PBR(Policy Based Routing – aka route maps)…which would have been useful more than a few times. Back on topic, failover routing.

Route redundancy can be achieved locally using metrics on your routes, as you can in routers. What if you have a point to point link that takes several hops through a provider network, though? If the link dies in the provider, the local link stays up and your bad route stays in the route table…what does one do?

In steps IP SLA. This provides many functions including the ability to ping a remote host. So, we have one ASA ping the other ASA across the point to point link and if the ping fails, we drop the route across the P2P.

Here is a logical diagram of how it all works.

asa-ipsla
Bryan ASA:

1
2
3
4
5
6
7
8
9
10
11
12
!ip sla monitor 
sla monitor 1 
type echo protocol ipIcmpEcho 192.168.1.1 interface P2P 
num-packets 3 
frequency 10 
!timer for monitor 
sla monitor schedule 1 life forever start-time now 
!attach tracker to monitor 11 track 1 rtr 1 reachability 
!route with ip sla tracker 
route P2P 10.10.10.0 255.255.255.0 192.168.1.1 track 1 
!backup route with a metric of 254 
route outside 10.10.10.0 255.255.255.0 1.1.1.1 254

Dallas ASA:

1
2
3
4
5
6
7
8
9
10
11
!ip sla monitor 
sla monitor 1 
type echo protocol ipIcmpEcho 192.168.1.3 interface P2P 
num-packets 3 05  frequency 10 
!timer for monitor 08 sla monitor schedule 1 life forever start-time now 
!attach tracker to monitor 
track 1 rtr 1 reachability 
!route with ip sla tracker 
route P2P 10.20.20.0 255.255.255.0 192.168.1.3 track 1 
!backup route with a metric of 254 
route outside 10.20.20.0 255.255.255.0  2.2.2.2 254

So in the sample code you can see that our point to point link has the tracker attached. As long as the ping completes, this route is used. If the ping fails, the route with a metric of 254 is used.

In the above example you would need to configure IP SLA in Bryan and in Dallas. This way they will both switch between the P2P and the Internet at the same time. Though, even if one lags behind in switch to the Internet connection, the tunnel will go ahead and establish since one side is attempting the connection.

Oct 12 / Greg

FTP Creating 0 Byte Files

So Jimmy over at cactiusers.org wrote me a plugin that generates some stuff and FTPs it to another server. My other server was generating some files, but no folders. The files it was generating were 0 byte files…I was scratching my head. I shot Jimmy an message describing the problem. His reponse was “Is your hard drive full?” To which I said…I dunno. I did a quick

1
df -h

and discovered that yes, my HD was full….hehehe.

Moral of the story is, if you are creating 0 byte files, check to make sure you have space. Thanks Jim-bo.

Oct 12 / Greg

Mikrotik Netwatch – Kick off a script or email when a host goes down

This post was born out of a question, so see, I do listen…sometimes. hehe
The question was, can I ping a host and then have the Mikrotik email me when it goes down/up. The answer is yes. If you use a little tool called netwatch.

Tools -> Netwatch

An example script you can run is one that will email you.

tool e-mail send [email protected] server=1.1.1.1 [email protected] subject=This guy just bit the dust

Here’s the code for an up/down email:

1
2
3
4
5
6
/tool netwatch
add comment="" disabled=no down-script="tool e-mail send [email protected]\
    m server=1.1.1.1 [email protected] subject=\"This guy just went down\"" \
    host=127.0.0.1 interval=1m timeout=1s up-script="tool e-mail send from=gre\
    [email protected] server=1.1.1.1 [email protected] subject=\"This guy just\
    \_came back up\""

And here’s the winbox version:

1


1

Oct 12 / Greg

Mikrotik RB750 Speed Test

I did some speed testing on my RB750 today. The proof is in the pudding…which is strange that Mikrotiks run on pudding.

speedtest

As you can see I averaged between 40-50% CPU on my 750 and I averaged better than 50Mb of throughput!

This test was done with an RB450 and an RB450G on either side of the 750. The 750 has connection tracking on and is routing. Doing a PPTP connection and an IPSec connection didn’t adversely effect my results, either. I’m sure if you loaded the 750 with more services, it is going to bog down, but it was running pretty clean.

You can also see that I still have around 20MB of RAM left, which means I have decent headroom for some BGP routes, a decent amount of connections, or a good chunk of DHCP clients.

I’m dieing to put one of these out at my apartment complexes…hehe…though I may have to switch it from vanilla to chocolate pudding. These guys also come with 3.29…which is interesting

Oct 12 / Greg

Video Tutorial Cisco ASA – Add L2TP over IPSec VPN to Your ASA and Configure Your Windows Clients to Connect

Alrighty! Now that 64 bit windows is getting more prevalent, it is getting harder to get the Cisco IPSec client installed. This is because the IPSec client is 32 bit and also needs to install a 32 bit driver, which won’t work on a 64 bit system. Windows 7 does have an XP compaitibility mode that works around this, but for you XP and Vista folks running 64 bit, this won’t do you any good. So a viable option is to use the anyconnect client with SSL VPN, though a 50 pack of VPN clients will cost you around $3K…no thanks! What you can do is use L2TP on your ASA.

L2TP is built off of PPP and by itself provides no encryption. What the ASA does is to encrypt the transit with IPSec, thus protecting the payload. Windows has conveniently included an L2TP client right in the OS, so there is nothing to install, just a few things to configure. The configuration of the ASA and the client is covered in the video. There are a couple of gotchas in the configuration, namely the group policy needing IPSec checked as well as dropping PFS in the crypto map. Be sure to look out for both.

Click the link below for the video!
read more…

Oct 12 / Greg

Why is Mikrotik Pushing MPLS?

Funny you should ask yourself that, because I’ve been asking myself the same thing ever since I saw that the feature was added. I personally administer a network that includes a chunk of MPLS, but before then, it was just another buzz word. When I say it contains MPLS I mean we actually do MPLS on our equipment, not that we are running on a providers MPLS network…we are the provider! This means that I have become pretty familiar with it…which makes me wonder why Mikrotik bothered with it…:)

So, after hearing me blab, why is Mikrotik pushing MPLS? Simple answer is performance. In a nutshell, what MPLS does is to take the routing table and compile it into a forwarding table. The MPLS packets then get tagged with an MPLS label. Now, your routing decisions more or less are a layer 2 forwarding decision. Now your backbone routes only need to keep track of the MPLS labels and L2 forward based on that. This gives you a performance boost. I saw them present some number that were showing increases of I believe around 25% throughput at the MUM.

This sounds like a great feature, which makes you wonder why say, Cisco, doesn’t push MPLS as an optimizer…that’s because it isn’t an optimizer for them. Sometime before I could drive a car, Cisco came out with fast switching. It was based off of the netflow concept. The idea is route once, switch many. It would take the first packet in a flow and run it across the interface ACLs and the route table. It would then give all the subsequent packets in the same flow the same forwarding procedure. This was more efficient, but was still processor based. They then came out with CEF, Cisco Express forwarding.

CEF takes the route table and compiles it into a binary table so that all routing decisions are handled in hardware! This way the processor doesn’t even get invoked in the normal forwarding process. In Cisco, if you want to run MPLS, you first enable CEF. Soooo, with Cisco, you are running MPLS on top of an already super efficient system! So Cisco’s implementation is in hardware, where as Mikrotik is still all software based.

To me the most interesting part of MPLS is running VRFs (Virtual Routing and Forwarding instances). This is often called MPLS VPNs. What it basically allows you to do is run overlapping addressing on the same routing infrastructure. I can have 100 companies running 10.X.X.X subnets over my routed infrastructre with no problems!

I plan to compare Mikrotik’s MPLS implementation to Cisco pretty soon. I want to see how the VRFs compare…do they support route leaking with filtering? If they do, how well does it interoperate with Cisco?