Skip to navigation

Using your linux machine as a router

The wireless card of my old old old Toshiba laptop (urmel) seems not to be getting along with the 128bit WEP key. Since I use it only very rarely, I’ve now set my everyday laptop (audrey) up to act as a router for urmel, using these instructions:


Audrey is connected to the router via WLAN (ath0), getting the IP 192.168.0.4 via DHCP.

On audrey:

sudo -s
ifconfig eth0 192.168.1.1
iptables -t nat -A POSTROUTING -o ath0 -j MASQUERADE
echo 1 > /proc/sys/net/ipv4/ip_forward
aptitude install dnsmasq ipmasq
/etc/init.d/dnsmasq restart
dpkg-reconfigure ipmasq # accepted all the defaults 

Uncomment the line net.ipv4.ip_forward = 1 in /etc/sysctl.conf

On urmel:

sudo ifconfig eth0 192.168.1.2

Add gateway 192.168.1.1

Both connections use the same subnet mask (255.255.255.0).

Addendum

After a reboot, I wasn’t able to go online or even connect to the router on either machine. On audrey, pinging google gave “host not found”, and pinging the router gave ping: sendmsg: Operation not permitted.

This was solved by running

sudo dpkg-reconfigure ipmasq

once more.

I don’t know whether this problem will persist, and if it does, how to solve it permanently.

Comments are closed.