Quick and Dirty WiFi-Ethernet Bridge - Arch Linux - ASUS Router and Apple Airport Extreme

I have a bunch of ethernet only gadgets in the Home Theater rack including the Emotiva XMC, my Tatasky Set Top Box and a couple of other knick knacks. The HT rack is across the room from my router (ASUS RT-AC68U) and the only way to connect up these machines to the network was to run an ethernet cable from the router across to the rack and then use the airport extreme to connect up all the doodahs to wifi.

I wanted to originally use the Airport Extreme to extend the wifi network but being an Apple device, it refused to work with the ASUS router. Tried WDS and an old version of the airport utility to see if I could hack that set up but no joy.

Then I realised that the HTPC has both a wired and wifi connection. So I hooked up the wired connection to the airport extreme's "wan/uplink" port. Now we need to set up the HTPC box (running Arch Linux) to "bridge" the wifi and ethernet connections.

We could use the bridge-utils tools to do this but I thought it was too much of a hassle adapting the instructions for bridge-utils (https://wiki.debian.org/BridgeNetworkConnections) to the Arch way of doing networking. I also have a weird connman setup to manage the wifi connection. So I thought I will do this with proxy arp so that everything would be transparent on the wifi side as well as on the wired side.

First thing is to grab parprouted (Parprouted) which automates the adding and removal of static routes on the HTPC box(bridge). Extract the tarball and do a "make all" and "make install". This will put the parprouted binary into the /usr/local hierarchy

parprouted will take care of the proxy arp but not the DHCP broadcasts as well as Avahi/Bonjour stuff that some of the doodahs use/need. So we need to set up a dhcp relay to forward DHCP requests between the networks and also enable reflection for the avahi-daemon.

The dhcp-helper app mentioned in the the Debian Wiki seems to be hard to find, so I looked for an alternate relay and found the ISC dhcrelay command which does the same thing and is part of the dhcpd package for Arch.

So, to make sure things are working:
  1. Ensure that both the wired and wifi connections are up and running. They should both have an IP address. To make life easier, assign a static IP to the wired interface.
  2. My wired interface is enp0s25 and my wifi interface is wlp2s0
  3. Start parprouted in debug mode so that we can make sure all is well
    1. #sudo parprouted -d wlp2s0 enp0s25
    2. In another terminal / shell session
      1. #sudo dhcrelay <ip-of-dhcp-server> -i wlp2s0 -i enp0s25 -d
    3. Now connect to the Airport Extreme with Airport utility
      1. Turn off wireless in the Wireless tab
      2. Set the Airport Extreme to Bridge Mode (No routing)
      3. In the Internet tab-> set the connection to DHCP and Press the renew button
      4. The Airport Extreme should now get an IP on the wifi network
    4. You should see bootrequest and bootreply messages in the terminal where you have dhcrelay running and routes being added / arp requests in the parprouted session
    5. Connect up another pc/device to one of the ethernet ports on the Airport and check that it has connectivity to the router
    6. Now we are all set
  4. Kill the parprouted and dhcrelay sessions (killall parprouted;killall dhcrelay)
  5. Set both these daemons to startup in an rc.local script but skip the "-d" option so that they run as daemons
  6. As a last step, go to /etc/avahi/avahi-daemon.conf and set the enable-reflector option to yes
  7. You will need to reload the avahi daemon
That's all it took :-) 

You will have to wait approximately 40 seconds for the arp tables to sync and everything to start working from the time you start parprouted. If you are seeing messages about packet being dropped because it doesn't have an IP address or unable to send packets on the wired interface, it is most likely due to some funkiness from connman or netctl dropping the ip address or setting the link down. The best bet is to manually set the link up and ensure that both interfaces have an ip address before starting parprouted.

After this change, the XMC-1 is not showing up on the XMC Remote app for android. This is likely due to some problems with UDP routing across the networks and the broadcasts not traversing the wifi and ethernet networks. I will see if I can get this working with some routing changes but that's another story for another time.

Comments

Popular posts from this blog

Android File Transfer and Samsung SmartSwitch Conflict

HTPC Experiments - Part 3