NetBSD-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Require reboot after changing network settings?

On Fri, Mar 16, 2012 at 05:40:11PM +0530, Mayuresh wrote:
> After changing network settings, such as switching the interface from wifi
> to ethernet or changing the ssid/encryption key settings, I find that
> network restart doesn't help. The changes come into effect only on next
> reboot.
> What is the way to apply changed network settings without having to
> reboot?
> Mayuresh
I wrote a small shellscript (runs with bash) which enables me to switch from wm0
to ath0 or vice versa. It sets the correct routes, ip adresses, ... 

if [ "$1" = "" ]; then
        echo "Usage: hera.netconfig [wm|ath]";
        echo ""

case "$1" in
                ifconfig wm0 down
                wpa_supplicant -c /etc/wpa_supplicant.conf -i ath0 -B

                ifconfig ath0

                route delete
                route delete default 
                route flush
                route add -net -link ath0 -iface
                route add default -link ath0

                kill `pgrep wpa_supplicant`
                ifconfig ath0 down
                ifconfig wm0

                route delete
                route delete default 
                route flush
                route add -net -link wm0 -iface
                route add default

Maybe, it should be improved but it works...

Home | Main Index | Thread Index | Old Index