经常在不同网段间切换IP,厌倦了吧,一个脚本带你出地狱^_^
- #!/bin/bash
- #
- H_dir=/etc/network
- info () {
- echo "Usage:`basename $0` -[b|n|u]"
- }
- while getopts :bnu SW
- do
- case $SW in
- b) cp $H_dir/interfaces $H_dir/interfaces.old
- cp $H_dir/interfaces.bri $H_dir/interfaces
- /etc/init.d/networking restart
- ;;
- n) cp $H_dir/interfaces $H_dir/interfaces.old
- cp $H_dir/interfaces.nat $H_dir/interfaces
- /etc/init.d/networking restart
- ;;
- u)
- cp $H_dir/interfaces.old $H_dir/interfaces
- /etc/init.d/networking restart
- ;;
- ?) info
- ;;
- esac
- done