Routing in the Access Point stuck (forwarding)
Hello, I’m here after a long time because I have a strange problem with routing and forwarding.
The problem came out when I first tried to broadcast my apache on the wifi: it works but when the laptop is connected to the internet it is not shared with the connected devices.
The device is my HTC desire, and android phone; Apache and Mysql on BT runs perfectly and the website is shared trough the wifi if i use the address 10.0.0.1 as URL; If i call Google the page won't load, the laptop have full internet access and I've tested it.
Here is my setup
Code:
Airmon-ng start wlan0
Airbase-ng –e “TEST” –c 9 mon0
So I have my monitor with a sort of ap running, I have to bring it completely on:
Code:
Ifconfig at0 up
Ifconfig at0 10.0.0.1 netmask 255.255.255.0
Route add –net 10.0.0.0 netmask 255.255.255.0 gw 10.0.0.1
Dhcpd3 –cf /etc/dhcp3/dhcpd2.conf at0
The conf files contains
Code:
option domain-name-servers 10.0.0.1;
default-lease-time 60;
max-lease-time 72;
ddns-update-style none;
authoritative;
log-facility local7;
subnet 10.0.0.0 netmask 255.255.255.0 {
range 10.0.0.100 10.0.0.254;
option routers 10.0.0.1;
option domain-name-servers 10.0.0.1;
}
and created the DHCPD.pid in /var/run/ with the permissions for the dhcp server;
then flushing all the tables (i can't understand this part)
Code:
iptables --flush
iptables --table nat --flush
iptables --delete-chain
iptables --table nat --delete-chain
iptables --table nat --append POSTROUTING --out-interface eth0 -j MASQUERADE
iptables --append FORWARD --in-interface at0 -j ACCEPT
iptables -t nat -A PREROUTING -p udp --dport 53 -j DNAT --to 192.168.1.1
Assuming that
Quote:
dhcp server v3.1.3 on
192.168.1.1 is the router address of my main network (home net)
10.0.0.1 is the server/router address of my secondary Wnetwork (TEST)
The backtrack laptop is connected to 192.168.1.1 trough eth0 up and connected via WICD (he is 192.168.1.178 there)
internet works on the laptop
Internet doesn't work for the smartphone
a pc on the main network can recall the laptop server using 192.168.1.178
I cannot recall the phone since he doesn't host any server services
I must say that i have studied the routing/forwarding process and tables but that was just theory and this is a mess, I have copied those "iptables instructions" from examples... uhm... any ideas why he doesn't forwards my packets?
Best regards and tank you,
dalla
Re: Routing in the Access Point stuck (forwarding)
I can see a couple of possible issues:
1. Is kernel forwarding enabled?
2. The name-server should be set to your home LAN address, probably 192.168.1.1. The last line of the iptables is meant to forward dns requests but this might not be the best way of managing dns.
Re: Routing in the Access Point stuck (forwarding)
starting from the point 2:
I changed my dhcp file, now it starts with
Code:
option ddns-update-style ad-hoc;
option domain-name-servers 192.168.1.1;
default-lease-time 600;
max-lease-time 702;
now in /var/run/ everyone can create content so dhcp3 server is happy with it
still the pc won't route my packets to the main router
The modem says that connected to his network there is
192.168.1.30 (my desktop pc)
192.168.1.178 (BT5 laptop) he doesn't says anything about his routing capabilities.
More infos
Code:
Modem-ip: 192.168.1.1
subn.mask: 255.255.255.0
NAPT and DHCP enabled
from 192.168.1.2 to 192.168.1.254
The second network starts from 10.0.0.2 and it must not be the problem, the subnet mask is good until 10.0.0.254
It is still stuck.
________________________________________
you asked me "1. Is kernel forwarding enabled?"
Well, I have googled it, after finding something about "Kernel ip forwarding", the resoult is that this wariable was setted to 0 (sysctl net.ipv4.ip_forward)
so i have done a hot set:
Code:
sysctl -w net.ipv4.ip_forward=1
and guess what? It works now!
thank you very much vulpi, now I just have to add some automation process in the BT5 pc and that's it... I will create a new thread when needing a different help
Best regards!