How to Setup A Network Router
(VM Version)
(VM Version)
First time to setup two network , internal and NAT
Internal to connect with other network within the same connection
NAT to connect to internet
Set up the internal connection within linux first
Using nmcli command line steps
Step 1. Verify which interface : ip a
Step 2. Assign Ipv4: nmcli con mod enp0s3 ipv4.addresses 192.168.10.1/24
Step 3. Assign gateway: nmcli con mod enp0s3 ipv4.gateway 192.168.10.1
Step 4. Configure dhcp to static: nmcli con mod enp0s3 ipv4.method manual
Step 5. Set DNS value: nmcli con mod enp0s3 ipv4.dns "8.8.8.8" (Only configure once DNS is up)
Step 6. Reload interface: nmcli con up enp0s3
Step 7. Verify configurations: cat /etc/sysconfig/network-scripts/ifcfg-enp0s3
Once successfully configured, the output should be as followed seen in the picture above
Now we will move on to the part of configuration to allow other device within the same network to connect to the internet through network router
Step 1. enable IP forwarding
sysctl -w net.ipv4.ip_forward=1
Step 2. Start and run firewall daemon
systemctl is-active firewalld
systemctl is-enabled firewalld
systemctl enable firewalld
systemctl start firewalld
Step 3. After enabling the firewall daemon, enable masquerade for the public zone
firewall-cmd --permanent --zone=public --add-masquerade
firewall-cmd --reload
Step 4. Once the above steps are all finish , attempt to ping 8.8.8.8 from the other device
Once successful , you should be able to see the above output