ICS from ethernet over WIFI through a router to a single host

0

I have two laptops and some other devices in a LAN in which I have a small WIFI router. The two laptops communicate with each other over WIFI through the router. Beside the wifi connections there is a sensor device attached to the ether port of the router, that needs to communicate with laptop2 over the LAN, and it has a fix local ip. All the devices are in the same network. On my laptop1 I have internet through the ethernet interface of the laptop. It looks something like this:

internet ----- laptop1 ------- wifi router ------ laptop2

I would like to use the internet from laptop2. I tried to change the default route on laptop2 to use laptop1 as a gateway:

sudo route add default gw 192.168.0.100

where 192.168.0.100 is the address of the wifi card in laptop1. It doesn't work, I can't ping any address apart from those in the small LAN. I turned of the firewall in laptop1, but didn't help either. What else should I configure?

details, adderesses:

laptop1 wifi: 192.168.0.100

laptop1 eth: {public ip}

wifi router: 192.168.0.1

laptop2 wifi: 192.168.0.20

other net device eth: 192.168.0.10

swizzly

Posted 2013-04-12T09:56:41.537

Reputation: 1

you need to create routing rules on laptop1 if it must be default gateway for other computers. If connection between laptop2 and laptop1 is passing through router, the router needs to have a specific routing rule setup as well - otherwise it will pass traffic to internet using its own default gateway. – mnmnc – 2013-04-12T10:18:04.667

what routing rules do I need to setup on laptop1, how should I do it? I didn't pen it correctly: the small "WIFI router" is actually working in access point mode, so it is rather a hub or switch. – swizzly – 2013-04-12T10:34:12.273

You need to setup NAT on laptop1. Routing won't help -- addresses have to be changed. – David Schwartz – 2013-04-12T11:05:26.377

1

read this article on how to forward traffic on linux: http://www.ducea.com/2006/08/01/how-to-enable-ip-forwarding-in-linux/

– mnmnc – 2013-04-12T11:05:26.877

No answers