Skip to content

Latest commit

 

History

History
74 lines (59 loc) · 1.6 KB

README.md

File metadata and controls

74 lines (59 loc) · 1.6 KB

WiFi Bridge

I'm using this on a raspberry pi 3 running Ubuntu server to bridge an Ethernet-only OpenSprinker to my WiFi network.

Install

sudo apt install parprouted dhcp-helper avahi-daemon net-tools

/etc/netplan/60-wifi-bridge.yaml:

network:
  version: 2
  ethernets:
    renderer: networkd
    eth0:
      optional: true
      dhcp4: false

/etc/sysctl.d/local.conf:

net.ipv4.ip_forward=1

/etc/networkd-dispatcher/routable.d/50-wifi-bridge:

#!/bin/sh

if [ "$IFACE" = "wlan0" ]; then
  /sbin/ip link set wlan0 promisc on
  /sbin/ip addr add $(/sbin/ip addr show wlan0 | perl -wne 'm|^\s+inet (.*)/| && print $1')/32 dev eth0
  /usr/sbin/parprouted eth0 wlan0
fi

/etc/networkd-dispatcher/off.d/50-wifi-bridge:

#!/bin/sh

if [ "$IFACE" = "wlan0" ]; then
  /usr/bin/killall /usr/sbin/parprouted
  /sbin/ip link set eth0 down
fi

Edit /etc/default/dhcp-helper:

# relay dhcp requests as broadcast to wlan0
DHCPHELPER_OPTS="-b wlan0"

Edit /etc/avahi/avahi-daemon.conf:

[reflector]
enable-reflector=yes

Enable services:

sudo systemctl enable dhcp-helper --now

Reboot!

References

Inspired by: https://gist.github.com/Jiab77/76000284f8200da5019a232854421564