blob: a4c566a4456a71d6123ccd1176995f780399b86d (
plain) (
tree)
|
|
#!/bin/sh
#
# /etc/rc.d/net: start/stop network interface
#
# Connection type: "DHCP" or "static"
TYPE="DHCP"
# For "static" connections, specify your settings here:
# To see your available devices run "ip link".
DEV=ens3
ADDR=192.168.1.100
MASK=24
GW=192.168.1.1
# Optional settings:
DHCPOPTS="-t 10"
/sbin/ifconfig dummy down > /dev/null 2>&1
/sbin/ifconfig dummy0 down > /dev/null 2>&1
/sbin/ifconfig ifb0 down > /dev/null 2>&1
/sbin/ifconfig ifb1 down > /dev/null 2>&1
/sbin/ifconfig bond0 down > /dev/null 2>&1
case $1 in
start)
if [ "${TYPE}" = "DHCP" ]; then
/sbin/dhcpcd ${DHCPOPTS}
else
/sbin/ip addr add ${ADDR}/${MASK} dev ${DEV} broadcast +
/sbin/ip link set ${DEV} up
/sbin/ip route add default via ${GW}
fi
;;
stop)
if [ "${TYPE}" = "DHCP" ]; then
/sbin/dhcpcd -x
else
/sbin/ip route del default
/sbin/ip link set ${DEV} down
/sbin/ip addr del ${ADDR}/${MASK} dev ${DEV}
fi
;;
restart)
$0 stop
$0 start
;;
*)
echo "Usage: $0 [start|stop|restart]"
;;
esac
# End of file
|