| 1 | #!/bin/sh |
| 2 | # |
| 3 | # /etc/rc.d/net: start/stop network |
| 4 | # |
| 5 | |
| 6 | IF="eth0" |
| 7 | IP="192.168.1.100/24" |
| 8 | GW="192.168.1.1" |
| 9 | |
| 10 | case $1 in |
| 11 | start) |
| 12 | # loopback |
| 13 | /sbin/ip addr add 127.0.0.1/8 dev lo broadcast + scope host |
| 14 | /sbin/ip link set lo up |
| 15 | # ethernet |
| 16 | #/sbin/ip addr add $IP dev $IF broadcast + |
| 17 | #/sbin/ip link set $IF up |
| 18 | # default route |
| 19 | #/sbin/ip route add default via $GW |
| 20 | ;; |
| 21 | stop) |
| 22 | #/sbin/ip route del default |
| 23 | #/sbin/ip link set $IF down |
| 24 | #/sbin/ip addr del $IP dev $IF |
| 25 | /sbin/ip link set lo down |
| 26 | /sbin/ip addr del 127.0.0.1/8 dev lo |
| 27 | ;; |
| 28 | restart) |
| 29 | $0 stop |
| 30 | $0 start |
| 31 | ;; |
| 32 | *) |
| 33 | echo "usage: $0 [start|stop|restart]" |
| 34 | ;; |
| 35 | esac |
| 36 | |
| 37 | # End of file |