FS#10110 - netcfg support auto switch between different static route
Attached to Project:
Arch Linux
Opened by Daniel YC Lin (dlin) - Monday, 07 April 2008, 23:04 GMT
Last edited by James Rayner (iphitus) - Monday, 16 February 2009, 10:59 GMT
Opened by Daniel YC Lin (dlin) - Monday, 07 April 2008, 23:04 GMT
Last edited by James Rayner (iphitus) - Monday, 16 February 2009, 10:59 GMT
|
Details
Summary and Info: I need to change static route from home to
office, I've written a script to solve this problem, please
help to merge into netcfg
Steps to Reproduce: 1. put following line in /etc/rc.d and there already exist /etc/network.d/{office,home,dhcp} NETWORKS=(auto-ip office,home,dhcp) 2. add the following script /usr/bin/netcfg-auto-ip #! /bin/bash # autoconnect one of static ip # usage: netcfg-auto-ip <network_profiles> # eg. netcfg-auto-ip office,home if [[ $# -ne 1 ]]; then err "Please supply multiple profile name separated by comma" exit 1 fi networks=$(echo $1 | sed 's|,| |g') for network in $networks ; do echo "Try: $network" if ! /usr/bin/netcfg2 -c $network ; then echo "$network already been started" exit 0 fi card=$(grep '^INTERFACE' /etc/network.d/$network | awk -F= '{print $2}') gate=$(route -n | grep $card | grep UG | awk '{print $2}') echo "pinging gateway $gate" if ping -q -c1 -W1 $gate > /dev/null ; then exit 0 fi echo "ping $network's gateway $gate failed" /usr/bin/netcfg2 -d $network done exit 1 # vim: set ts=2 noet: |
This task depends upon
So it would work sort of like this:
NETWORKS=(... "auto-wireless <interface> <wifi1>,<wifi2>,<wifi3>" ..)
Just my 0.02€ :)
For example "netcfg-migrateroute" and have it set to depend on netcfg. If it's popular enough I'll bring it into the repositories.