service timestamps debug datetime msec service timestamps log datetime msec no service password-encryption ! hostname R3 ! boot-start-marker boot-end-marker ! ! no aaa new-model memory-size iomem 5 ip cef ! no ip domain lookup ip auth-proxy max-nodata-conns 3 ip admission max-nodata-conns 3 ip sla monitor 1 type echo protocol ipIcmpEcho 216.140.140.1 source-ipaddr 216.140.140.2 timeout 1000 threshold 2 frequency 3 ip sla monitor schedule 1 life forever start-time now ip sla monitor 2 type echo protocol ipIcmpEcho 216.150.150.254 source-ipaddr 216.150.150.4 timeout 1000 threshold 2 frequency 3 ip sla monitor schedule 2 life forever start-time now ! ! track 1 rtr 1 reachability ! track 2 rtr 2 reachability ! ! interface FastEthernet0/0 ip address 10.0.0.254 255.255.255.0 ip nat inside ip virtual-reassembly ip policy route-map PRIVATE-INGRESS duplex auto speed auto no keepalive ! interface FastEthernet0/1 ip address 216.150.150.4 255.255.255.0 secondary ip address 216.140.140.2 255.255.255.224 ip nat outside ip virtual-reassembly duplex auto speed auto ! ip forward-protocol nd ip route 0.0.0.0 0.0.0.0 216.140.140.1 track 1 ip route 0.0.0.0 0.0.0.0 216.150.150.254 10 ! ! no ip http server no ip http secure-server ip nat pool PRIMARY-POOL 216.140.140.2 216.140.140.2 prefix-length 27 ip nat pool SECONDARY-POOL 216.150.150.4 216.150.150.4 prefix-length 24 ip nat inside source route-map PRIMARY-NAT pool PRIMARY-POOL overload ip nat inside source route-map SECONDARY-NAT pool SECONDARY-POOL overload ! ip access-list standard PRIMARY-NEXT-HOP permit 216.140.140.1 ip access-list standard SECONDARY-NEXT-HOP permit 216.150.150.254 ip access-list standard TO-BE-NATTED deny 10.0.0.24 deny 10.0.0.25 deny 10.0.0.30 deny 10.0.0.16 deny 10.0.0.22 deny 10.0.0.23 deny 10.0.0.21 deny 10.0.0.44 deny 10.0.0.58 deny 10.0.0.59 deny 10.0.0.61 deny 10.0.0.54 deny 10.0.0.52 deny 10.0.0.53 deny 10.0.0.216 deny 10.0.0.220 deny 10.0.0.230 deny 10.0.0.228 deny 10.0.0.251 permit 10.0.0.0 0.255.255.255 ! ! route-map SECONDARY-NAT permit 10 match ip address TO-BE-NATTED match ip next-hop SECONDARY-NEXT-HOP ! route-map SECONDARY-NAT deny 20 ! route-map PRIVATE-INGRESS permit 10 match ip address TO-BE-NATTED set ip next-hop verify-availability 216.140.140.1 10 track 1 set ip next-hop verify-availability 216.150.150.254 20 track 2 ! route-map PRIVATE-INGRESS permit 11 ! route-map PRIMARY-NAT permit 10 match ip address TO-BE-NATTED match ip next-hop PRIMARY-NEXT-HOP ! route-map PRIMARY-NAT deny 20 ! ! control-plane ! ! line con 0 exec-timeout 0 0 logging synchronous line aux 0 line vty 0 4 login ! ! end
Monkerz wrote: » I just labbed this up on my gear. The below config, though from an older version of IOS than you are running, will work for your dynamic NATing issue. My fiancee just called me for dinner, but I will look into the static NATing issue when I get back (might be in the morning). I apologize for the complexity, you will need to change my SLA and TRACK commands to your syntax:service timestamps debug datetime msec service timestamps log datetime msec no service password-encryption ! hostname R3 ! boot-start-marker boot-end-marker ! ! no aaa new-model memory-size iomem 5 ip cef ! no ip domain lookup ip auth-proxy max-nodata-conns 3 ip admission max-nodata-conns 3 ip sla monitor 1 type echo protocol ipIcmpEcho 216.140.140.1 source-ipaddr 216.140.140.2 timeout 1000 threshold 2 frequency 3 ip sla monitor schedule 1 life forever start-time now ip sla monitor 2 type echo protocol ipIcmpEcho 216.150.150.254 source-ipaddr 216.150.150.4 timeout 1000 threshold 2 frequency 3 ip sla monitor schedule 2 life forever start-time now ! ! track 1 rtr 1 reachability ! track 2 rtr 2 reachability ! ! interface FastEthernet0/0 ip address 10.0.0.254 255.255.255.0 ip nat inside ip virtual-reassembly ip policy route-map PRIVATE-INGRESS duplex auto speed auto no keepalive ! interface FastEthernet0/1 ip address 216.150.150.4 255.255.255.0 secondary ip address 216.140.140.2 255.255.255.224 ip nat outside ip virtual-reassembly duplex auto speed auto ! ip forward-protocol nd ip route 0.0.0.0 0.0.0.0 216.140.140.1 track 1 ip route 0.0.0.0 0.0.0.0 216.150.150.254 10 ! ! no ip http server no ip http secure-server ip nat pool PRIMARY-POOL 216.140.140.2 216.140.140.2 prefix-length 27 ip nat pool SECONDARY-POOL 216.150.150.4 216.150.150.4 prefix-length 24 ip nat inside source route-map PRIMARY-NAT pool PRIMARY-POOL overload ip nat inside source route-map SECONDARY-NAT pool SECONDARY-POOL overload ! ip access-list standard PRIMARY-NEXT-HOP permit 216.140.140.1 ip access-list standard SECONDARY-NEXT-HOP permit 216.150.150.254 ip access-list standard TO-BE-NATTED deny 10.0.0.24 deny 10.0.0.25 deny 10.0.0.30 deny 10.0.0.16 deny 10.0.0.22 deny 10.0.0.23 deny 10.0.0.21 deny 10.0.0.44 deny 10.0.0.58 deny 10.0.0.59 deny 10.0.0.61 deny 10.0.0.54 deny 10.0.0.52 deny 10.0.0.53 deny 10.0.0.216 deny 10.0.0.220 deny 10.0.0.230 deny 10.0.0.228 deny 10.0.0.251 permit 10.0.0.0 0.255.255.255 ! ! route-map SECONDARY-NAT permit 10 match ip address TO-BE-NATTED match ip next-hop SECONDARY-NEXT-HOP ! route-map SECONDARY-NAT deny 20 ! route-map PRIVATE-INGRESS permit 10 match ip address TO-BE-NATTED set ip next-hop verify-availability 216.140.140.1 10 track 1 set ip next-hop verify-availability 216.150.150.254 20 track 2 ! route-map PRIVATE-INGRESS permit 11 ! route-map PRIMARY-NAT permit 10 match ip address TO-BE-NATTED match ip next-hop PRIMARY-NEXT-HOP ! route-map PRIMARY-NAT deny 20 ! ! control-plane ! ! line con 0 exec-timeout 0 0 logging synchronous line aux 0 line vty 0 4 login ! ! end
service timestamps debug datetime msec service timestamps log datetime msec no service password-encryption ! hostname R3 ! boot-start-marker boot-end-marker ! ! no aaa new-model memory-size iomem 5 ip cef ! ! no ip domain lookup ip auth-proxy max-nodata-conns 3 ip admission max-nodata-conns 3 ip sla monitor 1 type echo protocol ipIcmpEcho 216.140.140.1 source-ipaddr 216.140.140.2 timeout 1000 threshold 2 frequency 3 ip sla monitor schedule 1 life forever start-time now ip sla monitor 2 type echo protocol ipIcmpEcho 216.150.150.254 source-ipaddr 216.150.150.4 timeout 1000 threshold 2 frequency 3 ip sla monitor schedule 2 life forever start-time now ! ! track 1 rtr 1 reachability ! track 2 rtr 2 reachability ! ! interface FastEthernet0/0 ip address 10.0.0.53 255.255.255.0 ip nat inside ip virtual-reassembly ip policy route-map PRIVATE-INGRESS duplex auto speed auto no keepalive ! interface FastEthernet0/1 ip address 216.150.150.4 255.255.255.0 secondary ip address 216.140.140.2 255.255.255.224 ip nat outside ip virtual-reassembly duplex auto speed auto ! ip forward-protocol nd ip route 0.0.0.0 0.0.0.0 216.140.140.1 track 1 ip route 0.0.0.0 0.0.0.0 216.150.150.254 10 ! ! no ip http server no ip http secure-server ip nat pool PRIMARY-POOL 216.140.140.2 216.140.140.2 prefix-length 27 ip nat pool SECONDARY-POOL 216.150.150.4 216.150.150.4 prefix-length 24 ip nat inside source route-map PRIMARY-NAT pool PRIMARY-POOL overload ip nat inside source route-map SECONDARY-NAT pool SECONDARY-POOL overload ip nat inside source static 10.0.0.52 216.140.140.4 route-map STATIC-NAT-PRIMARY ip nat inside source static 10.0.0.53 216.140.140.5 route-map STATIC-NAT-PRIMARY ip nat inside source static 10.0.0.59 216.140.140.6 route-map STATIC-NAT-PRIMARY ip nat inside source static 10.0.0.61 216.140.140.7 route-map STATIC-NAT-PRIMARY ip nat inside source static 10.0.0.228 216.140.140.8 route-map STATIC-NAT-PRIMARY ip nat inside source static 10.0.0.16 216.140.140.11 route-map STATIC-NAT-PRIMARY ip nat inside source static 10.0.0.30 216.140.140.12 route-map STATIC-NAT-PRIMARY ip nat inside source static 10.0.0.251 216.140.140.13 route-map STATIC-NAT-PRIMARY ip nat inside source static 10.0.0.44 216.140.140.15 route-map STATIC-NAT-PRIMARY ip nat inside source static 10.0.0.54 216.140.140.16 route-map STATIC-NAT-PRIMARY ip nat inside source static 10.0.0.23 216.140.140.17 route-map STATIC-NAT-PRIMARY ip nat inside source static 10.0.0.58 216.140.140.18 route-map STATIC-NAT-PRIMARY ip nat inside source static 10.0.0.230 216.140.140.19 route-map STATIC-NAT-PRIMARY ip nat inside source static 10.0.0.216 216.140.140.21 route-map STATIC-NAT-PRIMARY ip nat inside source static 10.0.0.220 216.140.140.22 route-map STATIC-NAT-PRIMARY ip nat inside source static 10.0.0.33 216.140.140.25 route-map STATIC-NAT-PRIMARY ip nat inside source static 10.0.0.21 216.140.140.26 route-map STATIC-NAT-PRIMARY ip nat inside source static 10.0.0.22 216.140.140.27 route-map STATIC-NAT-PRIMARY ip nat inside source static 10.0.0.24 216.140.140.28 route-map STATIC-NAT-PRIMARY ip nat inside source static 10.0.0.25 216.140.140.29 route-map STATIC-NAT-PRIMARY ip nat inside source static 10.0.0.59 216.150.150.5 route-map STATIC-NAT-SECONDARY ip nat inside source static 10.0.0.52 216.150.150.6 route-map STATIC-NAT-SECONDARY ip nat inside source static 10.0.0.53 216.150.150.7 route-map STATIC-NAT-SECONDARY ip nat inside source static 10.0.0.16 216.150.150.8 route-map STATIC-NAT-SECONDARY ip nat inside source static 10.0.0.58 216.150.150.9 route-map STATIC-NAT-SECONDARY ip nat inside source static 10.0.0.61 216.150.150.11 route-map STATIC-NAT-SECONDARY ! ip access-list standard PRIMARY-NEXT-HOP permit 216.140.140.1 ip access-list standard SECONDARY-NEXT-HOP permit 216.150.150.254 ip access-list standard TO-BE-NATTED deny 10.0.0.24 deny 10.0.0.25 deny 10.0.0.30 deny 10.0.0.16 deny 10.0.0.22 deny 10.0.0.23 deny 10.0.0.21 deny 10.0.0.44 deny 10.0.0.58 deny 10.0.0.59 deny 10.0.0.61 deny 10.0.0.54 deny 10.0.0.52 deny 10.0.0.53 deny 10.0.0.216 deny 10.0.0.220 deny 10.0.0.230 deny 10.0.0.228 deny 10.0.0.251 permit 10.0.0.0 0.255.255.255 ! ! route-map STATIC-NAT-PRIMARY permit 10 match ip next-hop PRIMARY-NEXT-HOP ! route-map STATIC-NAT-PRIMARY deny 20 ! route-map STATIC-NAT-SECONDARY permit 10 match ip next-hop SECONDARY-NEXT-HOP ! route-map STATIC-NAT-SECONDARY deny 20 ! route-map SECONDARY-NAT permit 10 match ip address TO-BE-NATTED match ip next-hop SECONDARY-NEXT-HOP ! route-map SECONDARY-NAT deny 20 ! route-map PRIVATE-INGRESS permit 10 match ip address TO-BE-NATTED set ip next-hop verify-availability 216.140.140.1 10 track 1 set ip next-hop verify-availability 216.150.150.254 20 track 2 ! route-map PRIVATE-INGRESS permit 11 ! route-map PRIMARY-NAT permit 10 match ip address TO-BE-NATTED match ip next-hop PRIMARY-NEXT-HOP ! route-map PRIMARY-NAT deny 20 ! ! control-plane ! ! line con 0 exec-timeout 0 0 logging synchronous line aux 0 line vty 0 4 login ! ! end
Monkerz wrote: » This config should work for both your dynamic and static NATing needs. I have tested it in my lab with success is all aspects I could think to test. Make sure you change the TRACK, SLA and INTERFACE syntax to work for your needs. p.s. Wave, are you speaking from experience?
ahmedahmed wrote: » Since we have servers that have to have specific IP both when accessed and when accessing the internet
ahmedahmed wrote: » Thanks Monkerz and Wave for your much needed help. on top of this I would want to open only ports 20,21,25,53,80,110,143,443, 3389 on most of my servers from outside ,could you guys give me some idea on how i would have to set up the ACL for that
wave wrote: » Monkerz, I like your solution. But, I thought the OP was trying to use the same public IPs on both internet connections (which would require BGP).
ip sla 1 Icmp-Echo 216.140.140.1 source-ip 216.140.140.2 timeout 1000 threshold 2 frequency 3 ip sla schedule 1 life forever start-time now ip sla monitor 2 Icmp-Echo 216.150.150.254 source-ip 216.150.150.4 timeout 1000 threshold 2 frequency 3 ip sla schedule 2 life forever start-time now ! ! track 1 sla 1 reachability ! track 2 sla 2 reachability ! ! interface gi0/0 ip address 10.0.0.254 255.255.255.0 ip nat inside ip virtual-reassembly ip policy route-map PRIVATE-INGRESS duplex auto speed auto no keepalive ! interface gi0/1 ip address 216.150.150.4 255.255.255.0 secondary ip address 216.140.140.2 255.255.255.224 ip nat outside ip virtual-reassembly duplex auto speed auto ip route 0.0.0.0 0.0.0.0 216.140.140.1 track 1 ip route 0.0.0.0 0.0.0.0 216.150.150.254 10 ! ! ip nat pool PRIMARY-POOL 216.140.140.2 216.140.140.2 prefix-length 27 ip nat pool SECONDARY-POOL 216.150.150.4 216.150.150.4 prefix-length 24 ip nat inside source route-map PRIMARY-NAT pool PRIMARY-POOL overload ip nat inside source route-map SECONDARY-NAT pool SECONDARY-POOL overload ip nat inside source static 10.0.0.52 216.140.140.4 route-map STATIC-NAT-PRIMARY ip nat inside source static 10.0.0.53 216.140.140.5 route-map STATIC-NAT-PRIMARY ip nat inside source static 10.0.0.59 216.140.140.6 route-map STATIC-NAT-PRIMARY ip nat inside source static 10.0.0.61 216.140.140.7 route-map STATIC-NAT-PRIMARY ip nat inside source static 10.0.0.228 216.140.140.8 route-map STATIC-NAT-PRIMARY ip nat inside source static 10.0.0.16 216.140.140.11 route-map STATIC-NAT-PRIMARY ip nat inside source static 10.0.0.30 216.140.140.12 route-map STATIC-NAT-PRIMARY ip nat inside source static 10.0.0.251 216.140.140.13 route-map STATIC-NAT-PRIMARY ip nat inside source static 10.0.0.44 216.140.140.15 route-map STATIC-NAT-PRIMARY ip nat inside source static 10.0.0.54 216.140.140.16 route-map STATIC-NAT-PRIMARY ip nat inside source static 10.0.0.23 216.140.140.17 route-map STATIC-NAT-PRIMARY ip nat inside source static 10.0.0.58 216.140.140.18 route-map STATIC-NAT-PRIMARY ip nat inside source static 10.0.0.230 216.140.140.19 route-map STATIC-NAT-PRIMARY ip nat inside source static 10.0.0.216 216.140.140.21 route-map STATIC-NAT-PRIMARY ip nat inside source static 10.0.0.220 216.140.140.22 route-map STATIC-NAT-PRIMARY ip nat inside source static 10.0.0.33 216.140.140.25 route-map STATIC-NAT-PRIMARY ip nat inside source static 10.0.0.21 216.140.140.26 route-map STATIC-NAT-PRIMARY ip nat inside source static 10.0.0.22 216.140.140.27 route-map STATIC-NAT-PRIMARY ip nat inside source static 10.0.0.24 216.140.140.28 route-map STATIC-NAT-PRIMARY ip nat inside source static 10.0.0.25 216.140.140.29 route-map STATIC-NAT-PRIMARY ip nat inside source static 10.0.0.59 216.150.150.5 route-map STATIC-NAT-SECONDARY ip nat inside source static 10.0.0.52 216.150.150.6 route-map STATIC-NAT-SECONDARY ip nat inside source static 10.0.0.53 216.150.150.7 route-map STATIC-NAT-SECONDARY ip nat inside source static 10.0.0.16 216.150.150.8 route-map STATIC-NAT-SECONDARY ip nat inside source static 10.0.0.58 216.150.150.9 route-map STATIC-NAT-SECONDARY ip nat inside source static 10.0.0.61 216.150.150.11 route-map STATIC-NAT-SECONDARY ! ip access-list standard PRIMARY-NEXT-HOP permit 216.140.140.1 ip access-list standard SECONDARY-NEXT-HOP permit 216.150.150.254 ip access-list standard DYNAMIC-PRIMARY deny 10.0.0.24 deny 10.0.0.25 deny 10.0.0.30 deny 10.0.0.16 deny 10.0.0.22 deny 10.0.0.23 deny 10.0.0.21 deny 10.0.0.33 deny 10.0.0.44 deny 10.0.0.58 deny 10.0.0.59 deny 10.0.0.61 deny 10.0.0.54 deny 10.0.0.52 deny 10.0.0.53 deny 10.0.0.216 deny 10.0.0.220 deny 10.0.0.230 deny 10.0.0.228 deny 10.0.0.251 permit 10.0.0.0 0.255.255.255 ip access-list standard DYNAMIC-SECONDARY deny 10.0.0.59 deny 10.0.0.52 deny 10.0.0.53 deny 10.0.0.16 deny 10.0.0.58 deny 10.0.0.61 permit 10.0.0.0 0.255.255.255 ! ! route-map STATIC-NAT-PRIMARY permit 10 match ip next-hop PRIMARY-NEXT-HOP ! route-map STATIC-NAT-PRIMARY deny 20 ! route-map STATIC-NAT-SECONDARY permit 10 match ip next-hop SECONDARY-NEXT-HOP ! route-map STATIC-NAT-SECONDARY deny 20 ! route-map SECONDARY-NAT permit 10 match ip address DYNAMIC-SECONDARY match ip next-hop SECONDARY-NEXT-HOP ! route-map SECONDARY-NAT deny 20 ! route-map PRIVATE-INGRESS permit 10 set ip next-hop verify-availability 216.140.140.1 10 track 1 set ip next-hop verify-availability 216.150.150.254 20 track 2 ! route-map PRIVATE-INGRESS permit 11 ! route-map PRIMARY-NAT permit 10 match ip address DYNAMIC-PRIMARY match ip next-hop PRIMARY-NEXT-HOP ! route-map PRIMARY-NAT deny 20