Skip to content

Instantly share code, notes, and snippets.

@arnehormann
Last active October 11, 2015 15:28
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 arnehormann/3880088 to your computer and use it in GitHub Desktop.
Save arnehormann/3880088 to your computer and use it in GitHub Desktop.
iproute2 example
# For these...
HOST="1.2.3.4/24"
NET="1.2.3.0/24"
GATEWAY_IP="1.2.3.1"
# Set a static IP
ip addr add $HOST dev eth0
ip route add $NET via $GATEWAY_IP
ip link set eth0 up
@arnehormann
Copy link
Author

get current ipv4: ip -4 -o addr show dev eth0 | sed 's|.*inet \([^/]*\).*|\1|'

@arnehormann
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment