#! /bin/bash ### centos6_frontend1of2 # -1 # Set SELINUX to permissive mode. sed -i 's/SELINUX=enforcing/#SELINUX=enforcing/g' /etc/sysconfig/selinux echo 'SELINUX=permissive' >> /etc/sysconfig/selinux # 0 # Creat an user common useradd common usermod -a -G users common passwd common # 1. edit /etc/sysconfig/network-scripts/ifcfg-eth0 in the frontend so that it's content looks like. ############################################################ # DEVICE=eth0 # BOOTPROTO=static # DHCPCLASS= # IPADDR=10.1.1.1 # NETMASK=255.255.0.0 # ONBOOT=yes # TYPE=Ethernet # PREFIX=16 # DNS1=127.0.0.1 # DOMAIN="local usm.my" # DEFROUTE=yes # IPV6INIT=no # NAME="System eth0" # NM_CONTROLLED="yes" # HWADDR=BC:30:5B:CD:A8:4B # UUID=5fb06bd0-0bb0-7ffb-45f1-d6edd65f3e03 ############################################################ # Apart from the last two lines HWADDR and UUID, the content in /sysconfig/network-scripts/ifcfg-eth0 should be universal. # The following code will replace the ifcfg-eht0 with the desired content. The original ifcfg-eth0 will be saved as ifcfg-eth0.orig ############################################################ mv /etc/sysconfig/network-scripts/ifcfg-eth0 /etc/sysconfig/network-scripts/ifcfg-eth0.orig touch /etc/sysconfig/network-scripts/ifcfg-eth0 grep UUID /etc/sysconfig/network-scripts/ifcfg-eth0.orig > /etc/sysconfig/network-scripts/ifcfg-eth0 grep HWADDR /etc/sysconfig/network-scripts/ifcfg-eth0.orig > /etc/sysconfig/network-scripts/ifcfg-eth0 echo 'DEVICE=eth0' >> /etc/sysconfig/network-scripts/ifcfg-eth0 echo 'BOOTPROTO=static' >> /etc/sysconfig/network-scripts/ifcfg-eth0 echo 'DHCPCLASS=' >> /etc/sysconfig/network-scripts/ifcfg-eth0 echo 'IPADDR=10.1.1.1' >> /etc/sysconfig/network-scripts/ifcfg-eth0 echo 'NETMASK=255.255.0.0' >> /etc/sysconfig/network-scripts/ifcfg-eth0 echo 'ONBOOT=yes' >> /etc/sysconfig/network-scripts/ifcfg-eth0 echo 'TYPE=Ethernet' >> /etc/sysconfig/network-scripts/ifcfg-eth0 echo 'PREFIX=16' >> /etc/sysconfig/network-scripts/ifcfg-eth0 echo 'DNS1=127.0.0.1' >> /etc/sysconfig/network-scripts/ifcfg-eth0 echo 'DOMAIN=usm.my' >> /etc/sysconfig/network-scripts/ifcfg-eth0 echo 'DEFROUTE=yes' >> /etc/sysconfig/network-scripts/ifcfg-eth0 echo 'IPV6INIT=no' >> /etc/sysconfig/network-scripts/ifcfg-eth0 echo 'NAME=System eth0' >> /etc/sysconfig/network-scripts/ifcfg-eth0 echo 'NM_CONTROLLED=yes' >> /etc/sysconfig/network-scripts/ifcfg-eth0 ############################################################ # 2. edit /etc/sysconfig/network-scripts/ifcfg-eth1 in the frontend so that it's content looks like. ############################################################ # DEVICE="eth1" # BOOTPROTO=static # DHCPCLASS= # IPADDR=10.205.19.225 # NETMASK=255.255.254.0 # NM_CONTROLLED="yes" # ONBOOT="yes" # TYPE=Ethernet # PREFIX=23 # GATEWAY=10.205.19.254 # DNS1=10.202.1.27 # DNS2=10.202.1.6 # DEFROUTE=yes # IPV6INIT=no # NAME="System eth1" # HWADDR=1C:AF:F7:ED:33:C7 # UUID=9c92fad9-6ecb-3e6c-eb4d-8a47c6f50c04 ############################################################ # Apart from the last two lines HWADDR and UUID, the content in /sysconfig/network-scripts/ifcfg-eth1 should be universal. # The following code will replace the ifcfg-eht1 with the desired content. The original ifcfg-eth1 will be saved as ifcfg-eth1.orig. # You must modify the entries for the IPADDR, DNSs and GATEWAY accordingly to suit to your case. ############################################################ mv /etc/sysconfig/network-scripts/ifcfg-eth1 /etc/sysconfig/network-scripts/ifcfg-eth1.orig touch /etc/sysconfig/network-scripts/ifcfg-eth1 grep UUID /etc/sysconfig/network-scripts/ifcfg-eth1.orig > /etc/sysconfig/network-scripts/ifcfg-eth1 grep HWADDR /etc/sysconfig/network-scripts/ifcfg-eth1.orig > /etc/sysconfig/network-scripts/ifcfg-eth1 echo 'DEVICE=eth1' >> /etc/sysconfig/network-scripts/ifcfg-eth1 echo 'BOOTPROTO=static' >> /etc/sysconfig/network-scripts/ifcfg-eth1 echo 'DHCPCLASS=' >> /etc/sysconfig/network-scripts/ifcfg-eth1 echo 'IPADDR=10.205.19.225' >> /etc/sysconfig/network-scripts/ifcfg-eth1 echo 'NETMASK=255.255.254.0' >> /etc/sysconfig/network-scripts/ifcfg-eth1 echo 'NM_CONTROLLED=yes' >> /etc/sysconfig/network-scripts/ifcfg-eth1 echo 'ONBOOT=yes' >> /etc/sysconfig/network-scripts/ifcfg-eth1 echo 'DOMAIN=local' >> /etc/sysconfig/network-scripts/ifcfg-eth1 echo 'TYPE=Ethernet' >> /etc/sysconfig/network-scripts/ifcfg-eth1 echo 'PREFIX=16' >> /etc/sysconfig/network-scripts/ifcfg-eth1 echo 'GATEWAY=10.205.19.254' >> /etc/sysconfig/network-scripts/ifcfg-eth1 echo 'DNS1=10.202.1.27' >> /etc/sysconfig/network-scripts/ifcfg-eth1 echo 'DNS2=10.202.1.6' >> /etc/sysconfig/network-scripts/ifcfg-eth1 echo 'DEFROUTE=yes' >> /etc/sysconfig/network-scripts/ifcfg-eth1 echo 'IPV6INIT=no' >> /etc/sysconfig/network-scripts/ifcfg-eth1 echo 'NAME=System eth1' >> /etc/sysconfig/network-scripts/ifcfg-eth1 ############################################################ # 3. After that, configure the default gateway (router IP) and hostname in /etc/sysconfig/network file in frontend. The file should has a typical content like ############################################################ # NETWORKING=yes # HOSTNAME=anicca # GATEWAY= ############################################################ # The hostname anicca used is just an example. Modify the hostname that suits your case. # The following code will replace the /etc/sysconfig/network file with the desired content. The original netowork file will be saved as network.orig ############################################################ mv /etc/sysconfig/network /etc/sysconfig/network.orig touch /etc/sysconfig/network echo 'NETWORKING=yes' >> /etc/sysconfig/network echo 'HOSTNAME=anicca' >> /etc/sysconfig/network echo 'GATEWAY=' >> /etc/sysconfig/network ############################################################ # 4. # Now configure the DNS entry for frontend. The DNS is defined in /etc/resolv.conf file. # A typical content of /etc/resolv.conf of a frontend looks something like ############################################################ #search local usm.my #nameserver 10.202.1.27 #nameserver 10.202.1.6 #nameserver 127.0.0.1 ############################################################ # The following code will replace the /etc/resolv.conf file of the frontend with the desired content. The original netowork file, if exist, will be saved as /etc/resolv.conf.orig. ############################################################ mv /etc/resolv.conf /etc/resolv.conf.orig touch /etc/resolv.conf echo 'search local usm.my' >> /etc/resolv.conf echo 'nameserver 127.0.0.1' >> /etc/resolv.conf echo 'nameserver 10.202.1.27' >> /etc/resolv.conf echo 'nameserver 10.202.1.6' >> /etc/resolv.conf # 5. Preparation for passwordless ssh. # The file /etc/ssh/sshd_config in the frontend and nodes is modified to allow passwordless ssh mv /etc/ssh/sshd_config /etc/ssh/sshd_config.orig sed 's/GSSAPIAuthentication.*$/GSSAPIAuthentication no/g' < /etc/ssh/sshd_config.orig > /etc/ssh/sshd_config echo 'UseDNS no' >> /etc/ssh/sshd_config # Restart networking by enter following command: /etc/init.d/network restart reboot