Skip to content

Instantly share code, notes, and snippets.

@ly0
Created June 15, 2018 19:15
Show Gist options
  • Save ly0/8c9e9e3dc7ececc6ca9e12fa6ce30d5e to your computer and use it in GitHub Desktop.
Save ly0/8c9e9e3dc7ececc6ca9e12fa6ce30d5e to your computer and use it in GitHub Desktop.
raspberry connect internet through USB0
  1. Get a static IP vi /etc/network/interfaces
allow-hotplug usb0
iface usb0 inet static
        address 192.168.7.2
        netmask 255.255.255.0
        network 192.168.7.0
        broadcast 192.168.7.255
        gateway 192.168.7.1
  1. set IPV4 FORWARD
sudo iptables -I FORWARD -s 192.168.7.0/24 -j ACCEPT
sudo iptables -I FORWARD -o 192.168.7.0/24 -j ACCEPT
sudo iptables -t nat -I POSTROUTING -o eno1 -s 192.168.7.0/24 -j MASQUERADE
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment