Destination NAT configuration example

Destination NAT configuration example





R1 :-

interface FastEthernet0/0
 description ”
Connected to R2 “
 ip address
12.12.12.1 255.255.255.0
 no shut

interface FastEthernet2/0
description ” Connected to PC1 “
 ip address
10.1.1.1 255.255.255.0
no shut

router bgp 1
 no synchronization
 bgp
log-neighbor-changes
 network 10.1.1.0
mask 255.255.255.0
 neighbor
12.12.12.2 remote-as 2
 no auto-summary

ip route 143.20.1.0 255.255.255.0 12.12.12.2

R2 :-

interface FastEthernet0/0
 description ”
Connected to R1 “
 ip address
12.12.12.2 255.255.255.0
 ip nat inside
 no shut

interface FastEthernet0/1
 description ”
Connected to R3 “
 ip address
23.23.23.2 255.255.255.0
 ip nat outside
 no shut

router bgp 2
 no synchronization
 bgp
log-neighbor-changes
 network 143.20.1.0
mask 255.255.255.0
 neighbor
12.12.12.1 remote-as 1
 neighbor
23.23.23.3 remote-as 3
 no auto-summary

ip nat pool Pulic_pool_143.20.1.x 143.20.1.1 143.20.1.255
netmask 255.255.255.0 type match-host

ip nat outside source list R3_Subnets pool
Pulic_pool_143.20.1.x

ip access-list standard R3_Subnets
 permit 20.1.1.0
0.0.0.255

ip route 143.20.1.0 255.255.255.0 23.23.23.3


R3 :-

interface FastEthernet0/1
 description ”
Connected to R2 “
 ip address
23.23.23.3 255.255.255.0
 no shut

interface FastEthernet2/0
 description ”
Connected to PC2 “
 ip address
20.1.1.1 255.255.255.0
no shut

router bgp 3
 no synchronization
 bgp
log-neighbor-changes
 neighbor
23.23.23.2 remote-as 2
 no auto-summary

PC1:-

PC1> show ip

NAME        :
PC1[1]
IP/MASK     :
10.1.1.10/24
GATEWAY     :
10.1.1.1
DNS         :
MAC         :
00:50:79:66:68:00
LPORT       : 10007
RHOST:PORT  :
127.0.0.1:10006
MTU:        : 1500


PC2:-

PC2> sh ip

NAME        :
PC2[1]
IP/MASK     :
20.1.1.10/24
GATEWAY     :
20.1.1.1
DNS         :
MAC         :
00:50:79:66:68:01
LPORT       : 10001
RHOST:PORT  :
127.0.0.1:10000
MTU:        : 1500

Verification:-

R1:-

R1#sh ip route
Codes: L – local, C – connected, S – static, R – RIP, M –
mobile, B – BGP
       D – EIGRP, EX – EIGRP external, O – OSPF,
IA – OSPF inter area
       N1 – OSPF
NSSA external type 1, N2 – OSPF NSSA external type 2
       E1 – OSPF
external type 1, E2 – OSPF external type 2
       i – IS-IS,
su – IS-IS summary, L1 – IS-IS level-1, L2 – IS-IS level-2
       ia – IS-IS
inter area, * – candidate default, U – per-user static route
       o – ODR, P –
periodic downloaded static route, H – NHRP
       + –
replicated route, % – next hop override

Gateway of last resort is not set

      10.0.0.0/8 is
variably subnetted, 2 subnets, 2 masks
C       
10.1.1.0/24 is directly connected, FastEthernet2/0
L       
10.1.1.1/32 is directly connected, FastEthernet2/0
      12.0.0.0/8 is
variably subnetted, 2 subnets, 2 masks
C        12.12.12.0/24
is directly connected, FastEthernet0/0
L       
12.12.12.1/32 is directly connected, FastEthernet0/0
      143.20.0.0/24
is subnetted, 1 subnets
S        143.20.1.0
[1/0] via 12.12.12.2
      143.30.0.0/24
is subnetted, 1 subnets
S        143.30.1.0
[1/0] via 12.12.12.2

R1#sh ip bgp summ
BGP router identifier 12.12.12.1, local AS number 1
BGP table version is 15, main routing table version 15
2 network entries using 256 bytes of memory
2 path entries using 104 bytes of memory
2/2 BGP path/bestpath attribute entries using 248 bytes
of memory
1 BGP AS-PATH entries using 24 bytes of memory
0 BGP route-map cache entries using 0 bytes of memory
0 BGP filter-list cache entries using 0 bytes of memory
BGP using 632 total bytes of memory
BGP activity 6/4 prefixes, 7/5 paths, scan interval 60
secs

Neighbor       
V           AS MsgRcvd
MsgSent   TblVer  InQ OutQ Up/Down  State/PfxRcd
12.12.12.2     
4            2     183    
179       15    0   
0 02:38:24        1

R2:-

