3 # This script activates an interface based on the specified
4 # configuration. The kvp daemon code invokes this external script
5 # to configure the interface.
7 # The only argument to this script is the configuration file that is to
8 # be used to configure the interface.
10 # Here is the format of the ip configuration file:
13 # IF_NAME=interface name
14 # DHCP=yes (This is optional; if yes, DHCP is configured)
18 # IPADDR_x=ipaddry (where y = x + 1)
21 # NETMASK_x=netmasky (where y = x + 1)
24 # GATEWAY_x=ipaddry (where y = x + 1)
26 # DNSx=ipaddrx (where first DNS address is tagged as DNS1 etc)
28 # IPV6 addresses will be tagged as IPV6ADDR, IPV6 gateway will be
29 # tagged as IPV6_DEFAULTGW and IPV6 NETMASK will be tagged as
32 # The host can specify multiple ipv4 and ipv6 addresses to be
33 # configured for the interface. Furthermore, the configuration
34 # needs to be persistent. A subsequent GET call on the interface
35 # is expected to return the configuration that is set via the SET
41 sed -i".bak" '/ifconfig_hn0="SYNCDHCP"/d' /etc/rc.conf
42 sed -i".bak" '/ifconfig_hn0="DHCP"/d' /etc/rc.conf
45 ifconfig $IF_NAME ether $HWADDR
48 ifconfig $IF_NAME inet $IP_ADDR netmask $SUBNET
51 sed -i".bak" '/nameserver/d' /etc/resolv.conf
52 echo "nameserver" $DNS >> /etc/resolv.conf
55 # Need to implment if Gateway is not present
57 route add default $GATEWAY
58 #route change default $GATEWAY
60 #/etc/rc.d/netif restart
61 #/etc/rc.d/routing restart
67 echo ifconfig_hn0=\"DHCP\" >> /etc/rc.conf
70 echo Disabled DHCP >> /var/log/messages
73 echo "Set IP-Injection Success"