Monday, September 22, 2008

using everex cloudbook as an wireless router for nokia i810

add an new wireless network from Network Manager and it must be Ad-Hoc and call it foobar
and put the ip 10.0.0.1 to the wlan0 network
with gateway 10.0.0.1
dns 10.0.0.1
and netmask 255.255.255.0

it should look something like this

ip ro show dev wlan0
10.0.0.0/24 proto kernel scope link src 10.0.0.1
ip addr show wlan0

3: wlan0: mtu 1500 qdisc pfifo_fast state UP qlen 1000
link/ether 00:15:af:54:2a:af brd ff:ff:ff:ff:ff:ff
inet 10.0.0.1/24 brd 10.0.0.255 scope global wlan0
inet6 fe80::215:afff:fe54:2aaf/64 scope link
valid_lft forever preferred_lft forever


install dhcpd server
sudo apt-get install dhcp3-server
sudo vi /etc/default/dhcp3-server
INTERFACES="wlan0"
sudo vi /etc/dhcp3/dhcpd.conf
ddns-update-style ad-hoc;
default-lease-time 3600;
max-lease-time 9000;
authoritative;
subnet 10.0.0.0 netmask 255.255.255.0 {
range 10.0.0.2 10.0.0.30;
option routers 10.0.0.1;
option domain-name-servers 10.0.0.1;
}
sudo /etc/init.d/dhcp3-server stop
sudo /etc/init.d/dhcp3-server start

install bind server for dns requests

sudo apt-get install bind9

add in etc/bind/named.conf.options
recursion yes;


allow-recursion {
127.0.0.1;
10.0.0.0/24;
};

allow-query {
127.0.0.1;
10.0.0.0/24;
};

and test it
dig debian.org @10.0.0.1

do the snat

sudo su
echo "1" > /proc/sys/net/ipv4/ip_forward
sudo iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE

check the traffic with tcpdump
sudo tcpdump -i wlan0

No comments: