Skip to content

Instantly share code, notes, and snippets.

@artburkart
Last active June 8, 2018 17:15
Show Gist options
  • Select an option

  • Save artburkart/9a3b0571ce9a41fc468dd97821cb5ce4 to your computer and use it in GitHub Desktop.

Select an option

Save artburkart/9a3b0571ce9a41fc468dd97821cb5ce4 to your computer and use it in GitHub Desktop.

Revisions

  1. artburkart revised this gist Jun 8, 2018. 1 changed file with 2 additions and 9 deletions.
    11 changes: 2 additions & 9 deletions route-eth0
    Original 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

    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
    ADDRESS0=10.20.101.0
  2. artburkart created this gist Jun 8, 2018.
    31 changes: 31 additions & 0 deletions route-eth0
    Original 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