Fedora Linux Support Community & Resources Center
  #1  
Old 29th May 2009, 03:54 AM
Crysm Offline
Registered User
 
Join Date: Sep 2007
Location: Knoxville, TN
Age: 26
Posts: 12
How do I bridge wireless and wired connections?

My current network setup at home is all wired, and that's worked for me so far. Now I want to set up a wireless connection on my Linux box that I can connect to with both my laptop and my Nintendo DS.
I'd like to be able to host a wireless network from the Linux box, connect to it with some other wireless device, and have the wireless device communicate with the router, the internet, and other computers on the wired network.

I have the wired network set up (statically configured) as eth0.
Other network adapters present on the system are eth1 (not in use) and wlan0, wlan1, and wlan2 (identical cards, remnants from the last time I experimented with wireless).

So I guess my question comes in two parts:
1) How do I set up wlan0 such that it can host? Is Ad-hoc mode okay for this, or do I need to set it up in Master mode?
2) How do I forward connections between the wireless net and the router?

Note that I will be using WEP, as it is all that the NDS supports. I'd like to set up MAC filtering as well, but not until after I get something that works.
Reply With Quote
  #2  
Old 30th May 2009, 12:18 AM
beaker_ Offline
Registered User
 
Join Date: Nov 2008
Location: Canada
Posts: 2,278
Ad-hoc's good, an access point's probebly prefered, entirely your choice. As for bridging, I'm not so sure. Best I could do:

1. Create ifcfg-br0
Quote:
$ cat /etc/sysconfig/network-scripts/ifcfg-br0

TYPE=Bridge
DEVICE=br0
BOOTPROTO=dhcp
ONBOOT=yes

USERCTL=no
IPV6INIT=no
2. Add wlan# and eth# to br0
Quote:
$ cat /etc/sysconfig/network-scripts/ifcfg-eth0
# Please read /usr/share/doc/initscripts-*/sysconfig.txt
# for the documentation of these parameters.
TYPE=Ethernet
DEVICE=eth0
HWADDR=##########################
BOOTPROTO=none
ONBOOT=yes
USERCTL=no
PEERDNS=yes
IPV6INIT=no
NM_CONTROLLED=no
MTU=1500
BRIDGE=br0
Quote:
cat /etc/sysconfig/network-scripts/ifcfg-wlan0
# Please read /usr/share/doc/initscripts-*/sysconfig.txt
# for the documentation of these parameters.
TYPE=Wireless
DEVICE=wlan0
HWADDR=#############################
BOOTPROTO=none
ONBOOT=yes
USERCTL=no
PEERDNS=yes
IPV6INIT=no
MODE=Ad-Hoc
RATE=auto
NM_CONTROLLED=no
ESSID=MeMe
CHANNEL=3
BRIDGE=br0
3. Restart network service and hope for the best.
Quote:
service network restart
4. Looks right but realise it's not working as expect.
Quote:
$ brctl show
bridge name bridge id STP enabled interfaces
br0 8000.0013d30a1567 no eth0
wlan0
pan0 8000.000000000000 no
virbr0 8000.000000000000 yes

5. Saved headache and routed it


Let us know if you get it working.
Reply With Quote
  #3  
Old 31st May 2009, 12:34 PM
Crysm Offline
Registered User
 
Join Date: Sep 2007
Location: Knoxville, TN
Age: 26
Posts: 12
Hi, thanks for the response.

Unfortunately, that did not seem to do it for me. Probably I didn't understand steps 4 and 5 from your post. I've never used brctl before or tried bridging anything before.

Here's what I did try, though:
I edited my interface config files thusly:
Code:
[crysm@onca ~]$ cat /etc/sysconfig/network-scripts/ifcfg-eth0
# Realtek Semiconductor Co., Ltd. RTL-8169 Gigabit Ethernet
DEVICE=eth0
BOOTPROTO=none
HWADDR=00:14:d1:14:f6:04
ONBOOT=yes
DHCP_HOSTNAME=onca
DNS1=172.29.3.1
NM_CONTROLLED=no
TYPE=Ethernet
USERCTL=no
PEERDNS=yes
IPV6INIT=no
IPADDR=172.29.3.2
NETMASK=255.255.255.0
GATEWAY=172.29.3.1
BRIDGE=br0
[crysm@onca ~]$ cat /etc/sysconfig/network-scripts/ifcfg-wlan0
# RaLink RT2561/RT61 802.11g PCI
DEVICE=wlan0
USERCTL=no
TYPE=Wireless
HWADDR=00:1f:1f:0a:f6:10
BOOTPROTO=none
IPADDR=172.29.4.1
NETMASK=255.255.255.0
BROADCAST=172.29.4.255
GATEWAY=172.29.3.1
ONBOOT=yes
MODE=Ad-Hoc
ESSID=KazeToIsshoNi
DHCP_HOSTNAME=onca
DNS1=172.29.3.1
DNS2=
DNS3=
NM_CONTROLLED=no
DOMAIN=
CHANNEL=3
RATE=auto
PEERDNS=yes
IPV6INIT=no
BRIDGE=br0
[crysm@onca ~]$ cat /etc/sysconfig/network-scripts/ifcfg-br0
TYPE=Bridge
DEVICE=br0
BOOTPROTO=dhcp
ONBOOT=yes

