You may sometimes find yourself in a situation when you need to share your own computer's Internet connection with another computer that just arrived in your home. For instance, when your sister comes by with her laptop, or a friend comes over with his PC, or it just happens that your father has just bought himself a new computer and would like to have an Internet connection as well. So what do you do considering that you're running Ubuntu on your own PC but unfortunately have no idea how to share the Internet connection?
Well, it's rather simple now that there are graphical front-ends for just about every command you could ever run from a terminal. Take this situation for example, to share the Internet connection with other computers in your local network, you had to run a few commands in a terminal. But now, there's a program called Guidedog that acts as a NAT/masquerading/port-forwarding tool for your desktop environment and which allows you to enable or disable Internet connection sharing with a few clicks.
Before installing Guidedog, make sure your local network is using the following topology:
- You own PC has two network cards, one for the Internet connection and one for the LAN connection to another computer or to a switch connecting several other computers.
- The Internet Ethernet device is set-up with an external IP address, which is reachable from anywhere on the Internet.
- The LAN Ethernet device as well as all other machines on the LAN are using the 192.168.1.x private IP range. Also, make sure that LAN machines have IP 192.168.1.1 set as gateway. (This is the IP address set to your own (Ubuntu) computer's LAN Ethernet device).
To install Guidedog, go to System / Administration and select Synaptic Package Manager:Softpedia,
.Click the Search button, enter guidedog as the search keyword and press Enter.
After closing the information pop-up, you'll see the program's interface, which is divided in three tabs. The first tab concerns routing packets between different machines. To enable Internet connection sharing, you'll need to check the first two boxes, Enable Routing and Enable IP Masquerade. The first check-box controls whether your Ubuntu system will even route packets at all. More exactly, this will set 1 to /proc/sys/net/ipv4/ip_forward. The next check-box will enable IP Masquerade, which will configure your system to automatically detect and masquerade packets coming from a private IP address and destined for a public Internet IP address. Basically, this will enable other computers with private IP addresses to reach the Internet. This check-box will perform the iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE command. The last two check-boxes are optional and should only be used when some network protocols won't work correctly with IP masquerade. For this reason, these check-boxes enable special support for two of the most common protocols, FTP and IRC. As for the No-masquerade addresses section, you should only add there the IP addresses of computers in your LAN that should be contacted without applying IP masquerade to the packets. Generally, this feature doesn't need to be used in general, but there are situations where it's necessary in connection with VPN or other exotic routing configurations.
Final Note: Guidedog is intended to be used in combination with a separate firewall program (Guarddog for instance) because it has the potential to expose your machine and network to the broader Internet. Also, a firewall program will allow you to ensure that only the right people can access any newly exposed machine and network. It will also open the forwarded ports on the Ubuntu machine (every forwarded port has to have an iptables rule set to allow for both protocols).
Share Internet Connection and Enable Port Forwarding with Guidedog
HOT RIGHT NOW