Skip to content

Instantly share code, notes, and snippets.

@cpthooch
Last active April 4, 2023 11:19
Show Gist options
  • Select an option

  • Save cpthooch/706943dfe9a62771f4c3ab5adecf2b5b to your computer and use it in GitHub Desktop.

Select an option

Save cpthooch/706943dfe9a62771f4c3ab5adecf2b5b to your computer and use it in GitHub Desktop.

Revisions

  1. cpthooch revised this gist Aug 21, 2017. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions route_wifi.sh
    Original file line number Diff line number Diff line change
    @@ -3,8 +3,8 @@
    # NOTE: wifi network interface is: en1
    wifi_router=192.168.200.1
    wifi_address=en1:ec.35.86.4f.00.bc
    export TOADDR=`ifconfig en1 inet | sed -nl 's/\w*inet \([^ ]*\).*/\1/p'`
    export TO=`echo -n ${TOADDR//[[:space:]]}`
    TOADDR=`ifconfig en1 inet | sed -nl 's/\w*inet \([^ ]*\).*/\1/p'`
    TO=`echo -n ${TOADDR//[[:space:]]}`

    echo "ADDING ROUTE TO $1 VIA en1 (wi-fi): $TO"
    route -n add -host $1 $wifi_router -ifp $wifi_address -ifa $TO -static
  2. cpthooch created this gist Aug 21, 2017.
    14 changes: 14 additions & 0 deletions route_wifi.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,14 @@
    #!/bin/bash

    # NOTE: wifi network interface is: en1
    wifi_router=192.168.200.1
    wifi_address=en1:ec.35.86.4f.00.bc
    export TOADDR=`ifconfig en1 inet | sed -nl 's/\w*inet \([^ ]*\).*/\1/p'`
    export TO=`echo -n ${TOADDR//[[:space:]]}`

    echo "ADDING ROUTE TO $1 VIA en1 (wi-fi): $TO"
    route -n add -host $1 $wifi_router -ifp $wifi_address -ifa $TO -static

    echo ""
    echo "ROUTE ADDED:"
    route get $1