Sharing an Internet connection
In the modern computing world, we are using different kinds of devices in our day-to-day life. We use desktop computers, netbooks, laptop computers, tablets, smartphones and so on. Additionally, we feel the need to keep all of these connected to the Internet for which people usually keep a wireless router which distributes an Internet connection across these devices. But what if you don't have a router (or your router just blew up) and you need to share the Internet? No problem! Linux, iptables and some scripting are at your rescue.
Getting ready
This recipe uses iptables
for setting up
Network Address Translation (NAT) which lets a networking device share a connection with other devices. You will need the name of your wireless interface for which just use the iwconfig
command.
How to do it...
Connect to the Internet. In this recipe, we are assuming that the primary wired network connection, eth0 is connected to Internet. Change it according to your setup.
Using...