Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have hostapd and dnsmasq installed for distributing my wireless network with a WiFi dongle, and everything is working well. I am also able to connect an ethernet cable and get DHCP, plus internet access, from a router.

Is there a way to bridge the internet connection from eth0 to my dynamically configured wlan0? So it becomes possible to connect with wifi and surf the net, like a router.

I am running Ubuntu, on a beaglebone black.

share|improve this question

2 Answers 2

In Debian and relatives, before starting hostapd, you need to do the following:

  sudo service network-manager stop
  sudo ifconfig eth0 down 
  sudo ifconfig eth0 0.0.0.0 promisc up
  sudo brctl addbr br0
  sudo brctl addif br0 eth0
  sudo dhclient br0 

Then, add the following line to /etc/hostapd/hostapd.conf:

  bridge=br0

hostapd will add itself to the bridge, you just need to tell it to do so and the name of the bridge.

Now you can start hostapd, without DHCP nor dnsmasq, of course. This is because by bridging wifi and ethernet, your wifi clients will be able to ask your router directly for an IP address, so there is no need of the whole shebang of DHCP/dnsmasq on the wireless interface.

If you need info for a systemd distro, just say so.

share|improve this answer

If the IP addresses for the wireless clients are in the same range as the dynamic address of the PC with the ethernet card, perhaps simply enabling IP forwarding could be all you need:

echo 1 > /proc/sys/net/ipv4/ip_forward

If the IP range of the wireless clients should be shielded somehow, you'll need to configure NAT. You can find some more detailed information here

share|improve this answer
    
Thank you very much for this post! Solved my problem! –  user3142264 Dec 29 '13 at 20:08

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.