Cisco Router mit zwei Uplinks und NAT (Dual Uplink, NAT, IP SLA)

Cisco Router 1100 Serie mit 2 WAN Anbindungen sind relativ günstig und einfach zu konfigurieren. Sobald aber noch Network Address Translation (NAT) dazu kommt wird es mühsam. Standardmässig wird nur eine ANT Konfiguration pro Source Subnet unterstützt.

Gerne stell eich hier eine Anleitung zur Verfügung wie ich dieses Problem gelöst habe.

Szenario: Lokales LAN (privat adressiert) und zwei Uplinks (hier VDSL und LTE Fallback mit Swisscom SIM Karte)

Konfig für 3G/4G/LTE

controller Cellular 0/2/0
lte sim data-profile 1 attach-profile 2 slot 0
no lte firmware auto-sim
lte modem link-recovery rssi onset-threshold -110
lte modem link-recovery monitor-timer 20
lte modem link-recovery wait-timer 5
lte modem link-recovery debounce-count 6
profile id 1 apn gprs.swisscom.ch authentication none pdn-type ipv4

Ich habe ein Profil erstellt mit den APN Angaben von Swisscom und habe dies an das Cellular0/2/0 Interface angebunden.

LAN Interface Konfigs

Die internen Interfaces gelten als Switch Ports. Somit habe ich ein VLAN 10 Interface erstellt und die Switch Ports in dieses VLAN aufgenommen.

interface GigabitEthernet0/1/0
description *** Gi0/1/0 : to Customer ***
switchport access vlan 10
switchport mode access
spanning-tree portfast
!
interface GigabitEthernet0/1/1
description *** Gi0/1/0 : to Customer ***
switchport access vlan 10
switchport mode access
spanning-tree portfast
!
interface GigabitEthernet0/1/2
description *** Gi0/1/0 : to Customer ***
switchport access vlan 10
switchport mode access
spanning-tree portfast
!
interface GigabitEthernet0/1/3
description *** Gi0/1/0 : to Customer ***
switchport access vlan 10
switchport mode access
spanning-tree portfast
!
interface Vlan10
description *** VLAN10 : to Customer LAN ***
ip address 10.1.1.1 255.255.255.0
ip nat inside

WAN Interface Konfigs

interface Cellular0/2/0
ip address negotiated
no ip unreachables
no ip proxy-arp
ip nat outside
dialer in-band
dialer idle-timeout 0
dialer watch-group 2
dialer-group 2
ipv6 address dhcp
ipv6 enable
pulse-time 1
!
controller VDSL 0/3/0
!
interface Ethernet0/3/0
description *** Et0/3/0 : Ethernet BuiltIn for VDSL ***
no ip address
ip mtu 1500
load-interval 30
no negotiation auto
ipv6 address dhcp
pppoe enable group global
pppoe-client dial-pool-number 1
!
interface Dialer1
description *** DIALER1 : VDSL Dialer ***
ip address negotiated
ip nat outside
encapsulation ppp
ip tcp adjust-mss 1452
load-interval 30
dialer pool 1
ipv6 address dhcp
ppp chap hostname DSL-LOGIN-USERNAME
ppp chap password DSL-LOGIN-PASSWORD
!
dialer-list 2 protocol ip permit
!
access-list 2 permit any
!

Das DSL Login basiert auf PPPoE und beim Mobile Netzwerk von Swisscom erhalte ich direkt per DHCP eine IP Adresse.

IP SLA

Nun wird ein IP SLA benötigt um das VDSL Interface zu überwachen und anhand dieses Outputs die Routen und das NAT anzupassen.

ip sla 1
icmp-echo 100.100.100.100 source-interface Dialer1 (IP des Dialers)
threshold 2
timeout 800
frequency 3
ip sla schedule 1 life forever start-time now

Die Routen werden mittels TRACK angepasst:

ip route 0.0.0.0 0.0.0.0 Dialer1 10 track 1
ip route 0.0.0.0 0.0.0.0 Cellular0/2/0 20

Das IP NAT wird mittels einem EVENT geändert:

