LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Debian
User Name
Password
Debian This forum is for the discussion of Debian Linux.

Notices


Reply
  Search this Thread
Old 10-03-2005, 02:16 PM   #1
pohl886
LQ Newbie
 
Registered: Dec 2004
Posts: 15

Rep: Reputation: 0
Howto bridge wireless and wired network interfaces?


Hello,

First of all I hope this topic was not covered already elsewhere, but I couldn't find a solution with searching Google and Linuxquestions.org. I also want the debian way via /etc/network/interfaces for my new setup.

The following setup is working without any problems and is faily easy to setup. My Laptop is connected to the university network via wired ethernet eth0 and gets an public IP address from the university DHCP server:

auto eth0
iface eth0 inet dhcp
name Ethernet LAN card

The wireless network eth1 is setup as an ad-hoc network with an private IP address and another DHCP server running on my linux box assigns a private IP address to any computer which connects to my ad-hoc network (primarily for surfing the internet from the kitchen, which has no network socket). The package ipmasq does network address translation (NAT) for the wireless host connected to the ad-hoc network.

auto eth1
iface eth1 inet static
name Wireless LAN card
address 192.168.1.254
netmask 255.255.255.0
network 192.168.1.0
broadcast 192.168.1.255
wireless-essid debian-ssid
wireless-mode Ad-Hoc
wireless-key open [1] s:*************
wireless-power on

So far so good. But under WinXP is fairly easy to setup a network bridge between the wired and wireless network interfaces. The huge advantage of that setup is that both my Laptop and any other computer connected to the ad-hoc wireless network get a public IP address from the university DHCP server and all computers are on the same subnet (good for LAN gaming!!!). No extra DHCP server and no NAT are necessary.

How can I adopt my file /etc/network/interfaces to create a network bridge between eth0 and eth1?

