Skip to content

Instantly share code, notes, and snippets.

@telmotrooper
Created May 26, 2018 19:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save telmotrooper/6559945c5bb624b38e7c4f7733fb8f5e to your computer and use it in GitHub Desktop.
Save telmotrooper/6559945c5bb624b38e7c4f7733fb8f5e to your computer and use it in GitHub Desktop.
Share your Wi-Fi connectiong through cable
# Based on tutorial at:
# https://null-byte.wonderhowto.com/how-to/share-your-laptops-wireless-internet-with-ethernet-devices-0130528/
# Bring your ethernet interface up and assign an IP to it
sudo ifconfig enp7s0 up
sudo ifconfig enp7s0 192.168.2.1
# Enable IPv4 forwarding
sudo echo "1" | sudo tee /proc/sys/net/ipv4/ip_forward
# Forward traffic to 192.168.2.* IP range
sudo iptables -t nat -A POSTROUTING -o wlp6s0 -s 192.168.2.0/24 -j MASQUERADE
echo "On your guest device use:"
echo "Address: 192.168.2.2 (or any other in this range)"
echo "Netmask: 255.255.255.0"
echo "Gateway: 192.168.2.1"
echo "DNS: 8.8.8.8 (from Google)"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment