Internet Access for DHCP Clients Using NAT
Internet Access for DHCP Clients Using NAT on Fortigate, Cisco, and Mikrotik Routers in GNS3
NAT (Network Address Translation) is a method used to convert private IP addresses into public IP addresses, allowing devices on a local network to access the internet. Private IP addresses are used within local area networks (LANs) and are not routable on the internet. Common private IP address ranges include:
- 192.168.0.0 to 192.168.255.255
- 10.0.0.0 to 10.255.255.255
- 172.16.0.0 to 172.31.255.255
On the other hand, public IP addresses are globally routable and are used for communication over the internet. There are approximately 3.5 billion IPv4 addresses available worldwide. IP private use beacuse conserve public IP addresses (since they're limited).
NAT serves several purposes in a network:
- Security: NAT hides the internal network’s private IP addresses from the outside world, reducing exposure to attacks.
- IP Address Conservation: By using a single public IP for multiple devices within the LAN, NAT helps conserve the limited pool of public IP addresses.
- Connectivity: NAT allows internal users to access the internet using a shared public IP address.
In this document, we will configure PAT, which translates the private IP addresses of outgoing traffic to a public IP address, enabling internet access for devices on the local network.
Configuring NAT on MikroTik CHR
Step-by-Step Guide:
- Log in to your Mikrotik Router.
- Add dhcp-server network (if not already configured) used for gateways & DNS
- Add address list to to group ip addresses (optional)
- Configure NAT
Now you can try; if it fails, you can try retrieving the DHCP client on the client or restart the router. Some MikroTik devices may delay and it's normal.
Configuring NAT on Cisco 7200
Step-by-Step Guide:
- Access the router’s CLI.
- Enter configuration mode:
- Define the inside and outside interfaces. These interfaces correspond to your LAN (inside) and WAN (outside):
- Define the access list (ACL) that identifies the internal addresses to be translated:
- Create a NAT translation rule. For Source NAT, we use the ip nat inside source command:
- Save the configuration:
The internal IP addresses within the range specified will now be translated to the public IP address of the WAN interface. Overload is a more flexible NAT/PAT technique for using one public IP with multiple devices, and is typically used when the public IP is static.
Configuring NAT on FortiGate
Step-by-Step Guide:
GUI
- Log in to your FortiGate device.
- Navigate to Policy & Objects > IPv4 Policy.
- Click Create New to add a new policy.
- Set the Incoming Interface to your internal network interface (LAN).
- Set the Outgoing Interface to the interface connected to the internet (WAN).
- Set the Source Address to the required port/address.
- Set the Destination Address to the WAN port.
- Under Action, select Accept.
- Configure the schedule as per your requirements.
- Enable NAT by checking the box.
- Apply the changes.
CLI
- Log in to your FortiGate device.
- Enter configuration mode
Now, your internal network traffic will be NATed to the public IP address associated with the WAN interface.
You can watch all the configuration here.
Conclusion
Configuring NAT on FortiGate, Cisco 7200 and MikroTik CHR allows local devices on your network to share a single public IP address for internet access, ensuring security and saving IP addresses, while enabling internet connectivity.