129194
#!/bin/bash
129194
129194
# This example script activates an interface based on the specified
129194
# configuration.
129194
#
129194
# In the interest of keeping the KVP daemon code free of distro specific
129194
# information; the kvp daemon code invokes this external script to configure
129194
# the interface.
129194
#
129194
# The only argument to this script is the configuration file that is to
129194
# be used to configure the interface.
129194
#
129194
# Each Distro is expected to implement this script in a distro specific
129194
# fashion. For instance on Distros that ship with Network Manager enabled,
129194
# this script can be based on the Network Manager APIs for configuring the
129194
# interface.
129194
#
129194
# This example script is based on a RHEL environment.
129194
#
129194
# Here is the format of the ip configuration file:
129194
#
129194
# HWADDR=macaddr
129194
# DEVICE=interface name
129194
# BOOTPROTO=<protocol> (where <protocol> is "dhcp" if DHCP is configured
129194
#                       or "none" if no boot-time protocol should be used)
129194
#
129194
# IPADDR0=ipaddr1
129194
# IPADDR1=ipaddr2
129194
# IPADDRx=ipaddry (where y = x + 1)
129194
#
129194
# NETMASK0=netmask1
129194
# NETMASKx=netmasky (where y = x + 1)
129194
#
129194
# GATEWAY=ipaddr1
129194
# GATEWAYx=ipaddry (where y = x + 1)
129194
#
129194
# DNSx=ipaddrx (where first DNS address is tagged as DNS1 etc)
129194
#
129194
# IPV6 addresses will be tagged as IPV6ADDR, IPV6 gateway will be
129194
# tagged as IPV6_DEFAULTGW and IPV6 NETMASK will be tagged as
129194
# IPV6NETMASK.
129194
#
129194
# The host can specify multiple ipv4 and ipv6 addresses to be
129194
# configured for the interface. Furthermore, the configuration
129194
# needs to be persistent. A subsequent GET call on the interface
129194
# is expected to return the configuration that is set via the SET
129194
# call.
129194
#
129194
129194
129194
129194
echo "IPV6INIT=yes" >> $1
129194
echo "NM_CONTROLLED=no" >> $1
129194
echo "PEERDNS=yes" >> $1
129194
echo "ONBOOT=yes" >> $1
129194
129194
129194
cp $1 /etc/sysconfig/network-scripts/
129194
129194
129194
interface=$(echo $1 | awk -F - '{ print $2 }')
129194
129194
/sbin/ifdown $interface 2>/dev/null
129194
/sbin/ifup $interface 2>/dev/null