This is a documentation on how to build a passwordless linked PCs using CENTOS 6. The main purpose is to build a 'cluster' that is capable of running mpich2 calculations in multiple nodes connected via a 100/1000 MB/s switch. As an illustration, we will use 4 PCs to build the 'cluster' (which is not strickly a cluster defined in a strict sencse as our's less much complexity that an authentic cluster). Hardwar requirement: 4 PC, LAN cable, a 100/1000 MB/s switch, and an extra LAN card to be slot to the frontend node. We name these PC respectively: chakra (frontend, in which the LAN card is plugged into), node1,node2,node3. Procedure: The internal network cards (built in on the motherboard) of each PC have to be connected to the switch. The networking configurations of these witch-connecting network card are as follows: chakra: address: 10.1.1.1, subnet: 255.255.0.0, default gateway: (leave blank) node1: address: 10.1.255.251 subnet: 255.255.0.0, default gateway: 10.1.1.1 node2: address: 10.1.255.252 Subnet: 255.255.0.0, default gateway: 10.1.1.1 node3: address: 10.1.255.253 Subnet: 255.255.0.0, default gateway: 10.1.1.1 DNS: 10.202.1.27, 10.202.1.6 The external LAN card in the frontend is to be connected to the LAN network. The networking configurations of the LAN-connecting network card are as follows: chakra: address: 10.205.19.9, subnet: 255.255.254.0, default gateway: 10.205.19.254 DNS: 10.202.1.27, 10.202.1.6 Naming convention of network cards: Be reminded that the naming of the network port could be confusing. In some instances, the external LAN can is named eth0 while the built-in LAN card is named eth1. In other occassion the naming is the opposite. To avoid confusion we will avoid using 'eth0', 'eth1' when refering to these cards. We will refer them instead as 'LAN card to the internet' and 'LAN card to the switch'. To configure the fronend: 1. Righ click the Network icon on the upper right conner. Choose 'edit connections'. You shall see two cards, an built-in LAN card and the other extra LAN card. 2. Select the built-in network card. This is the card that is to be connected to switch. Click 'edit' -> IPv4 setting -> manual. Key in the Address, Subnet and Default gateway information for frontend: address: 10.1.1.1, subnet: 255.255.0.0, default gateway: (leave blank) DNS: 10.202.1.27, 10.202.1.6 Search domain: (leave blank). Save and return to Network Connections. 3. Select the external network card. This is the card that is to be connected to the internet. Click 'edit' -> IPv4 setting -> manual. Key in the Address, Subnet and Default gateway information for frontend: address: 10.205.18.205, subnet: 255.255.254.0, default gateway: 10.205.19.254 DNS: 10.202.1.27, 10.202.1.6 Search domain: (leave blank). Alternatively to step 3, one can also choose 'automatic DHCP' in the IPv4 setting for the external LAN network card. This will leave the LAN network to set the IP for the frontend. 4. After configuration of the network, su service network restart. 7. Open a terminal as su in frontend. Follow the instruction: (see http://www.cyberciti.biz/faq/rhel-fedora-linux-internet-connection-sharing-howto/). a. Add in the line 'net.ipv4.conf.default.forwarding=1' by editing the file /etc/sysctl.conf b. Issue 'service network restart' after finish editing. c. Issue (as su) the following commands one after another ############### service iptables stop iptables -t nat -A POSTROUTING -o eth1 -j MASQUERADE service iptables save service iptables restart ############### Note: in the above it is assumed that the LAN card that connects to the internet is 'eth1'. In case your LAN card that connect to the internet happen to be 'eth0' instead, modify the second line from 'eth1' to 'eth0'. The modification to the iptables can be checked by cat /etc/sysconfig/iptables To configure node1: 1. Righ click the Network icon on the upper right conner. Choose 'edit connections'. Select the built-in network card. This is the card that is to be connected to switch. Click 'edit' -> IPv4 setting -> manual. Key in the Address, Subnet and Default gateway information for frontend: address: 10.1.255.251, subnet: 255.255.0.0, default gateway: 10.1.1.1 DNS: 10.202.1.27, 10.202.1.6 Search domain: (leave blank). Save and return to Network Connections. 2. After configuration of the network, su service network restart. Repeat 1 - 2 for other nodes by appropriately modify the hostname and ip addresses (10.1.255.251 for node1, 10.1.255.252 for node2, 10.1.255.253 for node3, etc). Once all the PC's IP has been set properly and connected via the switch, you should now able to i. ssh from one node to another via the switch using the ip defined on the internal network card, e.g., ssh tlyoon@10.1.1.1 from node1 to the frontend, or ssh tlyoon@10.1.255.253 from fronend to node3. ii. Browse internet (through the internet gateway shared by frontend) from any node1,..,node3 without needing these nodes to connect directly to the LAN network. passwordless SSH Next we would like to carry out a configuration on the cluster so that a user can ssh to and fro the frontend to each nodes. Instruction: As an user, wget the following script into the home directory, e.g., cd /home/user wget http://10.205.19.205/configrepo/howto/linux/ssh_wo_passwd_to_all_PCs_for_cluster Do this for each PC in turn. Run the scrit first in the frontend. After running the script one by one, the user (which must already exist as an user in each of the PCs) shall be able to ssh passwordlessly to and fro the frontend to the nodes. Setting aliases in .bashrc of a user You may also want to cut and paste the aliases in http://10.205.19.205/tlyoon/info/bashrc into your own ~/.bashrc file in chakra so that by issuing e.g., node1 will automatically log you in passwordlessly to node1, etc.