2

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.

0

2 Answers 2

3

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.

1
  • Where to put this to get everything working on boot? Commented Mar 22, 2016 at 15:13
0

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

0

You must log in to answer this question.

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