I have a site with wireless ( and a wired network ( Each network has its own DHCP server and other such infrastucture. There is an Ubuntu Linux machine that has a connection to both networks. Can I somehow configure this Linux machine to allow two computers on these separate networks to communicate?

I heard that bridges do not work with wireless hosts. I think I want a NAT but most documentation I have found tries to connect some isolated network to the Internet. I do not need that in this case. I just need one computer from to transfer files to a computer in The must be some simple answer.

  • Can you show us a picture or diagram? – tomjedrz Apr 19 '11 at 3:35

There's no need for NAT - all you should need is for the hosts needing to contact each other to have a route via the Ubuntu machine (its IP on the same network as them, of course):

route add -net gw ubuntulinux.on.net.0.0 # run this on the host on the wired network for it to reach the wireless network
route add -net gw ubuntulinux.on.net.1.0 # run this on the host on the wireless network for to reach the wired network

and IP forwarding activated on the server:

sysctl -w net.ipv4.ip_forward=1

Also, check the server isn't filtering traffic: iptables -nvL FORWARD should come back empty. No routes should be needed on the server if the interfaces are configured correctly.


You just need basic routing.

Make sure you have the following line in /etc/sysctl.conf:

net.ipv4.ip_forward = 1

Then, for hosts on make the Linux box IP address their default router (its 192.168.0.x address). Then on the hosts on make the other Linux interface the hosts default router. Then they should be able to communicate by giving IP addresses. mapping to names is another matter, most easily done by editing /etc/hosts files on the other hosts.

  • Worthwhile pointing out I think that making the Linux box the default route for the hosts will make ALL their off-subnet traffic go through there, which might not be what is wanted. Maybe the hosts should just be set up so that only traffic for the other subnet goes through the Linux box and all the rest goes through the standard default rout. – blankabout Apr 19 '11 at 4:35
  • True enough. It would probably be better to enter static routes to the other network. But that's slightly more complicated. DHCP can also be configured to supply those static routes. – Keith Apr 19 '11 at 4:38
  • 1
    I get the impression from the question that it is only one host on the network that needs to access the other network so all the OP has to do is setup a static route on it and, of course, a static route on the host at the other side so the traffic from there can get back. – blankabout Apr 19 '11 at 4:45
  • Yes it's just one host on each network for now. – User1 Apr 19 '11 at 14:07

Brigding won't work for different subnets, what you need here is routing.

I'm not familiar about how Linux does routing sorry so all I can provide is this link.


its not much but if you read it you should be able to grasp the basics of routing.

If you had a Cisco 2800 router I could help you further.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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