event manager applet ipsla1-down
event track 1 state down
action 1.0 syslog msg "ICMP SLA 1 FAILED - Update NAT"
action 2.0 cli command "enable"
action 3.0 cli command "clear ip nat transl *"
action 4.0 cli command "conf t"
action 4.1 cli command "no ip nat inside source list Internal_IP interface Dialer1 overload"
action 4.2 cli command "ip nat inside source list Internal_IP interface Cellular0/2/0 overload"
action 5.0 cli command "end"
action 5.5 cli command "wr"
event manager applet ipsla1-up
event track 1 state up
action 1.0 syslog msg "ICMP SLA 1 RECOVERED - Update NAT"
action 2.0 cli command "enable"
action 3.0 cli command "clear ip nat transl *"
action 4.0 cli command "conf t"
action 4.1 cli command "no ip nat inside source list Internal_IP interface Cellular0/2/0 overload"
action 4.2 cli command "ip nat inside source list Internal_IP interface Dialer1 overload"
action 5.0 cli command "end"
action 5.5 cli command "wr"
!
ip access-list standard Internal_IP
permit 10.1.1.0 0.0.0.255

Funktion überprüfen

Ich abe mal zum Testen das DSL Interface ausgezogen und danach wieder eingesteckt. Bei der Umschaltung werden alle Schritte im LOG aufgeführt. Wenn man das DSL Kabel auszieht gehen zwei PING verloren. Somit dauert die Entdeckung des Ausfalls und die Konfiguration ca. 2 bis 5 Sekunden.

von DSL nach LTE
von LTE zu DSL
Apr 29 13:31:37.248: %TRACK-6-STATE: 1 ip sla 1 reachability Up -> Down
Apr 29 13:31:37.252: %HA_EM-6-LOG: ipsla1-down: ICMP SLA FAILED - Update PBR/NAT
Apr 29 13:31:37.931: %SYS-5-CONFIG_I: Configured from console by  on vty2 (EEM:ipsla1-down)
Apr 29 13:31:40.870: %VDSL_DAEMON-3-VDSL_LINE_UPDOWN: Controller VDSL 0/3/0, line 0, changed state to down
Apr 29 13:31:40.871: %CONTROLLER-5-UPDOWN: Controller VDSL 0/3/0, changed state to down
Apr 29 13:31:42.872: %LINK-3-UPDOWN: Interface Ethernet0/3/0, changed state to down
Apr 29 13:31:43.873: %LINEPROTO-5-UPDOWN: Line protocol on Interface Ethernet0/3/0, changed state to down
Apr 29 13:31:44.446: %SYS-2-PRIVCFG_ENCRYPT: Successfully encrypted private config file
Apr 29 13:32:24.577: %VDSL_DAEMON-3-VDSL_LINE_UPDOWN: Controller VDSL 0/3/0, line 0, changed state to up
Apr 29 13:32:24.577: %CONTROLLER-5-UPDOWN: Controller VDSL 0/3/0, changed state to up
Apr 29 13:32:24.763: %LINEPROTO-5-UPDOWN: Line protocol on Interface Virtual-Access2, changed state to down
Apr 29 13:32:24.769: %DIALER-6-UNBIND: Interface Vi2 unbound from profile Di1
Apr 29 13:32:24.773: %LINK-3-UPDOWN: Interface Virtual-Access2, changed state to down
Apr 29 13:32:26.577: %LINK-3-UPDOWN: Interface Ethernet0/3/0, changed state to up
Apr 29 13:32:27.579: %LINEPROTO-5-UPDOWN: Line protocol on Interface Ethernet0/3/0, changed state to up
Apr 29 13:32:46.969: %DIALER-6-BIND: Interface Vi2 bound to profile Di1
Apr 29 13:32:46.971: %LINK-3-UPDOWN: Interface Virtual-Access2, changed state to up
Apr 29 13:32:47.256: %LINEPROTO-5-UPDOWN: Line protocol on Interface Virtual-Access2, changed state to up
Apr 29 13:32:52.257: %TRACK-6-STATE: 1 ip sla 1 reachability Down -> Up
Apr 29 13:32:52.261: %HA_EM-6-LOG: ipsla1-up: ICMP SLA RECOVERED - Update PBR/NAT
Apr 29 13:32:53.042: %SYS-5-CONFIG_I: Configured from console by  on vty2 (EEM:ipsla1-up)
Apr 29 13:32:59.564: %SYS-2-PRIVCFG_ENCRYPT: Successfully encrypted private config file
Print Friendly, PDF & Email
Dieser Beitrag wurde unter TechBlog abgelegt und mit , , , , , , , , , , verschlagwortet. Setze ein Lesezeichen auf den Permalink.