conn

A script repository to manage connections in Linux.
git clone git://r-36.net/conn
Log | Files | Refs | README | LICENSE

skkmswp.sh (450B)


      1 #!/bin/sh
      2 
      3 interface="$1"
      4 
      5 case "$2" in
      6 	CONNECTED)
      7 		# This is dangerous, but assumed.
      8 		ip addr flush dev $interface 2>&1 >/dev/null
      9 		ip addr add 192.168.1.6/24 dev $interface \
     10 			brd 192.168.1.255 2>&1 >/dev/null
     11 		ip route add default via 192.168.1.2 dev $interface \
     12 			2>&1 >/dev/null
     13 		echo "nameserver 8.8.8.8" > /etc/resolv.conf
     14 		;;
     15 	DISCONNECTED)
     16 		ip addr del 192.168.1.6/24 dev $interface 2>&1 >/dev/null
     17 		;;
     18 	*)
     19 		exit 1;
     20 		;;
     21 esac
     22