#!/bin/sh -e echo 'cleaning iptables' iptables -F -t nat iptables -F INPUT iptables -F FORWARD iptables -F PREROUTING -t nat iptables -F POSTROUTING -t nat iptables -F echo '[done]' echo 'setting up ip forwarding' #here you need to put -i WIFI_INTERFACE_NAME -o INTERNET_INTERFACE_NAME iptables -A FORWARD -i wlan0 -o eth0 -s 192.168.0.2 -j ACCEPT #Put your INTERNET_INTERFACE_ADDRESS in place of 10.4.255.205 iptables -A POSTROUTING -t nat -s 192.168.0.2 -d 0.0.0.0/0 -j SNAT --to-source 10.4.255.205 echo '[done]' echo 'enabling kernel forwarding' echo 1 > /proc/sys/net/ipv4/ip_forward echo '[Done]' echo '------------------------------------------------------------------' echo 'Set up AD-HOC network between this computer and your n900' echo 'Your N900 should have following settings:' echo 'IP: 192.168.0.2' echo 'MASK: 255.255.255.0' echo 'GW: 192.168.0.3' echo 'DNS: 8.8.8.8' echo 'You should disable power savings' echo 'Your linux PC wireless interface should have following settings:' echo 'IP: 192.168.0.3' echo 'MASK: 255.255.255.0' echo '------------------------------------------------------------------' echo 'it may be nessesary to run on your N900 as root following command:' echo "echo 'nameserver 8.8.8.8'>> /etc/resolv.conf" echo 'If you have problems try to disable firewall.' echo 'Re-run your firewall script or restart computer after use.' echo '------------------------------------------------------------------' echo 'Enjoy my crapy script:)' exit 0 #hardkorek