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, ...
#!/usr/pkg/bin/bash
if [ "$1" = "" ]; then
echo "Usage: hera.netconfig [wm|ath]";
echo ""
fi
case "$1" in
ath)
ifconfig wm0 down
wpa_supplicant -c /etc/wpa_supplicant.conf -i ath0 -B
ifconfig ath0 192.168.178.20 255.255.255.0
route delete 192.168.178.0
route delete default
route flush
route add -net 192.168.178.0/24 -link ath0 -iface
route add default 192.168.178.1 -link ath0
;;
wm)
kill `pgrep wpa_supplicant`
ifconfig ath0 down
ifconfig wm0 192.168.178.20 255.255.255.0
route delete 192.168.178.0
route delete default
route flush
route add -net 192.168.178.0/24 -link wm0 -iface
route add default 192.168.178.1
;;
esac
Maybe, it should be improved but it works...
--
0xAAA
Home |
Main Index |
Thread Index |
Old Index