USERCTL=no
IPV6INIT=no
As soon as I saved ifcfg-eth0, the SSH session I was using lost connection. I wasn't expecting an effect that immediate, but I quickly realized how silly it was to be editing the network config files over a network connection.

I also found out on 'service network restart' that I didn't have the package for brctl installed. Googling led me to bridge-utils, which I installed with yum. I restarted the network again, got a little error about br0 not existing because eth0 and wlan0 were brought up before br0, ran the network service restart again, and it didn't return any errors that time (br0 exists now).

This is where the problems started. Connecting with my laptop's wireless, I got no DHCP response. I configured the IP manually and tried pinging the IPs for wlan0, eth0, and my router, all of which timed out. Trying to ping the laptop from the Linux box also failed. The wired connection was also no longer working, as I could not SSH in or ping either way between that machine and another hooked to the same switch (previously, it worked fine). The Linux box was still able to ping out to the internet, but when I tried to use some net apps (Firefox and Pidgin), they seemed to think there was no connection, despite pinging net sites continuing to work.

Eventually, I commented out "BRIDGE=br0" for both eth0 and wlan0, did "ifconfig br0 down", set "ONBOOT=no" for br0, and did "service network restart" to get normal network behavior back.

If it helps, here is some output from brctl:
Code:
[crysm@onca ~]$ brctl show
bridge name	bridge id		STP enabled	interfaces
br0		8000.0014d114f604	no		eth0
							wlan0
pan0		8000.000000000000	no		
[crysm@onca ~]$ brctl showstp br0
br0
 bridge id		8000.0014d114f604
 designated root	8000.0014d114f604
 root port		   0			path cost		   0
 max age		  19.99			bridge max age		  19.99
 hello time		   1.99			bridge hello time	   1.99
 forward delay		  14.99			bridge forward delay	  14.99
 ageing time		 299.95
 hello timer		   1.95			tcn timer		   0.00
 topology change timer	   0.00			gc timer		   6.95
 flags			


eth0 (0)
 port id		0000			state		     forwarding
 designated root	8000.0014d114f604	path cost		   4
 designated bridge	8000.0014d114f604	message age timer	   0.00
 designated port	8001			forward delay timer	   0.00
 designated cost	   0			hold timer		   0.95
 flags			

wlan0 (0)
 port id		0000			state		     forwarding
 designated root	8000.0014d114f604	path cost		 100
 designated bridge	8000.0014d114f604	message age timer	   0.00
 designated port	8002			forward delay timer	   0.00
 designated cost	   0			hold timer		   0.95
 flags
Additionally, I have discovered that the NDS only supports connecting to Master mode wireless nets, but since my wireless card module (RT61) seems to have some issues with Master, I think I will just work on Ad-Hoc for now unless the setup would be so different between the two it'd be worth the time to work it out now.

Last edited by Crysm; 31st May 2009 at 12:36 PM. Reason: clarification
Reply With Quote
  #4  
Old 31st May 2009, 02:28 PM
beaker_ Offline
Registered User
 
Join Date: Nov 2008
Location: Canada
Posts: 2,278
My step 5 meant, it didn't work, all packets were dropped. At the wireless connection, or failed the cross the bridge... I guess that's a matter of perspective. Honestly though, I just routed the two networks. i.e., 192.168.5.x/24 on ethernet 192.168.6.x/24 on wireless and I just routed the.
Reply With Quote
  #5  
Old 31st May 2009, 03:56 PM
Crysm Offline
Registered User
 
Join Date: Sep 2007
Location: Knoxville, TN
Age: 26
Posts: 12
Okay, I think I mostly understand what you mean, even if I have no idea how you did it. I'm not really sure what this would entail, so let me put up a more detailed network diagram:
Code:
    Internet
       |
Main Router (DHCP from ISP)
  Router interfaces----------Net 1 (172.29.1.1)----Net 2 (172.29.2.1)----Net 3 (172.29.3.1)
                                     |                     |                       |
                               Various DHCP          Various DHCP               Switch------... -> Various DHCP (172.29.3.x/24)
                              (172.29.1.x/24)       (172.29.2.x/24)                     |
                                                                                  172.29.3.2 (eth0)---Onca (hostname)---172.29.4.1 (wlan0)---... -> other adapters
                                                                                                                              |
                                                                                                                              |
                                                                                                                      Wireless devices
I'm not really concerned about the DHCP solution; I can run everything static, or get the DHCP from the main router, or from this Linux box, as long as everything is still able to talk to one another. All that worries me is whether implementing some networking function isolates the wireless segment from the wired segment.

