LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking > Linux - Wireless Networking
User Name
Password
Linux - Wireless Networking This forum is for the discussion of wireless networking in Linux.

Notices

Reply
 
LinkBack Search this Thread
Old 06-01-2008, 05:48 PM   #1
sancho
Member
 
Registered: Sep 2003
Distribution: Ubuntu 9.04/9.10 (64-bit)
Posts: 149

Rep: Reputation: 15
Bridging a Wifi and Wired Network...


I've got what should be a simple networking setup, but it is complicated by the fact that it is physically cut in half by a wireless link.

What I essentially have is a server, two workstations (one is WinXP), a wireless laptop, a wifi router (running dd-wrt), and a network printer that I want to all communicate on the same network (192.168.1.0) as though they were all connected to the same hub. Here's what my setup looks like when presented ASCIIly:

Code:
                     *
                     |
[[INTERNET]]-----[wifi router]-----[server]

=================== WALLS ===================

   *
   |
[workstation]-----[ethernet switch]-----[network printer]
                         |
                         |
                    [Windows PC]

             *
             |
          [laptop]
I know I have too many computers but that's an entirely different issue...

The question I have regards the "workstation" in the diagram above, which is an Ubuntu Hardy box with two network interfaces:

wlan0: 192.168.1.2 (assigned by static DHCP lease)
eth0: 192.168.1.200 (static)

Basically, this workstation needs to be the bridge that joins the lower group of computers with the upper in a way that doesn't introduce routing overhead (which is why I don't want to use NAT or place the lower group on a different network than the upper). It sounds like a network bridge is what I want (bridging wlan0 to eth0), but is this possible when one of the bridged interfaces is Wifi? The instructions that I have for setting up a bridge don't mention anything about specifying access points, enabling WPA2 encryption, or getting an address from a DHCP server (all of which are requirements to get wlan0 to talk to the router).

If someone could give me some guidance here on how I should approach this, I'd greatly appreciate it!

Thanks.
 
Old 06-02-2008, 07:00 AM   #2
pinniped
Senior Member
 
Registered: May 2008
Location: planet earth
Distribution: Debian
Posts: 1,732

Rep: Reputation: 50
A few things I can think of (but I haven't got the gear around to test it myself):

1. run a 'virtual' interface over the wireless - so you have 'wlan0' which is for your workstation, and 'wlan0:0' for other things. Bridge wlan0:0 to eth0 and in principle all your ethernet traffic now goes to wlan0:0 (including DHCP requests) but doesn't interfere with 'wlan0' and the workstation's network access (aside from chewing up bandwidth).

2. create a 'tap' on wlan0; bridge the tap with eth0. Come to think of it, this is the same as (1) really. Do 'taps' still exist?
 
Old 06-02-2008, 01:49 PM   #3
MrUmunhum
Member
 
Registered: May 2006
Location: Mt Umunhum, CA, USA
Distribution: Debian/ Fedora
Posts: 409

Rep: Reputation: 33
While I don't how to do it, you need to use EBTables to bridge
networks. I use two WAP54G's to connect my network. Works great!
 
Old 06-03-2008, 08:58 AM   #4
sancho
Member
 
Registered: Sep 2003
Distribution: Ubuntu 9.04/9.10 (64-bit)
Posts: 149

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by pinniped View Post

1. run a 'virtual' interface over the wireless - so you have 'wlan0' which is for your workstation, and 'wlan0:0' for other things. Bridge wlan0:0 to eth0 and in principle all your ethernet traffic now goes to wlan0:0 (including DHCP requests) but doesn't interfere with 'wlan0' and the workstation's network access (aside from chewing up bandwidth).
Can't say I've ever heard of a "virtual interface" before. Is this something that a "stock" kernel would support? ("Stock" meaning a pre-compiled kernel distributed with one of the major distributions such as Ubuntu) Or is this a hack or third-party solution?

Incidentally, I am keeping my eyes peeled for a decent second-hand router such as a WRT54GL that I can put Tomato/DD-WRT on. Or, failing that, one that supports bridging out of the box. Any recommendations for such a router are welcome!
 
Old 06-03-2008, 10:50 AM   #5
Gryyphyn
Member
 
Registered: Dec 2006
Location: Ogden, UT (Go OALUG!)
Distribution: OpenSuSE 10.1
Posts: 61

Rep: Reputation: 15
Quote:
Originally Posted by sancho View Post
The question I have regards the "workstation" in the diagram above, which is an Ubuntu Hardy box with two network interfaces:

wlan0: 192.168.1.2 (assigned by static DHCP lease)
eth0: 192.168.1.200 (static)
What I can't figure out is why you think there's two different networks, unless you've specified it w/subnetting. You didn't provide your subnet mask(s) so I'm just taking a guess there.

The linksys routers support single subnet for both wired/wifi connections. There's no need for there to be more than one subnet: it's one router w/two different kind of connections. I'd start by checking your settings and eliminating extraneous subnets.

Post your router config and hosts full addr set (ipv4/6 if your using it, subnet, gateway).

Gryyphyn, out.
 
Old 06-05-2008, 03:22 AM   #6
sancho
Member
 
Registered: Sep 2003
Distribution: Ubuntu 9.04/9.10 (64-bit)
Posts: 149

Original Poster
Rep: Reputation: 15
This is entirely an IPv4 network.

There are not (nor do I desire there to be) two separate "networks" in the TCP/IP sense. If anything, there are two distinct groups of computers, separated by an inability to make things easy by just stacking hubs since I can't put a cable between these groups. But, essentially, that's the equivalent that I want to achieve: "stacking" hubs via Wifi. Except that one of the "hubs" is a PC with a Wifi interface and the other hub is a WRT54GL router.

What I'm trying to avoid is the suggestion that I should just set the ethernet interface on the workstation to a separate (say 192.168.2.0) network, place everything that connects via that interface on that network/subnet, and then setup NAT on the workstation. I don't want to maintain 'x' computers on the 192.168.1.0 network and then 'y' computers on 192.168.2.0 network if I can avoid it.

As for posting my router config ([wifi router] in the diagram): It's just a router running DD-WRT and is essentially a simple gateway to the Internet. Its IP is 192.168.1.254, subnet mask is 255.255.255.0, and it also hosts a DHCP server. It treats both wireless clients and anything connected to the ethernet ports in the same way (i.e. it will assign addresses in the 192.168.1.0 address space).

The [server] is direct-connected to the [wifi router] via ethernet. It, including everything else in the diagram, has an address in the 196.168.1.0 network, and the subnet mask is set to 255.255.255.0 for everything. Short of listing the actual IP for each node, that's basically all you could want to know about the network. There is nothing special about the way that anything is connected, except that I want the [Windows PC] and [network printer] to be accessible to the entire network via the [workstation] because they do not have Wifi interfaces to connect to the Wifi router directly.
 
Old 06-07-2008, 11:06 AM   #7
Gryyphyn
Member
 
Registered: Dec 2006
Location: Ogden, UT (Go OALUG!)
Distribution: OpenSuSE 10.1
Posts: 61

Rep: Reputation: 15
Unhappy

Quote:
Originally Posted by sancho View Post
This is entirely an IPv4 network.

There are not (nor do I desire there to be) two separate "networks" in the TCP/IP sense. If anything, there are two distinct groups of computers, separated by an inability to make things easy by just stacking hubs since I can't put a cable between these groups. But, essentially, that's the equivalent that I want to achieve: "stacking" hubs via Wifi. Except that one of the "hubs" is a PC with a Wifi interface and the other hub is a WRT54GL router.
Ok, I think I know what you're asking now. You want the workstation to act like an aggregator, pulling all the wifi connections in the lower section to it and piping them back to the wifi router in the upper section.

If thats correct then I'm not sure you'll be able to do it, or at the very least how. You'd have to set the workstation up as a WAP and redirect all the traffic from the wireless to eth0 and find a way to re-broadcast traffic through the WiNIC to the other computers when requested traffic comes back.

Piping the traffic received through the WiNIC is easy. Setting it up as a WAP... I wouldn't even know where to begin. And piping the traffic back out, like a repeater, probably isn't going to be that hard since it's already capable of doing so as a router/firewall with the right apps/servers.

I do have a question for you though: why can't you run a single eth cable to the other room to a small router? And why do you want to stay away from using two subnets? Just curious...

Gryyphyn, out.

*add*

A virtual interface is a fake, secondary interface that uses the actual interface (in the case of the above statement, wlan0) to send traffic through but appears as it's own interface when you do things like ifconfig. It's typically used, at least in my experience, for setting up things like vlans and routing through a single interface. It's virtually there in that it's not a physical interface but can handle it's own traffic.

Last edited by Gryyphyn; 06-07-2008 at 11:09 AM. Reason: added information
 
Old 06-15-2008, 11:39 AM   #8
Quigi
Member
 
Registered: Mar 2003
Location: Cambridge, MA, USA
Distribution: Ubuntu (Dapper and Heron)
Posts: 377

Rep: Reputation: 31
Quote:
Originally Posted by sancho View Post
This is entirely an IPv4 network.

What I'm trying to avoid is the suggestion that I should just set the ethernet interface on the workstation to a separate (say 192.168.2.0) network, place everything that connects via that interface on that network/subnet, and then setup NAT on the workstation. I don't want to maintain 'x' computers on the 192.168.1.0 network and then 'y' computers on 192.168.2.0 network if I can avoid it.
I haven't found the solution.

My situation is very similar (minor difference: I don't have a wired "Windows PC", but instead a wireless Windows laptop).
I resigned myself to have two subnets -- 192.168.1.0 includes wireless and "server", and 192.168.3.0 is just between "workstation" (.10) and "network printer" (.50), connected via "switch" (I think a lowly hub would do, too).

I don't need to do any NAT or routing, by running CUPS in "workstation". Everyone prints to that (192.168.1.14), and CUPS knows to reach its printer at 192.168.3.50. Works nicely for me, but I'm aware that this would NOT give your "Windows PC" access to the internet.

As an experiment, I once did the routing thing: I told the wireless "laptop" (which happens to run Windows XP in my case) that its printer was 192.168.3.50. I added a route sending all packets for 192.168.3.0/24 to "workstation" (192.168.1.14). On "workstation", I set an iptables SNAT for such packets to 192.168.3.10, so that "switch" would route them back appropriately. I might have needed a special route on "workstation", too, I don't remember.
This worked; now "laptop" was able to access all ports of the "network printer" (HTTP 80, JetDirect 9100, Telnet, FTP). But all that manual routing seemed to involved, so I'm not using this currently.

I disagree with Gryyphyn: "workstation" should NOT be an access point (running in Master mode). In order to talk to "wifi router", your main access point, I think it must be a client (running in Managed mode). I don't think two access points could associate -- anyone, correct me if this is wrong.

One more idea: to make "Windows PC" happy, you will need at least to turn ipv4_forward. I think you can set your network up without NAT (after all, your packets sent over the internet don't usually get NATted at any of their many hops, except at your "wifi router"). But I think you may have to set up some routing in "workstation" -- packets destined for "laptop" or "server" or the internet must be sent out through wlan0; those for "network printer" and "Windows PC" must take eth0. I think that would be easiest if the addresses were in disjoint ranges, e.g., 1..127 and 128..255.
 
Old 07-18-2008, 06:31 PM   #9
73gavin
LQ Newbie
 
Registered: Jul 2008
Posts: 2

Rep: Reputation: 0
No Tun tap stuff needed.

http://www.linuxfoundation.org/en/Net:Bridge

With your workstation up and running as a client fine, try:

ifconfig eth0 0.0.0.0
ifconfig wlan0 0.0.0.0
brctl addbr br-lan
brctl addif br-lan wlan0
brctl addif br-lan eth0
dhclient br-lan

Last edited by 73gavin; 07-18-2008 at 06:33 PM. Reason: add link
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Bridging a wired network to a wifi network bobmcobob Linux - Wireless Networking 2 07-18-2008 06:36 PM
VMWare's bridging vs Window's bridging - routing is messed up when Windows bridging brenan99 General 0 05-04-2008 10:24 PM
Bridging the Wired Segment (Ethernet) & Wireless Segments (Access Point) Paris Heng Linux - Wireless Networking 0 07-14-2007 08:38 AM
Bridging Wireless interface with the Wired one hohenzolern Linux - Wireless Networking 3 04-04-2006 03:49 PM
Sharing Internet+WiFi+Wired flying_eyes Linux - Wireless Networking 4 10-28-2003 08:07 PM


All times are GMT -5. The time now is 02:52 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration