Feature #331
Not able to bridge wired and wireless network
| Status: | Closed | Start date: | 03/18/2010 | |
|---|---|---|---|---|
| Priority: | Normal | Due date: | ||
| Assignee: | - | % Done: | 0% |
|
| Category: | - | |||
| Target version: | - |
Description
Hi,
I have connected my laptop running alpine linux to internet using my wired connection (eth0). On my wireless connection (wlan0), I have created an ad-hoc network and I have also configured a dhcp server. Other clients are able to connect to this ad-hoc network and they get assigned with a IP by the dhcp server. Till now, everything is good.
I am trying to share the internet connection on my wired network with the ad-hoc network by bridging the two networks. Alpine linux's bridgeutils package installs with no problems. To enable bridging, I tried two approaches:
Approach 1:
brctl addbr br0
brctl addif br0 eth0
brctl addif br0 wlan0
The command "brctl show" shows that both the networks are in the bridge; but the bridge does not get enabled. In fact, after doing brctl addif br0 eth0, my laptop itself loses its internet connection.
Approach 2:
add br0 device using "brctl addbr br0"
modify /etc/network/interfaces to
auto wlan0
iface wlan0 inet static
address 192.168.1.20
netmask 255.255.255.0
wireless-mode ad-hoc
wireless-essid alpineadhoc
wireless-key 1212312345
auto br0
iface br0 inet static
address 192.168.1.21
netmast 255.255.255.0
bridge-ports eth0 wlan0
restart networking
The networking restarts with no errors in the system log.
eth0 gets connected to the subnet 192.168.1.X (which is assigned by my router). But in this case too, my laptop loses internet connectivity after the network is restarted. The mesh-network is up and clients are still able to connect to the mesh network. They are able to ping both wlan0 and br0. But the bridging does't work.
I have tried searching online, but I could only find that many other users have faced the same problem. I have done this kind of internet sharing in windows (which was very easy) and I guess there would be some way to do it in linux too.
Any suggestions / help from your side would be very useful to us.
Thanks.
History
Updated by Natanael Copa almost 2 years ago
generally, do not assign ip address to bridged interfaces but the bridge itself. second, please remember to bring the bridged interface up (ip link set dev eth0 up), third, i dont think the busybox ifup/ifdown support the "wireless-*" keywords, so you'll have to use "up iwconfig ...."
So, something like this should work:
auto br0 iface br0 inet static pre-up ip link set dev eth0 up pre-up ip link set dev wlan0 up pre-up iwconfig wlan0 mode adhoc pre-up iwconfig wlan0 essid alpineadhoc pre-up iwconfig wlan0 key 1212312345 pre-up brctl addbr br0 pre-up brctl addif br0 eth0 pre-up brctl addif br0 wlan0 address 192.168.1.21 netmask 255.255.255.0 down brctl delbr br0