Additionally, it may be worth noting that the router I have isn't a commercial router, it's actually a 486 that's running Freesco router 0.3.5. Is this routing something I would have to implement at the router (172.29.x.1), this machine (Onca, 172.29.3.2), or both?
Reply With Quote
  #6  
Old 31st May 2009, 07:25 PM
beaker_ Offline
Registered User
 
Join Date: Nov 2008
Location: Canada
Posts: 2,278
Yeah I think you got the idea. It'd be neater if wlan0 were moved up to the same level as 172.29.3.1 , .2.1, .1.1., (segments) but you got the idea. Also consider how you craft your firewall because you may not want to completely trust wlan0.


Sorry for the late edit. Instead of creating a new /24 network, consider dividing your subnet. Say 1-100 on eth0 an 101-200 on wlan0. You're the architect.

Last edited by beaker_; 31st May 2009 at 07:57 PM. Reason: late thought
Reply With Quote
  #7  
Old 31st May 2009, 08:40 PM
Crysm Offline
Registered User
 
Join Date: Sep 2007
Location: Knoxville, TN
Age: 26
Posts: 12
Unfortinately, Freesco does not support wireless cards, to my knowledge, and that machine's expansion slots are full in any case.

I'm not especially particular about what IP addresses go where, I just picked a new subnet for clarity.


The question for me remains though, what tool/script should I use to do routing with? Is this something iptables would cover?
Reply With Quote
  #8  
Old 31st May 2009, 09:01 PM
beaker_ Offline
Registered User
 
Join Date: Nov 2008
Location: Canada
Posts: 2,278
Yes it pretty much all iptables. Staying away from NAT if you can (think double NAT as future f up) you'll have to spell out the routes to your other gateways & routers. No special tools required, maybe dhcpd on wlan0 to hand out ip addresses.

Don't loose site of where you're going. Can your wireless card function as an access point? Or will will everyone connect to an adhoc network? i.e., what about nintendo?
Reply With Quote
  #9  
Old 31st May 2009, 09:15 PM
Crysm Offline
Registered User
 
Join Date: Sep 2007
Location: Knoxville, TN
Age: 26
Posts: 12
I believe it can function in master mode, but it seems to be an irritating process to go through, so I've been saving it.

I guess I can read up one some iptables tutorials to figure out the best way to get communication between the subnets working.

I haven't worked with dhcpd before, though. As long as it can be restricted to wlan0, it might be a good thing to have.
Reply With Quote
  #10  
Old 31st May 2009, 10:35 PM
beaker_ Offline
Registered User
 
Join Date: Nov 2008
Location: Canada
Posts: 2,278
That's cool. Just put pen to paper as to how you want your network laid out. There's minimal work to do for iptables, learn how to check and enable port forwarding, learn how and where to add routes, then try pinging around with static ip addresses first (wlan0). Let me know when you've tried something first. Note., let your gateway/router to the www preform NAT, not your wlan.
Reply With Quote
  #11  
Old 26th June 2009, 02:30 AM
agillis Offline
Registered User
 
Join Date: Mar 2009
Posts: 52
[SOLVED] How do I bridge wireless and wired connections?

I followed beaker's instructions and sure enough. I could connect but all packets stoped at wlan0.

Then I tried this
Code:
sysctl -w net.ipv4.ip_forward=1
and now it works!

Thanks for all you help guys.
Reply With Quote
  #12  
Old 26th June 2009, 03:07 AM
beaker_ Offline
Registered User
 
Join Date: Nov 2008
Location: Canada
Posts: 2,278
Missed enabeling port forwarding. Hahaha yeah I'm stupid enough to over look that, and my gf reminds me so once and while. You two must be related.

Thank you.

Last edited by beaker_; 26th June 2009 at 03:10 AM.
Reply With Quote
Reply

Tags
bridge, connections, wired, wireless

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Acer Aspire One - help me get my network connections (wired & wireless) working nashie Hardware & Laptops 15 10th May 2009 05:56 PM
xBox 360: Bridge Connections? David Vazquez Servers & Networking 0 22nd December 2008 08:34 PM
Multiple Network Connections - Wired + Wireless baldeyuk Servers & Networking 1 20th June 2006 03:39 PM
Setting up a bridge between Wired and Wireless DWL-122 richbayliss Servers & Networking 0 23rd April 2004 01:38 AM


Current GMT-time: 07:30 (Wednesday, 16-04-2014)

TopSubscribe to XML RSS for all Threads in all ForumsFedoraForumDotOrg Archive
logo

All trademarks, and forum posts in this site are property of their respective owner(s).
FedoraForum.org is privately owned and is not directly sponsored by the Fedora Project or Red Hat, Inc.

Privacy Policy | Term of Use | Posting Guidelines | Archive | Contact Us | Founding Members

Powered by vBulletin® Copyright ©2000 - 2012, vBulletin Solutions, Inc.

FedoraForum is Powered by RedHat