Sign up ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

My setup is Modem -> Linksys router -> Laptop with 2 devices (wlan0/eth0) -> desktop machine

Router is gateway to the internet Laptop wlan0 is with a gw of Laptop eth0 is which acts as a second gateway desktop is

On laptop i've setup ip_forward to 1, and have inserted 2 iptables rules

-A FORWARD -i eth0 -o wlan0 -j ACCEPT 
-A FORWARD -i wlan0 -o eth0 -j ACCEPT

The laptop can ping outside the network (i,e, it can not ping The desktop can ping but nothing outside the network or subnet.

On laptop ip route show lists: dev eth0  proto kernel  scope link  src dev wlan0  proto kernel  scope link  src dev lo  scope link 
default via dev wlan0 

What am I missing to make my desktop go through the laptop in order to access the router which provides access to the internet?


share|improve this question

3 Answers 3

up vote 1 down vote accepted

You could use bridging if you just want to pass on traffic transparently on your laptop. That way, the linksys would assign IP to your desktop, and your desktop would only be routed once in order to access internet.

Still, you would be able to filter data on your laptop with iptables, if that is what you want.

share|improve this answer
This is a good idea too, didn't even think of this. – McJeff Jun 14 '10 at 15:05
I've setup the bridge per the documentation and the laptop can ping outside network, and desktop machine @, desktop machine can ping laptop however it can not ping gateway at all iptables rules are cleared, routing table is reset to only show to be sent to, ip_forward is still enabled so not sure what else im missing – SimmaDoWN Jun 14 '10 at 16:16
also remember im using wireless which is the device so not sure if i need to do anything there – SimmaDoWN Jun 14 '10 at 16:22
I have a feeling my wireless is the reason why I am unable to move packets out/in. bridging does seem like the simplest solution but i need a workaround for this wireless adapter – SimmaDoWN Jun 14 '10 at 17:49
iptables should be default allow all, but shouldn't point to the gw address, since it's the local net. It should say * as gateway. – jishi Jun 17 '10 at 12:06

The laptop which is directly connected to the desktop cannot ping the desktop, but your desktop can ping your laptop? So, in other words, A->B works but B->A doesn't?

You probably also need to setup some sort of SNAT or masquerading. My gut feeling is that the packet is getting forwarded to the router with a source of, but the router doesn't know what to do with it because it's only directly connected to Maybe a static route on your router that forces all traffic through the laptop.

share|improve this answer
See Not only is the intermediate machine forwarding packets, it's also mangling the source so it looks as though the traffic originates from the routing machine. – McJeff Jun 14 '10 at 13:28
Im able to ping and from laptop, however, desktop can not ping I'll attempt at setting up a static route on the router which I'm assuming you mean the linksys router and not the laptop? And if im setting up a static route do I still look into masquerading the traffic coming from the laptop eth0( – SimmaDoWN Jun 14 '10 at 13:34
Yeah, on the Linksys itself via laptop. If that doesn't work, check into MASQ & might also TCP dump your laptop to see if the packets are actually forwarded through. – McJeff Jun 14 '10 at 13:59
So ive setup masquerading and tcpdump shows ping responses to be setup at even when it comes from dekstop( I had to add another route ip route add dev eth0 this allows desktop to access both subnets.. however still can not access outside of network – SimmaDoWN Jun 14 '10 at 14:14
What's the default GW on the desktop? (I'm actually having a bit of fun with this ;-) – McJeff Jun 14 '10 at 14:36

So, basically you are using the wireless on the laptop to connect to the router/internet, and want to "share" the connection with the desktop. This is exactly what "bridging" is for, as jishi pointed out.

If you prefer the separate subnets, then you need to make iptables do Network Address Translation (NAT). Iptables can do it .. here is a tutorial. Before starting, make sure that the laptop can do everything you need on the internet.

However, unless this is intended as a learning exercise, I recommend that you buy a wireless adapter for the desktop machine. They aren't expensive and are simple to install (particularly the USB ones).

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.