Monday, 24 December 2018

Share internet with Sky box (not Q) over ethernet from raspberry pi connected to internet via WLAN0.

Moved house. Have old sky box with no WiFi.
Raspberry pi USB WiFi cost couple of bucks just besides sky box able to access internet.

So aim is to share the internet with Sky box. So connected the Sky box to Pi with ethernet cable.

On Raspberry pi:

  • Edit /etc/dhcpcd.conf to add following. IP address for WLAN0 is not one of the following.


interface eth0
static ip_address=192.168.2.1
static routers=192.168.2.255
static domain_name_servers=8.8.8.8

  • Install dnsmasq. Edit /etc/dnsmasq.conf to add the following lines.

interface=eth0 # Use interface eth0 
listen-address=192.168.2.1 # listen on 
# Bind to the interface to make sure we aren't sending things
# elsewhere 
bind-interfaces 
server=8.8.8.8 # Forward DNS requests to Google DNS domain-needed # Don't forward short names # Never forward addresses in the non-routed address spaces. 
bogus-priv
# Assign IP addresses between 192.168.2.2 and 192.168.2.100 with a # 12 hour lease time 
dhcp-range=192.168.2.2,192.168.2.100,12h


  • Edit /etc/sysctl.conf to forward ipv4.
  • Restart. Make sure the WLAN0 interface has the ip address from the configured IP range.
  • Forward the ports.
sudo iptables -t nat -A POSTROUTING -o wlan0 -j MASQUERADE
sudo iptables -A FORWARD -i wlan0 -o eth0 -m state --state RELATED,ESTABLISHED -j ACCEPT
sudo iptables -A FORWARD -i eth0 -o wlan0 -j ACCEPT

  • Restart