Created
November 4, 2016 11:15
-
-
Save tompreston/d5053c5553ce02a2b4627892fe7d266c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Enable IP Forwarding | |
# Run this, then route packets on device with: | |
# | |
# ip route add default via THIS_DEVICE_IP | |
# | |
OUT_IFACE=enp0s25 | |
IN_IFACE=enx00249b1ad5b2 | |
IPTABLES=/sbin/iptables | |
# setup iptables | |
$IPTABLES --flush -t nat | |
$IPTABLES --table nat --append POSTROUTING --out-interface $OUT_IFACE -j MASQUERADE | |
$IPTABLES --append FORWARD --in-interface $IN_IFACE -j ACCEPT | |
# turn on ip forwarding | |
echo 1 > /proc/sys/net/ipv4/ip_forward | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment