#!/usr/bin/bash # 默认网关 GATEWAY=192.168.96.166 # 网卡 INTERFACE=ens33 case $1 in start) ip route add default via $GATEWAY dev $INTERFACE ;; stop) ip route del default via $GATEWAY dev $INTERFACE ;; *) echo "Usage: $0 {start|stop}" esac