diff options
author | Silvino <silvino@bk.ru> | 2021-02-25 23:22:17 +0000 |
---|---|---|
committer | Silvino <silvino@bk.ru> | 2021-02-25 23:22:17 +0000 |
commit | d12b35a47b9a872ecb5e037f1c2b02e1ea8927fb (patch) | |
tree | 8fdac6dfc8cabb9f85a2db3a3bd628cfe44438cd /linux/conf/rc.d/net | |
parent | 0a6b0fc9769daf0932cb207c3285baa31547b489 (diff) | |
parent | a3628fc49db4d88ff3e4067268650710d1da3f6f (diff) | |
download | doc-d12b35a47b9a872ecb5e037f1c2b02e1ea8927fb.tar.gz |
merge openbsd branch into develop
new directory layout
Diffstat (limited to 'linux/conf/rc.d/net')
-rwxr-xr-x | linux/conf/rc.d/net | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/linux/conf/rc.d/net b/linux/conf/rc.d/net new file mode 100755 index 0000000..a4c566a --- /dev/null +++ b/linux/conf/rc.d/net @@ -0,0 +1,54 @@ +#!/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 + |