40 lines
660 B
Plaintext
40 lines
660 B
Plaintext
#
|
|
# /etc/rc.d/net: start/stop network interface
|
|
#
|
|
|
|
DEV=enp11s0
|
|
ADDR=192.168.1.100 # (or "DHCP")
|
|
MASK=24
|
|
GW=192.168.1.1
|
|
|
|
case $1 in
|
|
start)
|
|
if [ "${ADDR}" == "DHCP" ]; then
|
|
/sbin/dhcpcd -h `/bin/hostname` -t 10 &
|
|
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 [ "${ADDR}" == "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
|
|
|