Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have a site with wireless (192.168.0.0) and a wired network (192.168.1.0). 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 192.168.0.0 to transfer files to a computer in 192.168.1.0. The must be some simple answer.

share|improve this question
    
Can you show us a picture or diagram? –  tomjedrz Apr 19 '11 at 3:35

3 Answers 3

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 192.168.0.0/24 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 192.168.1.0/24 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.

share|improve this answer

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 192.168.0.0/24 make the Linux box IP address their default router (its 192.168.0.x address). Then on the hosts on 192.168.1.0/24 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.

share|improve this answer
    
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.

https://help.Ubuntu.com/community/Router

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.

share|improve this answer
    
Well if you want to see how linux does it look it up on tldp: tldp.org/HOWTO/Adv-Routing-HOWTO (routing incl. traffic shaping) –  Unreason Apr 19 '11 at 12:58

Your Answer

 
discard

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.