Create AP from any laptop with wifi and ethernet card

So, you have a laptop with wifi and enternet card and you want to make "real" AP from it. There are many ways to do this, but I like this one:

  1. Install packages required:
    apt-get install dnsmasq
    
  2. configure /etc/dnsmasq.conf to be DHCP server for your wifi network:
    listen-address=192.168.42.1
    dhcp-range=192.168.42.42,192.168.42.242,12h
    
  3. turn atheros card into master (AP) mode and configure new network 192.168.42.0/24 and setup masquarade:
    sudo sh -c "echo 1 > /proc/sys/net/ipv4/ip_forward"
    sudo wlanconfig ath0 destroy
    sudo wlanconfig ath0 create wlandev wifi0 wlanmode ap
    sudo iwconfig ath0 essid free4all
    sudo ifconfig ath0 192.168.42.1
    sudo iwconfig 
    sudo /etc/init.d/dnsmasq restart
    sudo iptables --flush  
    sudo iptables --table nat --flush
    sudo iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
    sudo iptables -A FORWARD -i eth0 -o ath0 -m state --state RELATED,ESTABLISHED -j ACCEPT
    sudo iptables -A FORWARD -i ath0 -o eth0 -j ACCEPT
    

And that's it. You have new 192.168.42.0/24 network on your wifi interface ath0 which is passed to eth0 (which you should configure beforehand using dhclient eth0 or someting similar). Bring wifi to every home in next year ;-)

Instructions here are specific for configuration with atheros wifi card (that's why I'm using wlanconfig to switch card in EeePC into AP mode). For other wifi cards which support AP mode via standard iwconfig the syntax is: iwconfig eth1 mode master. If you get error using this command, you might try with ad-hoc mode instead of "real" AP...