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:
- Wireless and wired devices can connect to each other.
- Wireless and wired devices can see the internet.
- All devices get their IP addresses over DHCP from the router.
- 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.