How to get bridge internet connection to wlan0 from eth0?

11,334

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:
11,334

Related videos on Youtube

user3142264
Author by

user3142264

Updated on September 18, 2022

Comments

  • user3142264
    user3142264 over 1 year

    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.

  • Dirk Gorissen
    Dirk Gorissen about 8 years
    Where to put this to get everything working on boot?