CRUX-ARM : Home

Home :: Documentation :: Download :: Development :: Community :: Ports :: Packages :: Bugs :: Links :: About :: Donors
c5091fdbb2798a38f4cb68344f88533820e5fb49
[crossrootfs.git] / iproute2 / net.iproute2
1 #!/bin/sh
2 #
3 # /etc/rc.d/net: start/stop network interface
4 #
5
6 # Connection type: "DHCP" or "static"
7 TYPE="DHCP"
8
9 # For "static" connections, specify your settings here:
10 # To see your available devices run "ip link".
11 DEV=enp11s0
12 ADDR=192.168.1.100
13 MASK=24
14 GW=192.168.1.1
15
16 # Optional settings:
17 DHCPOPTS="-h `/bin/hostname` -t 10"
18
19 case $1 in
20 start)
21 if [ "${TYPE}" = "DHCP" ]; then
22 /sbin/dhcpcd ${DHCPOPTS}
23 else
24 /sbin/ip addr add ${ADDR}/${MASK} dev ${DEV} broadcast +
25 /sbin/ip link set ${DEV} up
26 /sbin/ip route add default via ${GW}
27 fi
28 ;;
29 stop)
30 if [ "${TYPE}" = "DHCP" ]; then
31 /sbin/dhcpcd -x
32 else
33 /sbin/ip route del default
34 /sbin/ip link set ${DEV} down
35 /sbin/ip addr del ${ADDR}/${MASK} dev ${DEV}
36 fi
37 ;;
38 restart)
39 $0 stop
40 $0 start
41 ;;
42 *)
43 echo "Usage: $0 [start|stop|restart]"
44 ;;
45 esac
46
47 # End of file
48