Hi,
I would like to understand what's happening in my network. I'll try to explain the situation first:
I have a linux machine (Tormenta) with two network devices (wired eth0 and wireless wlan0) and another linux machine (Lightning) with only one wired device (eth1).
I plugged the two wired devices in both machines and I managed to configure Tormenta to act as a router and forward all IP traffic from Lightning through the wireless device.
Now I have Internet connection in both machines.
The only issue is that I can not connect from Tormenta to Lightning or from Lighting to eth0 in Tormenta.
The IPs are as follows:
Lightning
Tormenta
Code:
wlan0 192.168.1.151
eth0 192.168.2.2
So when I try:
Code:
felix@tormenta:~$ping 192.168.2.1
I get a "100% packet loss" error
And when I try:
Code:
felix@lightning:~$ping 192.168.2.2
I get a "Destination Host Unreachable" error.
I can ping everywhere else on both machines, I even can
Code:
felix@lightning:~$ping 192.168.1.151
successfully.
I don't know which information should I provide for you to understand the situation but here is the code I run in Tormenta to get things "working":
Code:
echo 1 > /proc/sys/net/ipv4/ip_forward
iptables -t nat -A POSTROUTING -o wlan0 -j MASQUERADE
iptables -P FORWARD ACCEPT
iptables -P OUTPUT ACCEPT
iptables -A INPUT -i ! wlan0 -j ACCEPT
iptables -A INPUT -p ICMP -j ACCEPT
iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
ifconfig eth0 192.168.2.2 up
ifconfig wlan0 192.168.1.151 up
route add -net 192.168.2.0 netmask 255.255.255.0 gw 192.168.1.1
route add -host 192.168.2.1 gw 192.168.2.2
route add default gw 192.168.1.1
Thank you for taking the time to read all my mess.
Fèlix Llopart