I have a cable modem connected to a WiFi router. I have the router configured to serve DHCP. Due to the layout of my house, I cannot physically connect my home wired LAN to the router. I was hoping that I would use a Raspberry Pi with a WiFi dongle and ethernet to act as a bridge between the wired network, the wireless network, and the router.

Some goals:

  1. Wireless and wired devices can connect to each other.
  2. Wireless and wired devices can see the internet.
  3. All devices get their IP addresses over DHCP from the router.
  4. The proper configuration comes up automatically after a reboot.

My fundamental question is how do I configure my equipment to achieve these goals?

I have bridge-utils installed and running on the Raspberry Pi. If I enable the bridge in /etc/network/interfaces then the Raspberry Pi looks in vain for a DHCP server and gets no IP address. If I disable the bridge, then the Raspberry Pi gets a DHCP response from the router without trouble, gets an IP address, and can reach the Internet.

Also on the wired LAN is a Synology DiskStation, which can serve DHCP, so I'm happy to enable that if it would help. But then I would have two DHCP servers, so I might need to have two subnets and some routing between them. I'd like to keep things simpler if possible.

Here's my /etc/network/interfaces file:

auto lo
iface lo inet loopback

auto eth0
iface eth0 inet dhcp

auto wlan0
allow-hotplug wlan0
iface wlan0 inet dhcp
        wpa-ssid "MySSID"
        wps-psk "MyPassword"

auto br0
iface br0 inet manual
        pre-up iwconfig wlan0 essid "MySSID"
        bridge_hw 12:34:56:78:90:ab
        bridge_ports wlan0 eth0
        bridge_stp off
        bridge_maxwait 5
        bridge_fd 0

The bridge_hw line includes the MAC address of my WiFi dongle on the Raspberry Pi. I also tried a br0 stanza like this (found here), but it also didn't work:

auto br0
iface br0 inet dhcp
  pre-up ip link set eth0 down
  pre-up ip link set wlan0 down
  pre-up brctl addbr br0
  pre-up brctl addif br0 eth0 wlan0
  pre-up ip addr flush dev eth0
  pre-up ip addr flush dev wlan0

I have enabled net.ipv4.ip_forward in /etc/sysctl.conf, but it didn't seem to help. I've looked in syslog, but nothing there pointed to an obvious problem.

I've read a lot about bridging, DHCP, parprouted, dhcrelay, /etc/network/interfaces and iwconfig, but it is not clear to me how to configure my system so that wlan0 comes up first on the Raspberry Pi, gets DHCP info from the router, then the bridge comes up, then eth0 comes up on the Raspberry Pi, gets its DHCP over the bridge, and then other wired devices can too, and wireless devices can see the wired devices. I'm happy to switch to static IPs on the Raspberry Pi if that would help.

  • Do you have to use the RPi? On some wireless routers, this (wireless bridge mode) is not difficult to configure. Instead of using /etc/network/interfaces, have you tried a script to execute in sequence: (1) wlan0 startup, then (2) get an IP address from the DHCP server, (3) run brctl addif br0 eth0 wlan0, and finally (4) configure eth0?
    – sawdust
    Jan 11, 2016 at 1:52
  • The equipment I currently have is the RPi and my router. I think to do what you suggest (use a router instead of the RPi), I'd have to get another router. If it comes to that, I'll do it, but I thought this would be a good use of my RPi. Regarding your other suggestion, I'll give that a try. Jan 11, 2016 at 5:21
  • Do I understand it right that you want to connect the RPi to the router via wifi, and to your other components via ethernet? Jan 11, 2016 at 7:21
  • Yes, @MariusMatutiae. That's pretty much it. Jan 11, 2016 at 16:30

1 Answer 1


You cannot easily bridge a wifi interface, see here for a good explanation. There are ways around it (VirtualBox for instance does that out of the box), and I will show you one way of doing this.

If you cannot bridge wlan0 an eth0, you can relay IP traffic between them by means of ip_forward, but this leaves out two important kinds of traffic, DHCP (which uses raw sockets) and ARP (which is a Layer-2 protocol, hence it is not covered by ip-forward). We go around the first problem by setting up our own DHCP server answering queries on interface eth0 only; for this to work, we must make sure that the ranges of IP addresses dished out by your router and by dnmasq on the RPi do not overlap. We circumvent the ARP problem by enabling proxy-arp.

The simplest thing is to neglect both parprouted and dhcrelay, which introduce unnecessary complications. We shall use instead proxy-arp.

  1. Select a subnet within your LAN which your router does not use for assigning IP addresses, say,, and assign its first address, to your eth0 interface:

    ip addr add dev eth0
  2. Tell the kernel this subnet is to be found on the eth0 interface:

    ip route add dev eth0
  3. Enable proxy-arp and ip_forwarding:

    echo 1 > /proc/sys/net/ipv4/conf/eth0/proxy_arp
    echo 1 > /proc/sys/net/ipv4/conf/wlan0/proxy_arp
    echo 1 > /proc/sys/net/ipv4/ip_forward 
  4. Download and install dnsmasq to perform DHCP on the eth0 interface:

    apt-get install dnsmasq

    and then create a file, /etc/dnsmasq.conf, with the following content:

  5. Restart dnsmasq, you are done.

It should be trivial to start all of the above at boot, if not, let me know.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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