Linux route add between static LAN and Wifi Gateway
Posted
by
Hamza
on Super User
See other posts from Super User
or by Hamza
Published on 2012-08-29T13:15:11Z
Indexed on
2012/09/14
15:41 UTC
Read the original article
Hit count: 340
I have two local machines connected to each other via wired ethernet and one of those machines is also connected to a wifi network which provides internet access.
A pseudo-graphical representation of the topology is as follows:
(PC2)----------(PC1)---------(Wifi Gateway)
192.168.2.x 10.0.0.x
The configuration on PC2 is:
iface eth0 inet static
address 192.168.2.2
network 192.168.2.0
netmask 255.255.255.0
gateway 192.168.2.1
...and the configuration on PC1 is:
iface eth0 inet static
address 192.168.2.1
network 192.168.2.0
netmask 255.255.255.0
gateway 192.168.2.1
On PC1, I've added a default route for wlan0 as I couldn't access the internet otherwise:
route add default gw 10.0.0.1 wlan0
And also tried setting the gateway for the 192.168.2.x network using:
route add -net 192.168.2.0 netmask 255.255.255.0 gw 10.0.0.1
But I still can't access internet from PC2.
Edit
I don't have access to the wifi gateway.
© Super User or respective owner