I found something which is nearly what I want, but uses static IP addresses:
(http://www.trekweb.com/~jasonb/artic...ireless2.shtml)

auto br0
iface br0 inet static
address 192.168.1.1
network 192.168.1.0
netmask 255.255.255.0
broadcast 192.168.1.255
bridge_ports wlan0 eth2
up \
/sbin/iwconfig wlan0 essid trekweb && \
/sbin/iwconfig wlan0 channel 4 && \
/sbin/iwconfig wlan0 mode Master

Thank you for any kind of comment or suggestions,
Alexander

Last edited by pohl886; 10-03-2005 at 02:22 PM.
 
Old 10-03-2005, 02:46 PM   #2
Matir
LQ Guru
 
Registered: Nov 2004
Location: San Jose, CA
Distribution: Debian, Arch
Posts: 8,507

Rep: Reputation: 128Reputation: 128
Code:
auto br0
iface br0 inet dhcp
bridge_ports wlan0 eth2
up \
/sbin/iwconfig wlan0 essid trekweb && \
/sbin/iwconfig wlan0 channel 4 && \
/sbin/iwconfig wlan0 mode Master
 
Old 10-03-2005, 06:10 PM   #3
pohl886
LQ Newbie
 
Registered: Dec 2004
Posts: 15

Original Poster
Rep: Reputation: 0
Hi Matir,

thank you, I didn't know that this was so straightforward. The only thing is that it takes quite a while to bring the bridge up (waiting max 30 s).
Also I wonder why the wireless-* syntax in /etc/network/interfaces does not work when included in the bridge section, but the iwconfig command does.

Alexander
(Bridge up and running!!!)
 
Old 10-03-2005, 11:57 PM   #4
Matir
LQ Guru
 
Registered: Nov 2004
Location: San Jose, CA
Distribution: Debian, Arch
Posts: 8,507

Rep: Reputation: 128Reputation: 128
The wireless syntax will not work because the br0 device is not recognized as a wireless device by the wireless extensions (iwconfig).
 
Old 12-25-2008, 02:19 PM   #5
napo
LQ Newbie
 
Registered: Nov 2008
Distribution: Ubuntu 8.04
Posts: 6

Rep: Reputation: 0
Just for Reference...

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

I found this very useful for bridging two connections.
(ps Just for reference for other searchers)
 
Old 05-22-2009, 06:47 PM   #6
jago25_98
Member
 
Registered: Jun 2001
Posts: 302

Rep: Reputation: 30
Some things I have noticed:

- a bridge doesn't have to have an IP
- a bridge can be specified in /etc/network/interfaces with DHCP or static. Not sure to just bring it up though. Possibly not it in the if-up section (kludge)
- you can't use a Tun device with a bridge (no idea why?) so iptables it has to be in that case

Last edited by jago25_98; 05-22-2009 at 07:04 PM.
 
Old 10-13-2009, 02:54 PM   #7
Chief Fox
LQ Newbie
 
Registered: Jun 2009
Location: Ohio, United States
Distribution: Mint Gloria, Gnome
Posts: 15

Rep: Reputation: 0
I bridged my wireless connection like this, with a wired connection running windows 7. that did not work, but when I rebooted I am connected to my router wirelessly but can not view any internet sites. How can I uninstall this? I was searching the Linux log file, and can't figure out how to undo this operation. any ideas?
 
Old 12-31-2010, 06:58 PM   #8
ninetailfox97
LQ Newbie
 
Registered: Dec 2010
Posts: 2

Rep: Reputation: 0
here is a link to some thing that might help

http://davidzhang.webs.com/apps/blog/

it worked for me
 
Old 04-27-2011, 11:07 AM   #9
jharvell
LQ Newbie
 
Registered: Feb 2005
Posts: 5

Rep: Reputation: 0
So I'm trying to do this but I'm not on Debian. When I read the config file I have to infer what's really being done to the kernel.

I tried the following and it fails:

joey@saluki ~ $ sudo brctl show
bridge name bridge id STP enabled interfaces
joey@saluki ~ $ sudo brctl addbr quai
joey@saluki ~ $ sudo brctl addif quai btm
joey@saluki ~ $ sudo brctl addif quai wls
can't add wls to bridge quai: Operation not supported
joey@saluki ~ $ sudo brctl show
bridge name bridge id STP enabled interfaces
quai 8000.001d605439fc no btm
joey@saluki ~ $ ip link ls
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue state UNKNOWN
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: btm: <BROADCAST,MULTICAST> mtu 9000 qdisc pfifo_fast state DOWN qlen 1000
link/ether 00:1d:60:54:39:fc brd ff:ff:ff:ff:ff:ff
3: top: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN qlen 1000
link/ether 00:1d:60:54:39:fc brd ff:ff:ff:ff:ff:ff
4: wls: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
link/ether 00:15:af:29:2b:0e brd ff:ff:ff:ff:ff:ff
22: quai: <BROADCAST,MULTICAST> mtu 9000 qdisc noop state DOWN
link/ether 00:1d:60:54:39:fc brd ff:ff:ff:ff:ff:ff
 
Old 04-27-2011, 05:43 PM   #10
jharvell
LQ Newbie
 
Registered: Feb 2005
Posts: 5

Rep: Reputation: 0
Apparently, things have changed in the kernel since this thread was written. The brctl driver in the kernel apparently explicitly prevents bridging for wireless network interfaces. The following kernel code snippet is part of the logic for adding a network interface to a bridge. Does anyone know why this can't be supported?

/* No bridging devices that dislike that (e.g. wireless) */
if (dev->priv_flags & IFF_DONT_BRIDGE)
return -EOPNOTSUPP;
 
Old 07-09-2011, 06:18 PM   #11
mattbuford
LQ Newbie
 
Registered: Jul 2011
Posts: 1

Rep: Reputation: Disabled
You can bridge Ethernet to wireless if you are in AP mode.

The wifi protocol does not support multiple MAC addresses on a single node in any of the "client" type modes. Bridging preserves the source MACs of packets going between interfaces, so bridging Ethernet to wifi means you are transmitting packets with many source MACs (and will need to be able to receive packets to many destination MACs. This doesn't work in client modes.

Search for "wds". This is the magic you need if you want to bridge ethernet LAN -> wifi -> ethernet LAN. You can think of it as a point to point tunnel that supports bridging over wifi between two APs.

For example, I use this at my parent's and sister's houses. They have houses on the same street. There is an AP in my parent's living room that connects to their Internet and is in AP and WDS mode. Then, there is wifi WDS to another AP (that has no cable other than power) in their garage. This AP is also in AP and WDS mode. Then there's a router in my sister's garage (no cables other than power) in AP and WDS mode. Finally, there's a router in my sister's living room in AP and WDS mode that has Ethernet leading to her home LAN.

This bridges the LAN in my parent's house to the LAN in my sister's house and allows them to share Internet access. Both LANs are on the same subnet and share the same DHCP server.

Internet router (no wifi) -> ethernet switch -> living room AP -> wifi -> parent's garage AP -> wifi -> sister's garage AP -> wifi -> sister's living room AP -> ethernet switch -> sister's computer

If you are using a laptop/smartphone, you see all 4 APs with the same SSID (depending on where you stand you might not be able to see all 4) and you can associate and roam between them all without your IP changing.

Of course, if you associate to my sister's living room AP, this means your packets are going over wifi 4 times. This all happens on the same channel, so it is not very efficient in that sense. However, since I'm sharing 1.5 mbps Internet access over 54 mbps wifi, repeating packets up to 4 times isn't a big concern.

The setup above is all Linksys WRT54GL running OpenWRT.

For your reference, here is some config from the AP in my parent's garage. Note that this sets up the AP mode wireless interface, and also two WDS links. One WDS leads towards the living room and the other leads towards my sister's garage. It then bridges these together. It also bridges the Ethernet ports in, though there's nothing connected to them on this garage AP.

root@momdad-garage:~# cat /etc/config/network
#### VLAN configuration
config switch eth0
option vlan0 "0 1 2 3 5*"
option vlan1 "4 5"


#### Loopback configuration
config interface loopback
option ifname "lo"
option proto static
option ipaddr 127.0.0.1
option netmask 255.0.0.0


#### LAN configuration
config interface lan
option type bridge
option ifname "eth0.0"
option proto static
option ipaddr 10.0.1.11
option netmask 255.255.255.0
option gateway 10.0.1.1
option dns 10.0.1.1

root@momdad-garage:~# cat /etc/config/wireless
config wifi-device wl0
option type broadcom
option channel 1

config wifi-iface
option device wl0
option network lan
option mode ap
option ssid secretssid
option encryption wep
option key ***SECRET***

config wifi-iface
option device wl0
option network lan
option mode wds
option ssid secretssid
option bssid 00:1C:FF:0C:AB:46
option encryption wep
option key ***SECRET***

config wifi-iface
option device wl0
option network lan
option mode wds
option ssid secretssid
option bssid 00:1C:FF:0C:AB:B7
option encryption wep
option key ***SECRET***
root@momdad-garage:~# brctl show
bridge name bridge id STP enabled interfaces
br-lan 8000.001cffbca491 no eth0.0
wl0
wds0.2
wds0.1
 
1 members found this post helpful.
Old 07-19-2011, 06:58 PM   #12
jharvell
LQ Newbie
 
Registered: Feb 2005
Posts: 5

Rep: Reputation: 0
Cool

Quote:
Originally Posted by mattbuford View Post
You can bridge Ethernet to wireless if you are in AP mode.

The wifi protocol does not support multiple MAC addresses on a single node in any of the "client" type modes. Bridging preserves the source MACs of packets going between interfaces, so bridging Ethernet to wifi means you are transmitting packets with many source MACs (and will need to be able to receive packets to many destination MACs. This doesn't work in client modes.

Search for "wds". This is the magic you need if you want to bridge ethernet LAN -> wifi -> ethernet LAN. You can think of it as a point to point tunnel that supports bridging over wifi between two APs.

...
Matt,

This is exactly what I was looking for. I'll give it a shot.
 
  


Reply



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



Similar Threads
Thread Thread Starter Forum Replies Last Post
Wireless Access On Wired Network Terje Linux - Wireless Networking 1 02-03-2005 10:20 AM
Wireless - Wired bridge while still being usable? Other network questions too.... etherag Linux - Wireless Networking 6 08-27-2004 09:37 AM
do i have to bridge a wireless and wired connection on the same linux box ulto Linux - Wireless Networking 2 04-07-2004 12:37 PM
Do you need to switch between wireless and wired interfaces? Wanna monitor cpufreq? ming0 Linux - Laptop and Netbook 0 01-31-2004 02:06 AM
Wired/Wireless Bridge MMHein Linux - Wireless Networking 2 10-07-2003 01:44 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Debian

All times are GMT -5. The time now is 04:59 PM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration