Blame view

tools/hv/hv_set_ifconfig.sh 1.81 KB
1fbdba4ed   K. Y. Srinivasan   Tools: hv: Add an...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
  #!/bin/bash
  
  # This example script activates an interface based on the specified
  # configuration.
  #
  # In the interest of keeping the KVP daemon code free of distro specific
  # information; the kvp daemon code invokes this external script to configure
  # the interface.
  #
  # The only argument to this script is the configuration file that is to
  # be used to configure the interface.
  #
  # Each Distro is expected to implement this script in a distro specific
  # fashion. For instance on Distros that ship with Network Manager enabled,
  # this script can be based on the Network Manager APIs for configuring the
  # interface.
  #
  # This example script is based on a RHEL environment.
  #
  # Here is the format of the ip configuration file:
  #
  # HWADDR=macaddr
0783d72fa   Tomas Hozza   tools: hv: Fix ho...
23
24
25
  # DEVICE=interface name
  # BOOTPROTO=<protocol> (where <protocol> is "dhcp" if DHCP is configured
  #                       or "none" if no boot-time protocol should be used)
1fbdba4ed   K. Y. Srinivasan   Tools: hv: Add an...
26
  #
0783d72fa   Tomas Hozza   tools: hv: Fix ho...
27
28
29
  # IPADDR0=ipaddr1
  # IPADDR1=ipaddr2
  # IPADDRx=ipaddry (where y = x + 1)
1fbdba4ed   K. Y. Srinivasan   Tools: hv: Add an...
30
  #
0783d72fa   Tomas Hozza   tools: hv: Fix ho...
31
32
  # NETMASK0=netmask1
  # NETMASKx=netmasky (where y = x + 1)
1fbdba4ed   K. Y. Srinivasan   Tools: hv: Add an...
33
34
  #
  # GATEWAY=ipaddr1
0783d72fa   Tomas Hozza   tools: hv: Fix ho...
35
  # GATEWAYx=ipaddry (where y = x + 1)
1fbdba4ed   K. Y. Srinivasan   Tools: hv: Add an...
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
  #
  # DNSx=ipaddrx (where first DNS address is tagged as DNS1 etc)
  #
  # IPV6 addresses will be tagged as IPV6ADDR, IPV6 gateway will be
  # tagged as IPV6_DEFAULTGW and IPV6 NETMASK will be tagged as
  # IPV6NETMASK.
  #
  # The host can specify multiple ipv4 and ipv6 addresses to be
  # configured for the interface. Furthermore, the configuration
  # needs to be persistent. A subsequent GET call on the interface
  # is expected to return the configuration that is set via the SET
  # call.
  #
  
  
  
  echo "IPV6INIT=yes" >> $1
  echo "NM_CONTROLLED=no" >> $1
  echo "PEERDNS=yes" >> $1
  echo "ONBOOT=yes" >> $1
1fbdba4ed   K. Y. Srinivasan   Tools: hv: Add an...
56
57
58
59
60
61
62
  
  cp $1 /etc/sysconfig/network-scripts/
  
  
  interface=$(echo $1 | awk -F - '{ print $2 }')
  
  /sbin/ifdown $interface 2>/dev/null
00246d08b   Jason Wang   tools: hv: fix a ...
63
  /sbin/ifup $interface 2>/dev/null