Conifure Ad-hoc wireless router on Linux

It’s acutally quite simple-got it to work in 5 min.

Setup at the server:

  1. iwconfig eth1 essid <essid> mode ad-hoc
  2. ipconfig eth1 10.0.0.1 up
  3. echo “1″ > /proc/sys/net/ipv4/ip_forward
  4. iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE

Setup on a client:

  1. iwconfig eth1 essid <essid> mode ad-hoc
  2. ipconfig eth1 10.0.0.2 up
  3. route add default gw 10.0.0.1
  4. echo “nameserever 10.0.0.1″ > /etc/resolv.conf

Should work. Another thing you may try is if your network card supports a “master” mode (iwconfig <interface> mode master) and if it does, you can setup an access point. I guess the rest should be similar (use “mode managed” on a client of course).

Leave a Reply