Last active
June 8, 2018 17:15
-
-
Save artburkart/9a3b0571ce9a41fc468dd97821cb5ce4 to your computer and use it in GitHub Desktop.
Revisions
-
artburkart revised this gist
Jun 8, 2018 . 1 changed file with 2 additions and 9 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -16,16 +16,9 @@ # 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 -
artburkart created this gist
Jun 8, 2018 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,31 @@ #!/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 # } 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 GATEWAY1="$GW advmss 1380" NETMASK1=255.255.255.192 ADDRESS1=10.20.101.64 GATEWAY2="$GW advmss 1380" NETMASK2=255.255.255.192 ADDRESS2=10.20.101.128