I'm in the middle of setting up my Raspberry Pi running Raspbian as a bridge between my university's wireless network (which requires WPA2-Enterprise authentication) and my private wireless router (via its WAN port).

I've received some amazing help here: How can I most simply transparently bridge traffic between wlan0 and eth0?

For the most part my setup is now working as intended. The only problem is that, if I set eth0 to auto or allow-hotplug on my Raspberry Pi (as I'd like to do, so that everything comes up headlessly on boot), it seems as though all internet traffic is routed through eth0. This is incorrect; my internet connection is on wlan0, and eth0 shares that connection out to my private router.

I can overcome this issue by not having eth0 come up automatically. If I leave auto or allow-hotplug for eth0 out of /etc/network/interfaces, allow the Raspberry Pi to boot, and then manually run "ifup eth0", I get behaviour as expected.

Is there a way to either ensure that wlan0 has been fully brought up before bringing up eth0 on boot (even though eth0 is the faster interface to bring up)? Or, failing that, how can I force internet traffic (noting that this comes from eth0) through wlan0 only?

Edit: For now, as a work-around, I'm running a script to bring up eth0 on start-up with a thirty second delay to allow wlan0 to come up first. This solution is neither elegant nor reliable (what if wlan0 authentication takes longer than thirty seconds?), but it does seem to be doing the trick for now. I'm still looking for a better solution, though!

  • 1
    Since it sounds like you're using DHCP on both interfaces, the proper solution would be to configure the DHCP client so that it does not use the gateway advertised in the DHCP offer. Any other solution will be unreliable. I do not know how raspbian configures its network though, so I can't tell you how to do this.
    – phemmer
    Aug 20, 2014 at 22:51
  • wlan0 is on DCHP, and is assigned by my university's network. eth0 (talking to my private router) is statically assigned (by me).
    – snoopy91
    Aug 20, 2014 at 22:53
  • It's still a bit of a hack/kludge, but can you modify your script to loop, trying to ping something that's accessible through the wlan0 network, and then bring up eth0 only after the ping succeeds (indicating that wlan0 is up)? Aug 4, 2015 at 3:25

2 Answers 2


Hmm.. Just a thought. But, I do assume your using DHCP on your Wi-Fi network. Therefore, you wouldn't have an IP address until your network is fully up.

So, let's just have a little while loop.

while [ "$(ifconfig wlan0 | grep inet | grep 192.168.)" = "" ];  do sleep 1; done

The 192.168. should be replaced with your standard range. Now it would check every second once if you're already having a connection and as soon as you're having a connection via wifi you can follow up directly with ifup eth0



  • In your static setup for eth0 do not set a default gateway. (I think this is the real problem)
  • add a hook to the dhcp client configuration to bring the other interface up after successful configuration.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .