Configure Network Interface Bridge from WiFi to Ethernet on Debian

bridgedebianethernetwifi

I am using Raspberry Pi using Raspbian which is just Debian.

I would like to bridge from the primary WiFi network router that connects to Cox Cable to my cabled router here for my subnet to have reliable internet access.

It needs to be a WiFi-to-Ethernet bridge.

I have set /etc/networks for a static address for the USB wlan1 with the external adapter and hi-gain antenna. wpa_supplicant is configured to log in to the master router properly.

So right now it is set up so I can login to the proper network with the password, on external wlan1. Static address is set in /etc/networks. Gateway and nameserver are OK. I can browse web pages, etc.

The missing link is to bridge this to the eth0 port so my router can connect also, to provide service to my subnet.

No need for any extra network services like routing or nat or dhcp, etc. Just a simple bridge.

Can anyone please point me in the right direction to make this happen?

Best Answer

For configuring a bridge from ethernet to wifi, it is as simple as doing in your /etc/network/interfaces:

auto eth0
allow-hotplug eth0
iface eth0 inet manual

auto wlan0
allow-hotplug wlan0
iface wlan0 inet manual

auto br0
iface br0 inet static
bridge_ports eth0 wlan0
    address 192.168.1.100
    netmask 255.255.255.0

Replace the IP address with something more appropriate to your network.

If you prefer the IP attribution done via DHCP, change it to:

auto br0
iface br0 inet dhcp
bridge_ports eth0 wlan0

After changing /etc/network/interfaces, either restarting Debian or doing

service networking restart

Will activate this configuration.

You will have to make sure for this configuration to have bridge-utils installed. You can install it with:

sudo apt install bridge-utils

For more information, see:

BRIDGE-UTILS-INTERFACES

The wlan0 interface also has to be condigured to connect to your remote AP so this configuration is not be used verbatim.

Additional note: bridging eth0 and wlan0 together means in poor layman´s terms that br0 will present itself as a single logical interface englobing the interfaces that make part of the bridge. Usually such configuration is made when both extend or belong to the same network.

Related Question