R2#sh ip nat translations
Pro Inside global     
Inside local       Outside
local      Outside global
— —               
—                                     143.20.1.10       
20.1.1.10
   –<<<
Destination NAT
icmp 10.1.1.10:57480  
10.1.1.10:57480   
143.20.1.10:57480  20.1.1.10:57480
icmp 10.1.1.10:57992  
10.1.1.10:57992   
143.20.1.10:57992  20.1.1.10:57992
icmp 10.1.1.10:58504  
10.1.1.10:58504   
143.20.1.10:58504  20.1.1.10:58504
icmp 10.1.1.10:58760  
10.1.1.10:58760   
143.20.1.10:58760  20.1.1.10:58760
icmp 10.1.1.10:59016  
10.1.1.10:59016    143.20.1.10:59016  20.1.1.10:59016
icmp 10.1.1.10:59272  
10.1.1.10:59272   
143.20.1.10:59272  20.1.1.10:59272


R2#sh ip nat translations
Pro Inside global     
Inside local       Outside
local      Outside global
— —               
—               
143.20.1.10        20.1.1.10
icmp 10.1.1.10:8074   
10.1.1.10:8074    
143.20.1.10:8074   20.1.1.10:8074

R2#sh ip nat translations verbose
Pro Inside global     
Inside local       Outside
local      Outside global
— —               
—               
143.20.1.10        20.1.1.10
    create
00:06:23, use 00:01:03, left 23:58:56, Map-Id (Out): 1,
    flags:
outside, use_count: 0, entry-id: 558, lc_entries: 0


R3:-

R3#sh ip bgp summary
BGP router identifier 23.23.23.3, local AS number 3
BGP table version is 13, main routing table version 13
2 network entries using 256 bytes of memory
2 path entries using 104 bytes of memory
2/2 BGP path/bestpath attribute entries using 248 bytes
of memory
2 BGP AS-PATH entries using 48 bytes of memory
0 BGP route-map cache entries using 0 bytes of memory
0 BGP filter-list cache entries using 0 bytes of memory
BGP using 656 total bytes of memory
BGP activity 6/4 prefixes, 7/5 paths, scan interval 60
secs

Neighbor       
V           AS MsgRcvd
MsgSent   TblVer  InQ OutQ Up/Down  State/PfxRcd
23.23.23.2     
4            2     170    
165       13    0   
0 02:26:36        2


R3#sh ip route
Codes: L – local, C – connected, S – static, R – RIP, M –
mobile, B – BGP
       D – EIGRP,
EX – EIGRP external, O – OSPF, IA – OSPF inter area
       N1 – OSPF
NSSA external type 1, N2 – OSPF NSSA external type 2
       E1 – OSPF
external type 1, E2 – OSPF external type 2
       i – IS-IS,
su – IS-IS summary, L1 – IS-IS level-1, L2 – IS-IS level-2
       ia – IS-IS
inter area, * – candidate default, U – per-user static route
       o – ODR, P –
periodic downloaded static route, H – NHRP
       + –
replicated route, % – next hop override

Gateway of last resort is not set

      10.0.0.0/24
is subnetted, 1 subnets
B        10.1.1.0
[20/0] via 23.23.23.2, 02:09:41
      20.0.0.0/8 is
variably subnetted, 2 subnets, 2 masks
C       
20.1.1.0/24 is directly connected, FastEthernet2/0
L       
20.1.1.1/32 is directly connected, FastEthernet2/0
      23.0.0.0/8 is
variably subnetted, 2 subnets, 2 masks
C       
23.23.23.0/24 is directly connected, FastEthernet0/1
L       
23.23.23.3/32 is directly connected, FastEthernet0/1
      143.20.0.0/24
is subnetted, 1 subnets
B        143.20.1.0
[20/0] via 23.23.23.2, 02:07:49
R3#

PC1:-

PC1> ping 143.20.1.10
84 bytes from 143.20.1.10 icmp_seq=1 ttl=61 time=78.000
ms
84 bytes from 143.20.1.10 icmp_seq=2 ttl=61 time=78.000
ms
84 bytes from 143.20.1.10 icmp_seq=3 ttl=61 time=62.400
ms
84 bytes from 143.20.1.10 icmp_seq=4 ttl=61 time=93.600
ms
84 bytes from 143.20.1.10 icmp_seq=5 ttl=61 time=93.600
ms


PC2:-

PC2> ping 10.1.1.10 -t
84 bytes from 10.1.1.10 icmp_seq=3 ttl=61 time=46.800 ms
84 bytes from 10.1.1.10 icmp_seq=4 ttl=61 time=78.000 ms
84 bytes from 10.1.1.10 icmp_seq=5 ttl=61 time=62.400 ms
84 bytes from 10.1.1.10 icmp_seq=6 ttl=61 time=78.000 ms
84 bytes from 10.1.1.10 icmp_seq=7 ttl=61 time=93.600 ms