Last active
October 11, 2015 15:28
-
-
Save arnehormann/3880088 to your computer and use it in GitHub Desktop.
iproute2 example
This file contains hidden or 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
# 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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
get current ipv4:
ip -4 -o addr show dev eth0 | sed 's|.*inet \([^/]*\).*|\1|'