Set Up Network Address Translation on Fedora 22
How to set up Fedora as a network address translator, or NAT. It is useful when only the Fedora PC has an IP restricted connection to the Internet and you want to get online with more devices.
- Created
- 2015
- Updated
- June 30, 2016
NAT Setup
I suppose we have two network interfaces.
- "eth0" connected to the internet
- "eth1" local network
We need to assign static ip for "eth1" (e.g. 192.168.1.1). Next we need to enable ipv4 forwarding (not available for ipv6).
$ sysctl net.ipv4.ip_forward
Next we need to masquerade local network IP addresses (in this example without specifying any zone). We can install firewall-config and tick "Masquerade" button or simply use the following command.
$ firewall-cmd --add-masquerade
On Local Network Devices
We need to do just two things. Set our Fedora PC as a gateway and add IP address of any DNS server.
- Set gateway to point to our Fedora computer's eth1 IP (192.168.1.1)
- Add DNS info (Google DNS 8.8.8.8 and 8.8.4.4)