Sharing an Internet connection
Most firewall/routers have the ability to share an Internet connection with the devices in your home or office. This is called Network Address Translation (NAT). A Linux computer with two Network Interface Cards (NIC) can act as a router, providing firewall protection and connection sharing.
Firewalling and NAT support are provided by the support for iptables built into the kernel. This recipe introduces iptables
with a recipe that shares a computer's Ethernet link to the Internet through the wireless interface to give other wireless devices access to the Internet via the host's Ethernet NIC.
Getting ready
This recipe uses iptables
to define a Network Address Translation (NAT), which lets a networking device share a connection with other devices. You will need the name of your wireless interface, which is reported by 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...