biolocal:EthWNConfig
From Wiki CEINGE
(Difference between revisions)
Revision as of 17:20, 27 October 2009 (edit) Mauro (Talk | contribs) (New page: == Cluster nodes configurations == Actually the 2nd interface of each cluster node is configured automatically at start-up by adding +128 to the boot ip address. This is done by the script...) ← Previous diff |
Revision as of 17:25, 27 October 2009 (edit) (undo) Mauro (Talk | contribs) (→Cluster nodes configurations) Next diff → |
||
Line 1: | Line 1: | ||
== Cluster nodes configurations == | == Cluster nodes configurations == | ||
- | Actually the 2nd interface | + | Actually the ip of the 2nd interface on each cluster node is configured automatically at start-up by adding ''+128'' to the boot ip address. |
This is done by the script /etc/init.d/network present in the rootOS (i.e. not in the snapshot). | This is done by the script /etc/init.d/network present in the rootOS (i.e. not in the snapshot). | ||
+ | In the script there is this section: | ||
+ | <pre> | ||
+ | sysconf_path=/etc/sysconfig/network-scripts | ||
+ | ### eth autoconfig ### | ||
+ | # This part of the script read the eth0 ip address and make | ||
+ | # an additional ip to assign to eth1, adding 128 to the last ip octet | ||
+ | # Author: Gianluca | ||
+ | # Date: 17/02/2009 | ||
+ | |||
+ | interface2=eth1 | ||
+ | interface21=eth1.92 | ||
+ | |||
+ | # Here we assume that the ip on eth0 is previusly assigned by dhcp | ||
+ | ip=`/sbin/ifconfig | awk '/HWaddr|Bcast/ {split($0,lines,"\n"); print lines[1];}'|sed -e '$!N;s/\n/ /' -e 's/addr://g' |awk '{print $7}'|grep 192.168` | ||
+ | |||
+ | n1=`echo $ip|cut -d '.' -f 1` | ||
+ | n2=`echo $ip|cut -d '.' -f 2` | ||
+ | n3=`echo $ip|cut -d '.' -f 3` | ||
+ | n4=`echo $ip|cut -d '.' -f 4` | ||
+ | |||
+ | # Add 128 to the last octet | ||
+ | let c4=$n4+128; | ||
+ | |||
+ | # The new ip to assign to eth1.92 interface | ||
+ | ip2=$n1.$n2.$n3.$c4 | ||
+ | |||
+ | # Write the configuration in the sysconfig directory | ||
+ | |||
+ | # Write the configuration in the sysconfig directory for eth1.2 | ||
+ | echo "DEVICE=$interface21" > $sysconf_path/ifcfg-$interface21 | ||
+ | echo "VLAN=yes" >> $sysconf_path/ifcfg-$interface21 | ||
+ | echo "BOOTPROTO=none" >> $sysconf_path/ifcfg-$interface21 | ||
+ | echo "BROADCAST=192.168.191.255" >> $sysconf_path/ifcfg-$interface21 | ||
+ | echo "IPADDR=$ip2" >> $sysconf_path/ifcfg-$interface21 | ||
+ | echo "NETMASK=255.255.192.0" >> $sysconf_path/ifcfg-$interface21 | ||
+ | echo "NETWORK=192.168.128.0" >> $sysconf_path/ifcfg-$interface21 | ||
+ | echo "ONBOOT=yes" >> $sysconf_path/ifcfg-$interface21 | ||
+ | echo "TYPE=Ethernet" >> $sysconf_path/ifcfg-$interface21 | ||
+ | |||
+ | # Write the configuration in the sysconfig directory for eth1 | ||
+ | |||
+ | echo "DEVICE=$interface2" > $sysconf_path/ifcfg-$interface2 | ||
+ | echo "BOOTPROTO=none" >> $sysconf_path/ifcfg-$interface2 | ||
+ | echo "IPADDR=0.0.0.0" >> $sysconf_path/ifcfg-$interface2 | ||
+ | echo "ONBOOT=yes" >> $sysconf_path/ifcfg-$interface2 | ||
+ | echo "TYPE=Ethernet" >> $sysconf_path/ifcfg-$interface2 | ||
+ | |||
+ | |||
+ | ### End eth autoconfig ### | ||
+ | |||
+ | </pre> | ||
+ | |||
+ | Moreover, in the files.custom of snapshots it is necessary add the line ''/etc/init.d/network-scripts/ifcg-eth1.92'' |
Revision as of 17:25, 27 October 2009
Cluster nodes configurations
Actually the ip of the 2nd interface on each cluster node is configured automatically at start-up by adding +128 to the boot ip address. This is done by the script /etc/init.d/network present in the rootOS (i.e. not in the snapshot). In the script there is this section:
sysconf_path=/etc/sysconfig/network-scripts ### eth autoconfig ### # This part of the script read the eth0 ip address and make # an additional ip to assign to eth1, adding 128 to the last ip octet # Author: Gianluca # Date: 17/02/2009 interface2=eth1 interface21=eth1.92 # Here we assume that the ip on eth0 is previusly assigned by dhcp ip=`/sbin/ifconfig | awk '/HWaddr|Bcast/ {split($0,lines,"\n"); print lines[1];}'|sed -e '$!N;s/\n/ /' -e 's/addr://g' |awk '{print $7}'|grep 192.168` n1=`echo $ip|cut -d '.' -f 1` n2=`echo $ip|cut -d '.' -f 2` n3=`echo $ip|cut -d '.' -f 3` n4=`echo $ip|cut -d '.' -f 4` # Add 128 to the last octet let c4=$n4+128; # The new ip to assign to eth1.92 interface ip2=$n1.$n2.$n3.$c4 # Write the configuration in the sysconfig directory # Write the configuration in the sysconfig directory for eth1.2 echo "DEVICE=$interface21" > $sysconf_path/ifcfg-$interface21 echo "VLAN=yes" >> $sysconf_path/ifcfg-$interface21 echo "BOOTPROTO=none" >> $sysconf_path/ifcfg-$interface21 echo "BROADCAST=192.168.191.255" >> $sysconf_path/ifcfg-$interface21 echo "IPADDR=$ip2" >> $sysconf_path/ifcfg-$interface21 echo "NETMASK=255.255.192.0" >> $sysconf_path/ifcfg-$interface21 echo "NETWORK=192.168.128.0" >> $sysconf_path/ifcfg-$interface21 echo "ONBOOT=yes" >> $sysconf_path/ifcfg-$interface21 echo "TYPE=Ethernet" >> $sysconf_path/ifcfg-$interface21 # Write the configuration in the sysconfig directory for eth1 echo "DEVICE=$interface2" > $sysconf_path/ifcfg-$interface2 echo "BOOTPROTO=none" >> $sysconf_path/ifcfg-$interface2 echo "IPADDR=0.0.0.0" >> $sysconf_path/ifcfg-$interface2 echo "ONBOOT=yes" >> $sysconf_path/ifcfg-$interface2 echo "TYPE=Ethernet" >> $sysconf_path/ifcfg-$interface2 ### End eth autoconfig ###
Moreover, in the files.custom of snapshots it is necessary add the line /etc/init.d/network-scripts/ifcg-eth1.92