Tag Archives: Wireless network interface card

Wireless bridge again


Official Ubuntu circle with wordmark. Replace ...
Image via Wikipedia

Can confirm that I need both commands:

/etc/init.d/hostapd restart

iwconfig wlan0 mode master

to get my wired to wireless bridge to come back up on my Ubuntu box.

Not quite sure why as obviously the hostapd service comes up on boot and the /etc/network/interfaces file has that exact mode setting line. But the bridge comes up with the wireless card disabled and while the mode setting line will enable it, it requires the hostapd restart to work.

Anyway, the fact I know what to do means it is easy to restore the network to full capacity, but it would be nice if it worked off-the-bat.

Wireless bridge, update


Tux, the Linux penguin
Image via Wikipedia

The wlan0 <–> eth0 ethernet bridge I have on my server now essentially works well, apart from a few issues.

The most serious seems to be that the wireless card will suddenly stop working – in the sense of disassociating and then refusing to re-associate. The first time it did this it took 10 days, the second about three: I think this is a known problem – as I read about it when I was tearing my hair out about how to set the thing up, though I cannot find a reference to it now – will keep on searching.

The other is a less serious problem – as I know how to fix it. When the machine comes up the wireless part of the bridge is disabled but can be restarted with:

/etc/init.d/hostapd restart
iwconfig wlan0 mode master

I am not even sure the restart is needed – but I know the combo works.

Here’s the relevant bits of the /etc/network/interfaces file:


# The loopback network interface
auto lo eth0 wlan0

iface eth0 inet manual
iface wlan0 inet static
address 192.168.62.2

auto br0
iface br0 inet dhcp
bridge_ports eth0 wlan0
bridge_stp on
/sbin/iwconfig wlan0 essid myssid &amp;&amp; \
/sbin/iwconfig wlan0 channel 1 &amp;&amp; \
/sbin/iwconfig wlan0 mode master

Using old Prism 2 card for the wireless bridge


So, I have taken the Belkin RT2500 card out and replaced it with a decade old DLink DWL-650 (a locked down PCMCIA <–> PCI bridge) – this has a Prism chipset and so should work. But right now I cannot even get the wireless card to come up, never mind bridge it…

adrian@dragoneye:~$ sudo hostapd -ddd /etc/hostapd/hostapd.conf
[sudo] password for adrian:
Configuration file: /etc/hostapd/hostapd.conf
Failed to create interface mon.wlan1.
nl80211 driver initialization failed.
wlan1: Unable to setup interface.

 

More as I get it…

Wired to wireless bridge in Ubuntu Linux


Update: This – https://cartesianproduct.wordpress.com/2012/12/22/raspberry-pi-as-an-ethernet-to-wifi-bridge/ – is a more recent article about how bridge a Debian-like system. I would start from there!

Visualization of the various routes through a ...
Image via Wikipedia

My triumph of the day has been to set up a bridged connection between a wireless card and a wired internet connection – substantially improving the coverage afforded by my wireless network.

Doing this proved to be rather more hard going than I thought it would be (or indeed it should have been) so I am going to write this blog in the hope that it helps someone later to not make the same mistakes – even it does reveal me as being a bit silly.

Why a bridge

A bridge transparently joins two sections (segments) of network together – in fact most consumer routers (switches) have bridge-like characteristics – allow networks to look like they are seamlessly joined together in one big segment when in fact packets are only being forwarded to bits of the network that might need them (so reducing collisions and increasing network throughput).

In my case I had a PC which had a wired network connection and an idle wireless card – and as it was in a corner of the house where wireless coverage is poor it seemed like a good idea to activate the wireless card.

Using a bridge as opposed to turning the PC into a router was the better option because it meant all the boxes could be on the same subnet and allows laptops to be moved around while maintaining the same IP address and I only needed one DHCP daemon on the network – but I didn’t fully understand that until this morning – and I went so far as to set up a DHCP daemon on the box.

When a wireless box seeks a DHCP connection it broadcasts the request – the bridge transparently passes that on through the network and so there is no need to set up a second DHCP daemon, the existing one will send the reply packets back to the bridge which will then pass them on (if required) via the wireless link.

How to do it

First of all get the wireless card working with hostap – you can download the “hostap” package from Synaptic – but you have to do some setup – configuring a hostapd.conf. This is mine (some details changed for security reasons) – and, yes, I know WEP gives very little security:

interface=wlan0
bridge=br0
driver=nl80211
auth_algs=1
macaddr_acl=0
ignore_broadcast_ssid=0
logger_syslog=-1
logger_syslog_level=0
hw_mode=g
ssid=My_SSID
channel=11
wep_default_key=0
wep_key0=0000000000
wpa=0

This lives in /etc/hostap/hostapd.conf and you also have to edit /etc/default/hostapd so that it knows where the config file is.

Starting the daemon (eg sudo /etc/init.d/hostapd start) sets the card in “master” mode, so it can drive an infrastructure network (ie just like your router/switch) but until you turn the bridging on, it is of no use.

To do that you can edit your /etc/network/interfaces file – adding lines like these at the end:

auto br0
iface br0 inet dhcp
bridge-ports eth0 wlan0

Then rebooting your machine or typing “sudo ifup br0″ should bring the bridge up…