I just installed CentOS 7 and configured my network as given here
When I did cat /etc/resolv.conf, I got:
# Generated by NetworkManager
search home
nameserver <IP address>
So I guess I have only one DNS and included only DNS1="" in the /etc/sysconfig/network-scripts/ifcfg-enp5s0 file.
When I do route -n, I get:
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
0.0.0.0 <IP Address-1> 0.0.0.0 UG 100 0 0 enp5s0
<IP Address-2> 0.0.0.0 255.255.255.0 U 100 0 0 enp5s0
I am assuming my gateway is IP Address-1 above and updated the same in config file. Now my /etc/sysconfig/network-scripts/ifcfg-enp5s0 looks like:
TYPE="Ethernet"
BOOTPROTO="dhcp"
DEFROUTE="yes"
PEERDNS="yes"
PEERROUTES="yes"
IPV4_FAILURE_FATAL="no"
IPV6INIT="yes"
IPV6_AUTOCONF="yes"
IPV6_DEFROUTE="yes"
IPV6_PEERDNS="yes"
IPV6_PEERROUTES="yes"
IPV6_FAILURE_FATAL="no"
NAME="enp5s0"
UUID="ae988f3f-1fdb-4613-a7bc-c43fb8076c15"
DEVICE="enp5s0"
ONBOOT="yes"
IPADDR="172.XX.X.XX"
PREFIX="24"
GATEWAY="172.XX.X.X"
DNS1="172.XX.X.X"
DNS2="172.XX.X.X"
Both DNS1, DNS2 are same as Gateway.
My /etc/resolv.conf looks like:
# Generated by NetworkManager
domain hom
search home
nameserver 172.XX.X.X
After updating all these values and naming my machine centos7 in /etc/hostname file, I am not able to connect to the machine with ssh user_name@hostname
but ssh user_name@172.XX.X.XX
works. Also, after the machine logs in, the prompt looks like: [user_name@hostname ~]$
We do have other machines running Centos 6 and donot have such issues. We use host names for remote connection to those. I am having this problem only with centOS 7. Also, when i do host <IP ADDRESS>
, all other machines show their hostnames but Centos 7 doesnot. It just says new-host-23.home
Not sure if this is a machine issue or a DNS issue. I did not find my solution in another similar question on Stack overflow. Someone please help me.
centos7
?