This is a documentation on how to build a passwordless linked PCs using CENTOS 5.7. 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: If external LAN card is present: eth0 refers to the external LAN card, eth1 refers to the built-in network card. If no external LAN card is present: eth0 refers to the the built-in network card. To configure the fronend: 1. Click System -> Administration -> Network. 2. Select and activate eth1. This is supposed to be the built-in network card connected to the switche. 3. In the 'Device' tab, select eth1, then click the 'Edit' icon. Check 'Statically set IP address'. 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) 4. Click the 'DNS' tab to edit the hostname to 'chakra'. Key in the DNS as follows: DNS: 10.202.1.27, 10.202.1.6 5. In the 'Device' tab, select eth0, then click the 'Edit' icon. Check 'Statically set IP address'. Key in the Address, Subnet and Default gateway information for frontend: address: 10.205.19.9, subnet: 255.255.254.0, default gateway: 10.205.19.254 6. 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 eth0 -j MASQUERADE service iptables save service iptables restart The modification to the iptables can be checked by cat /etc/sysconfig/iptables To configure node1: 1. Click System -> Administration -> Network. 2. Select and activate eth1. This is supposed to be the built-in network card connected to the switche. 3. In the 'Device' tab, select eth1, then click the 'Edit' icon. Check 'Statically set IP address'. 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 4. Click the 'DNS' tab to edit the hostname to 'node1'. Key in the DNS as follows: DNS: 10.202.1.27, 10.202.1.6 5. This is an optonal step which can be skipped if no extra LAN card is present. In case there is an extra LAN card plugged in to a LAN network, do the following: In the 'Device' tab, select eth0, then click the 'Edit' icon. Check 'automatically obtain ip address with dhcp'. 6. After configuration of the network, su service network restart. Repeat 1 - 6 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. Next we would like to carry out a configuration on the cluster so that a designated user, e.g., tlyoon in this example, can ssh to and fro the frontend to each nodes. This can be easily achieved by running the script http://10.205.19.205/configrepo/howto/linux/ssh_wo_passwd_to_all_PCs_for_cluster in each PC in turn. Run the scrit first in the frontend. After running the script one by one, the user tlyoon (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. Modify the user's name in the script when you want to set up passwordless ssh for yourself. Next, setting aliases: 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.