hostname Router
!
ip cef
!####Establish sla monitors for use in tracking objects####!
ip sla monitor 1
type echo protocol ipIcmpEcho 12.34.45.1
threshold 3
frequency 5
ip sla monitor schedule 1 life forever start-time now
ip sla monitor 2
type echo protocol ipIcmpEcho 23.34.56.1
threshold 3
frequency 5
ip sla monitor schedule 2 life forever start-time now
!
!####Configure Tracking objects (referencing IP SLA monitor’s above)####!
track 101 rtr 1 reachability
!
track 102 rtr 2 reachability
!
!
!
!
!####Configure Interfaces with NAT####!
interface FastEthernet0
ip address 192.168.1.254 255.255.255.0
ip nat inside
!
interface s0/0
ip address 12.34.45.2 255.255.255.0
ip nat outside
!
interface s0/1
ip address 23.45.67.2 255.255.255.0
ip nat outside
!
ip classless
!####Configure gateway of last resort with tracking objects####!
ip route 0.0.0.0 0.0.0.0 12.34.45.1 track 101
ip route 0.0.0.0 0.0.0.0 23.45.67.1 track 102
!####Configure NAT statements for most outbound traffic####!
ip nat inside source route-map ISP1 interface s0/0 overload
ip nat inside source route-map ISP2 interface s0/1 overload
!####Configure NAT statements for your mail server####!
!(remember to setup dns for mail on both public IP addresses)!
ip nat inside source static tcp 192.168.1.10 25 12.34.45.2 25 route-map ISP1 extendable
ip nat inside source static tcp 192.168.1.10 25 23.45.67.2 25 route-map ISP2 extendable
!
!
access-list 10 permit 192.168.1.0 0.0.0.255
!
!####Configure route maps for reference in NAT statements####!
route-map ISP2 permit 10
match ip address 10
match interface s0/1
!
route-map ISP1 permit 10
match ip address 10
match interface s0/0
----------------------------------------------------------------------
icmp-echo 4.2.2.2 < 4.2.2.2 is a DNS server that responds to pings out on the internet>
timeout 500 < This is how long to wait for a response from the ping>
frequency 3 < This is the repeat rate for the SLA>
ip sla schedule 1 start-time now life forever < This command says "start SLA 1 now and keep it running forever>
track 1 rtr 1 reachability < This comand creates the track object "1" and monitors the SLA 1>
now for the routing, we need to change the default route and associate it with the tracker
no ip route 0.0.0.0 0.0.0.0 1.1.1.1
and then put it back with the tracking
ip route 0.0.0.0 0.0.0.0 1.1.1.1 track 1
Then we need to add our secondary route
ip route 0.0.0.0 0.0.0.0 1.1.1.2 10
ip route 4.2.2.2 255.255.255.255 1.1.1.1 ==> 1.1.1.1 being your primary next hop ip address
Now when the ping to 4.2.2.2 fails the primary route is removed and the secondary route with the higher metric becomes the default.
The route will be reinstated when the connectivity is restored.
>
Tidak ada komentar:
Posting Komentar