How to configure PAT (Port Address Translation) using EVE-NG
How to make PAT (Port Address Translation) and give internet access to rest of the network.
In this tutorial, EVE-NG is used
The topology is used for demonstration
Everything is pretty simple. No complex configuration required.
Virtual Router vIOS is connected to home router and asks about ip address via DHCP
While connecting to cloud use Management(Cloud0) interface to get IP address
We use next syntax:
Router>enable
Router#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
R1(config)#interface gigabit0/0
R1(config-if)#ip address dhcp
R1(config-if)#no shutdown
R1(config-if)# ip nat outside <----- This command tells router to translate internal ip (LAN address) to external ip (Global address) CLI will be frozen for a little time after applying that command.
Shortly we will get message that router got ip address
Interface GigabitEthernet0/0 assigned DHCP address 192.168.1.104, mask 255.255.255.0, hostname R1
Soon NVI0 (NAT Virtual Interface) will appear, that is as said virtual interface.
That interface can be seen using “R1#show ip interface brief”
Next step is to configure gigabit0/1 interface which connects with LAN
Note: We can use any private range of address, described in RFC 1918
Here they are:
10.0.0.0 - 10.255.255.255 (10/8 prefix)
172.16.0.0 - 172.31.255.255 (172.16/12 prefix)
192.168.0.0 - 192.168.255.255 (192.168/16 prefix)
I’m gonna use 192.168.3.0 in this example.
Let’s go!
R1(config)#interface gigabitEthernet 0/1
R1(config-if)#ip address 192.168.3.1 255.255.255.0
R1(config-if)# ip nat inside <---- This command does reverse, translates external ip to internal ip
R1(config-if)#no shutdown
Interfaces are configured for NAT, now we need to configure DHCP server on a Router.
R1#configure terminal
R1(config)#
R1(config)#ip dhcp pool PAT
R1(dhcp-config)#network 192.168.3.0 255.255.255.0
R1(dhcp-config)#default-router 192.168.3.1
R1(dhcp-config)#dns-server 192.168.1.15 <---- Configure your actual DNS server address given from your ISP
R1(dhcp-config)#exit
R1(config)#ip dhcp excluded-address 192.168.3.1 <---- These command prevents particular IP to be used by other networking device.
Now we gonna configure the most important step.
We should configure Access-list to permit internal ip addresses to be translated
R1(config)#ip access-list standard 1
R1(config-std-nacl)#permit 192.168.3.0 0.0.0.255
R1(config-std-nacl)#exit
R1(config)#
R1(config)#ip nat inside source list 1 interface gigabitEthernet 0/0 overload
(The overload keyword enables PAT. Overload means that multiple internal devices can use one Global address to access the internet)
R1(config)#
As you see VPC can ping twitter global address, that means everything is done and PAT works
That was it, hope you enjoyed and it will help you in your lab environment.
Comments
Post a Comment