I set up myself this simple lab scenario:
Two routers back to back - serial 0 on router RTA to serial 1 on router RTB. I have connected one Catalyst 1900 switch to RTA, second to RTB, each to respective Ethernet interface on router. There is no dynamic routing protocol, only static routes.
IP addressing:
RTA S0: 1.0.0.2/8
E0: 192.100.40.1/24
RTB S1: 1.0.0.1/8
E0: 192.100.30.1/24
Without NAT enabled everybody can talk to everybody. Host to hosts, routers to routers, etc...
Now, I have configured NAT on RTA with following commands:
E0: ip nat inside
S0: ip nat outside
ip nat inside source static tcp 192.100.40.6 80 1.0.0.2 80
access-list 1 permit 192.100.40.0 0.0.0.255
ip nat inside source list 1 interface s0 overload
Suppose the NAT translation table is empty, containing only static translation. For laboratory purposes and to better understand NAT, when pinging I am using IP addresses that are configured on LAN hosts.
The problem is - when I ping "nated" hosts behind RTA directly from RTB or from hosts behind RTB, using their configured "real" IP addresses, I get replies. WHY??? According to my knowledge of NAT order of operation, when communicating from outside to inside:
FIRST : NAT translation table is checked if it contains translation entry for given destination address and port, if it is not here, packets will be dropped
SECOND: Routing table is checked to deliver translated packet to destination, if there is no route, packets will be dropped
Form inside to outside steps are otherwise.
Then why I am able to ping them? Is it because I directly know the real IP address of nated hosts? But then I must conclude, that FIRST step I described above won't be applied in case of real IP addresses traveling through NAT router, and packets will be directly routed to destination and NAT will fail. If this is the case, I would really appreciate if anybody can clear this "NAT behaviour" to me or point to some useful links where they explain similar cases.
Second problem. Now, while RTA is configured with NAT, I have configured same NAT scenario on RTB - same commands, but of course IP addresses must match my subnets. Now when I am pinging hosts behind RTA from hosts behind RTB and vice-versa I don't get any replies. That is what I want to achieve. BUT! When I ping directly from router RTA hosts behind RTB and hosts behind RTB directly from RTA, I do get replies!!!
I am getting confused about this NAT operation. I know that NAT should be hiding IP addresses from outside "evil" world, but once somebody learns my real IP he can connect to me. From outputs of debug ip nat detailed I could not dig something useful. Do I have to apply additional access-list rules to filter also IP addresses comming to my NAT router, that will deny packets with destination IP address of my private hosts? But this defy the NAT order of operation as it is described on Cisco's webpages.
If anybody could just please clear this matter to me, I would greatly appreciate it. Or tell if I am totally wrong and this can never happen... I am sure I am missing the last small step in my full understanding of NAT
Tahnk you all in advance
Note: Static translation was working in both cases. Peter Mesjar
CCNA, A+ certified
pmesjar@centrum.sk
Two routers back to back - serial 0 on router RTA to serial 1 on router RTB. I have connected one Catalyst 1900 switch to RTA, second to RTB, each to respective Ethernet interface on router. There is no dynamic routing protocol, only static routes.
IP addressing:
RTA S0: 1.0.0.2/8
E0: 192.100.40.1/24
RTB S1: 1.0.0.1/8
E0: 192.100.30.1/24
Without NAT enabled everybody can talk to everybody. Host to hosts, routers to routers, etc...
Now, I have configured NAT on RTA with following commands:
E0: ip nat inside
S0: ip nat outside
ip nat inside source static tcp 192.100.40.6 80 1.0.0.2 80
access-list 1 permit 192.100.40.0 0.0.0.255
ip nat inside source list 1 interface s0 overload
Suppose the NAT translation table is empty, containing only static translation. For laboratory purposes and to better understand NAT, when pinging I am using IP addresses that are configured on LAN hosts.
The problem is - when I ping "nated" hosts behind RTA directly from RTB or from hosts behind RTB, using their configured "real" IP addresses, I get replies. WHY??? According to my knowledge of NAT order of operation, when communicating from outside to inside:
FIRST : NAT translation table is checked if it contains translation entry for given destination address and port, if it is not here, packets will be dropped
SECOND: Routing table is checked to deliver translated packet to destination, if there is no route, packets will be dropped
Form inside to outside steps are otherwise.
Then why I am able to ping them? Is it because I directly know the real IP address of nated hosts? But then I must conclude, that FIRST step I described above won't be applied in case of real IP addresses traveling through NAT router, and packets will be directly routed to destination and NAT will fail. If this is the case, I would really appreciate if anybody can clear this "NAT behaviour" to me or point to some useful links where they explain similar cases.
Second problem. Now, while RTA is configured with NAT, I have configured same NAT scenario on RTB - same commands, but of course IP addresses must match my subnets. Now when I am pinging hosts behind RTA from hosts behind RTB and vice-versa I don't get any replies. That is what I want to achieve. BUT! When I ping directly from router RTA hosts behind RTB and hosts behind RTB directly from RTA, I do get replies!!!
I am getting confused about this NAT operation. I know that NAT should be hiding IP addresses from outside "evil" world, but once somebody learns my real IP he can connect to me. From outputs of debug ip nat detailed I could not dig something useful. Do I have to apply additional access-list rules to filter also IP addresses comming to my NAT router, that will deny packets with destination IP address of my private hosts? But this defy the NAT order of operation as it is described on Cisco's webpages.
If anybody could just please clear this matter to me, I would greatly appreciate it. Or tell if I am totally wrong and this can never happen... I am sure I am missing the last small step in my full understanding of NAT
Tahnk you all in advance
Note: Static translation was working in both cases. Peter Mesjar
CCNA, A+ certified
pmesjar@centrum.sk