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
Task Type Feature Request
Category System
Status Closed
Assigned To James Rayner (iphitus)
Architecture All
Severity Medium
Priority Normal
Reported Version 2007.08-2
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 1
Private No

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

Closed by  James Rayner (iphitus)
Monday, 16 February 2009, 10:59 GMT
Reason for closing:  Deferred
Comment by Dan McGee (toofishes) - Tuesday, 08 April 2008, 00:39 GMT
*PLEASE* file bugs under the right project.
Comment by Tomas Groth (tgc) - Tuesday, 15 April 2008, 13:02 GMT
Couldn't this be done by making auto-wireless accept more arguments?
So it would work sort of like this:
NETWORKS=(... "auto-wireless <interface> <wifi1>,<wifi2>,<wifi3>" ..)

Just my 0.02€ :)
Comment by James Rayner (iphitus) - Friday, 23 May 2008, 12:55 GMT
the current autowireless is crap. Im redoing it.
Comment by James Rayner (iphitus) - Wednesday, 25 June 2008, 12:30 GMT
I'll look at merging this in a future release, this is a desirable feature.
Comment by James Rayner (iphitus) - Monday, 16 February 2009, 10:59 GMT
Please package this as a third party package on the AUR,

For example "netcfg-migrateroute" and have it set to depend on netcfg. If it's popular enough I'll bring it into the repositories.

Loading...