Last active
June 8, 2018 17:15
-
-
Save artburkart/9a3b0571ce9a41fc468dd97821cb5ce4 to your computer and use it in GitHub Desktop.
Persisting advmss across reboots
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 | |
# This takes advantage of the code in /etc/sysconfig/network-scripts/ifup-routes | |
# handle_file () { | |
# . $1 | |
# routenum=0 | |
# while [ "x$(eval echo '$'ADDRESS$routenum)x" != "xx" ]; do | |
# eval $(ipcalc -p $(eval echo '$'ADDRESS$routenum) $(eval echo '$'NETMASK$routenum)) | |
# line="$(eval echo '$'ADDRESS$routenum)/$PREFIX" | |
# if [ "x$(eval echo '$'GATEWAY$routenum)x" != "xx" ]; then | |
# line="$line via $(eval echo '$'GATEWAY$routenum)" | |
# fi | |
# line="$line dev $2" | |
# /sbin/ip route add $line | |
# routenum=$(($routenum+1)) | |
# done | |
# } | |
# NOTE: Only do this if you're not using DHCP for some reason | |
GW="$(ip route show 0.0.0.0/0 dev eth0 | cut -d\ -f3)" | |
GATEWAY0="$GW advmss 1380" | |
NETMASK0=255.255.255.192 | |
ADDRESS0=10.20.101.0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment