This article is based on experience of my friend Saptarshi. He has a small business (website link here) and uses Fedora at his workplace (I can’t deny that it was me who gave him Fedora first
). Here’s how he setup a shared internet between two different Fedora based PC.
1. At first setup IP Forwarding on the main machine (on which Internet is connected). We need this frequesntly, so we set it as startup.
As root, edit /etc/sysctl.conf and add / modify this:
net.ipv4.ip_forward=1
2. Now as root issue the following command so that iptables rule is setup for IP forwarding:
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE service iptables save
3. Now the setup of NIC. The main machine has two NIC – one is for input for ADSL connection from ISP. Second NIC is used to connect with secodn machine.The configuration should be like this:
Router: It is connected to the internet service provider, IP : 192.168.1.1
Internet Connected System (Main PC)
eth0 (LAN Card 1): Connected to router; IP : 192.168.1.10, Net-mask : 255.255.255.0, Gateway : 192.168.1.1 (IP of the router)
eth1 (LAN Card 2): Connected to the other system; IP : 192.168.0.20 (it must be different than eth0), Net-mask : 255.255.255.0, Gateway : 192.168.1.1 (IP of the router)
Second System: NIC of this system is connected to the first system
IP : 192.168.0.30 (must be different than eth0 and eth1 of the first PC), Net-mask : 255.255.255.0, Gateway : 192.168.0.20 (IP of the second Card in the first system)
Important Note: Second machine’s Gateway address should be IP of the Main PC.
NB: He asked me to share his setup experience through my blog so that many newbies can get benefited from this.