Can't run rs.initiate() when do mongodb replication set
Answer is simple! You don't have "node1" defined in your /etc/hosts file. Your machine don't know IP address of "node1" (or "node2").
echo "127.0.0.1 node1" >> /etc/hosts
And then other thing, you have defined (in config file) that your mongod is listening only localhost. So it means that your whole replica set must be in that one machine and if it is so, all those three members cannot use same port 27017, every member must have different port.