dhclient in /usr/sbin
[hdw-linux/hdw-linux.git] / misc / sysfiles / etc / conf / network
1 # hdw - linux /etc/conf/network
2 #
3 # defining {start,stop}_net functions used by /etc/init.d/network
4 # (copied from ROCK Linux + some additions)
5 #
6
7 DHCP="on"
8
9 IF_0="eth0"
10 IPADDR_0="192.168.10.20"
11 NETMASK_0="255.255.255.0"
12 GATEWAY_0="192.168.10.10"
13 #OPTIONS_0="mtu 1412"
14
15 #
16 # start and stop functions (called by /etc/init.d/network)
17 #
18
19 xx() { echo ">> $*" ; eval "$*" ; }
20
21 start_net() {
22         if [ ".$DHCP" = ".on" ] ; then
23                 echo "starting dhclient."
24                 /usr/sbin/dhclient -q $IF_0
25         else
26                 echo "setting up network ..."
27                 # xx insmod ip_tables
28                 # xx iptables -A chain rule-specification [options]
29                 # xx echo 1 '>' /proc/sys/net/ipv4/ip_forward
30                 xx ifconfig $IF_0 $IPADDR_0 netmask $NETMASK_0 up # $OPTIONS_0
31                 xx route add default gw $GATEWAY_0 dev $IF_0
32         fi
33         # ipsec
34         [ -f /etc/setkey.conf -a -f /usr/sbin/setkey ] &&
35                 xx /usr/sbin/setkey -f /etc/setkey.conf
36 }
37
38 stop_net() {
39         if [ ".$DHCP" = ".on" ] ; then
40                 echo "stopping dhclient."
41                 killall -15 /usr/sbin/dhclient
42                 ifconfig $IF_0 down
43         else
44                 echo "shutting down network ..."
45                 xx route del default gw $GATEWAY_0 dev $IF_0
46                 xx ifconfig $IF_0 down
47                 # xx echo 0 '>' /proc/sys/net/ipv4/ip_forward
48                 # xx iptables -D chain rule-specification [options]
49                 # xx rmmod ip_tables
50         fi
51 }