RHCSA/RHCE : SSH between two linux servers?

Hi. I  have a small question regarding ssh.  I am using centos7 on virtual box for practicing linux. I have established passwordless login between two linux servers. I could login in to one another with out any problem.  sometimes i am not able to ssh in to another system using hostname ( error: no route to host 22)  but was able to do with i.p addresses mutually. I noticed that my bootproto=dhcp in networkscripts. If i logout and login to the system, the i.p addresses might change as it is dhcp. Then i edit the /etc/hosts file in both the servers each time the i.p address change. Is there a permanent solution to ssh between two systems with out error for bootproto 'dhcp'?
  • post-author-pic
    Michael M
    11-08-2018

    Hello, 


    If you are on DHCP I am afraid that you are at the mercy of the lease. Each time that the servers get new Ip addresses then you will need to update /etc/hosts manually. 
    I recommend that you utilize the cloud playground and practice what you are attemping there. 
    If that is not an option you could set boot proto static and manually assign ip addresses to the machines. Make sure that the ip address is not one that DHCP hands out or there could be an issue on the network. 

  • post-author-pic
    Ankit P
    11-08-2018

    Thank you micheal for your help. I was thinking to set boot proto 'static' or 'non'. I recently took RHCSA. I couldn't download and install packages as my repository url was not enabled. Intially i set up the network according to the i.p,dns ans gw address given in the exam. Since that didn't workout, I manually changed boot proto to 'dhcp' in network scripts configuration file and  was able to enable the repository. In this case i manually assigned the i.p and set boot proto to dhcp. Just asking you this question because in the future for any other red hat exams, should we assign boot proto 'dhcp' in order for the repositoty url to work or do we need to set boot proto 'static' and assign I.P given?


Looking For Team Training?

Learn More