NAT configuration - static NAT configuration [simple topology, detailed code]

topology

insert image description here

configuration

Configure border router AR1

Configure the interface IP address

int g0/0/0
ip add 192.168.0.254 24
int g/0/0/1
ip add 100.100.12.1 24

Configure static NAT

nat static global 100.100.12.33 inside 192.168.0.253

This is the most important command when configuring static NAT.
Command explanation: Use 100.100.12.33 to replace 192.168.0.253, and the former to replace the latter. The IP address in front can be specified arbitrarily (within the scope of the network segment), and the IP address in the back is the address to be translated.

Configure the external network device AR2

Configure the interface IP address

int g0/0/0
ip add 100.100.12.2 24

configure routing

ip route-static 192.168.0.0 24 100.100.12.1

Because AR2 is not in the same network segment as the internal terminal device, a route needs to be configured. However, AR1 does not need to configure routes, because AR1 is directly connected to internal terminal devices and AR2, and it will generate direct routes by itself.

Configure internal terminal device IP

How to configure how to configure!
But to configure it in the network segment of 192.168.0.0, it needs to be in the same network segment as the gateway device.
I use the interface DHCP, it is very simple, configure on AR1:
dhcp enable
int g0/0/0
dhcp select interface

detection

ping detection

insert image description here

Address Translation Detection

Enable packet capture on the g0/0/1 interface of AR1, and then ping 100.100.12.2, the following packets will be displayed.
Have you seen the package of 100.100.12.33? If you see it, the conversion is successful.
insert image description here

Summarize

During static NAT translation, the translated public IP address must be included in the public network segment.
That is: in the public network segment 100.100.12.0, the public network IP address can only be 100.100.12.X.

If you have something to gain, hey, give it a thumbs up and leave.

Guess you like

Origin blog.csdn.net/qq_48330132/article/details/128329723