Unable to Resolve Hostname on Redhat (Guest OS) on VirtualBox

Hi

My redhat (guest OS) having issue for not able to resolve the hostname like google.com but able to ping 8.8.8.8.

I didn't do anything at all just to ensure that it can ping Google first and my network subnet like 192.168.1.0/24 when my redhat added a NAT Network adapter without issue.

After that I connect my fortinet vpn client thr IPSec and still can ping and resolve my private cloud thr hostname.

Next day I do the same thing like connect to my iPad 4G network to my Hp laptop wifi.

Can ping and resolved on my hp laptop even being connected to vpn.

The guest os redhat from virtualbox on nat can ping 8.8.8.8 but not able to resolve now.

Why yesterday can and today can't without changing anything?

Thanks.
Lucky ThamFreelancerAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Benjamin Van DitmarsSr Network EngineerCommented:
how is youre resolv configuration post youre /etc/resolv.
looks like an issue there.

on the host machine is windows firewall running ?
David FavorLinux/LXD/WordPress/Hosting SavantCommented:
Post the following...

cat /etc/os-release
cat /etc/resolv.conf
netstat -plun | grep ":53 "

Open in new window

Lucky ThamFreelancerAuthor Commented:
I've to configured the /etc/resolv.conf but keep having issue and the firewall is already disabled on my host.

Here is the output

redhat_1.jpg
redhat_2.jpg
Thanks.
Maximize Customer Retention with Superior Service

The IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy for valuable how-to assets including sample agreements, checklists, flowcharts, and more to help build customer satisfaction and retention.

Lucky ThamFreelancerAuthor Commented:
Hi,

Not sure whether this info is useful or not. Thanks.

my laptop configuration.

Ethernet adapter Ethernet 2:

   Connection-specific DNS Suffix  . :
   Description . . . . . . . . . . . : Fortinet virtual adapter
   Physical Address. . . . . . . . . : 00-09-0F-FE-00-01
   DHCP Enabled. . . . . . . . . . . : Yes
   Autoconfiguration Enabled . . . . : Yes
   Link-local IPv6 Address . . . . . : fe80::3147:29ba:bc5c:2942%5(Preferred)
   IPv4 Address. . . . . . . . . . . : 172.19.0.9(Preferred)
   Subnet Mask . . . . . . . . . . . : 255.255.255.0
   Lease Obtained. . . . . . . . . . : Monday, November 12, 2018 5:58:00 PM
   Lease Expires . . . . . . . . . . : Friday, December 20, 2154 12:30:24 AM
   Default Gateway . . . . . . . . . : 172.19.0.10
   DHCP Server . . . . . . . . . . . : 172.19.0.10
   DHCPv6 IAID . . . . . . . . . . . : 788531471
   DHCPv6 Client DUID. . . . . . . . : 00-01-00-01-23-1E-13-43-10-E7-C6-EA-75-49
   DNS Servers . . . . . . . . . . . : 10.10.0.1
                                       0.0.0.0
   NetBIOS over Tcpip. . . . . . . . : Enabled

Wireless LAN adapter Wi-Fi:

   Connection-specific DNS Suffix  . :
   Description . . . . . . . . . . . : Intel(R) Dual Band Wireless-AC 8265
   Physical Address. . . . . . . . . : 68-EC-C5-29-AF-3B
   DHCP Enabled. . . . . . . . . . . : Yes
   Autoconfiguration Enabled . . . . : Yes
   Link-local IPv6 Address . . . . . : fe80::5b1:9850:9fcf:3550%31(Preferred)
   IPv4 Address. . . . . . . . . . . : 172.20.10.9(Preferred)
   Subnet Mask . . . . . . . . . . . : 255.255.255.240
   Lease Obtained. . . . . . . . . . : Monday, November 12, 2018 5:36:36 PM
   Lease Expires . . . . . . . . . . : Tuesday, November 13, 2018 5:22:12 PM
   Default Gateway . . . . . . . . . : 172.20.10.1
   DHCP Server . . . . . . . . . . . : 172.20.10.1
   DHCPv6 IAID . . . . . . . . . . . : 375975109
   DHCPv6 Client DUID. . . . . . . . : 00-01-00-01-23-1E-13-43-10-E7-C6-EA-75-49
   DNS Servers . . . . . . . . . . . : 10.10.0.1
                                       172.20.10.1
   NetBIOS over Tcpip. . . . . . . . : Enabled


C:\Users\P1319181>route print
===========================================================================
Interface List
 27...00 ac f8 91 38 68 ......VPN Client Adapter - VPN
  2...10 e7 c6 ea 75 49 ......Realtek PCIe GBE Family Controller
  5...00 09 0f fe 00 01 ......Fortinet virtual adapter
 31...68 ec c5 29 af 3b ......Intel(R) Dual Band Wireless-AC 8265
 11...68 ec c5 29 af 3f ......Bluetooth Device (Personal Area Network)
  1...........................Software Loopback Interface 1
 13...00 00 00 00 00 00 00 e0 Microsoft Teredo Tunneling Adapter
 17...00 00 00 00 00 00 00 e0 Microsoft ISATAP Adapter #6
 15...00 00 00 00 00 00 00 e0 Microsoft ISATAP Adapter #7
===========================================================================

IPv4 Route Table
===========================================================================
Active Routes:
Network Destination        Netmask          Gateway       Interface  Metric
          0.0.0.0          0.0.0.0      172.20.10.1      172.20.10.9     90
          0.0.0.0          0.0.0.0      172.19.0.10       172.19.0.9     35
  118.201.183.142  255.255.255.255      172.20.10.1      172.20.10.9     55
        127.0.0.0        255.0.0.0         On-link         127.0.0.1    331
        127.0.0.1  255.255.255.255         On-link         127.0.0.1    331
  127.255.255.255  255.255.255.255         On-link         127.0.0.1    331
       172.19.0.0    255.255.255.0         On-link        172.19.0.9    291
       172.19.0.9  255.255.255.255         On-link        172.19.0.9    291
     172.19.0.255  255.255.255.255         On-link        172.19.0.9    291
      172.20.10.0  255.255.255.240         On-link       172.20.10.9    311
      172.20.10.9  255.255.255.255         On-link       172.20.10.9    311
     172.20.10.15  255.255.255.255         On-link       172.20.10.9    311
        224.0.0.0        240.0.0.0         On-link         127.0.0.1    331
        224.0.0.0        240.0.0.0         On-link       172.20.10.9    311
        224.0.0.0        240.0.0.0         On-link        172.19.0.9    291
  255.255.255.255  255.255.255.255         On-link         127.0.0.1    331
  255.255.255.255  255.255.255.255         On-link       172.20.10.9    311
  255.255.255.255  255.255.255.255         On-link        172.19.0.9    291
===========================================================================
Persistent Routes:
  Network Address          Netmask  Gateway Address  Metric
      160.102.0.0      255.255.0.0    160.101.0.254       1
      160.103.0.0      255.255.0.0    160.101.0.254       1
          0.0.0.0          0.0.0.0    192.168.1.254  Default
===========================================================================

IPv6 Route Table
===========================================================================
Active Routes:
 If Metric Network Destination      Gateway
 13    331 ::/0                     On-link
  1    331 ::1/128                  On-link
 13    331 2001::/32                On-link
 13    331 2001:0:9d38:6abd:8b3:11ad:8936:4871/128
                                    On-link
 31    311 fe80::/64                On-link
  5    291 fe80::/64                On-link
 13    331 fe80::/64                On-link
 31    311 fe80::5b1:9850:9fcf:3550/128
                                    On-link
 13    331 fe80::8b3:11ad:8936:4871/128
                                    On-link
  5    291 fe80::3147:29ba:bc5c:2942/128
                                    On-link
  1    331 ff00::/8                 On-link
 31    311 ff00::/8                 On-link
 13    331 ff00::/8                 On-link
  5    291 ff00::/8                 On-link
===========================================================================
Persistent Routes:
  None

redhat_gw1.jpg
David FavorLinux/LXD/WordPress/Hosting SavantCommented:
Couple of things.

1) You must install netstat, before you can run netstat.

Having this data is essential to know if systemd-resolved is in play, as this poor excuse of code is the bane of all DNS lookups.

2) Your /etc/resolv.conf is empty, so just try adding the following to this file for now...

nameserver 1.1.1.1
nameserver 8.8.8.8
nameserver 8.8.4.4

Open in new window


3) To make your /etc/resolv.conf entries permanent, you'll likely have to add something to one of your /etc/resolve.d/* files or however CentOS 7 manages/generates /etc/resolv.conf at boot time.
Lucky ThamFreelancerAuthor Commented:
Hi,

1. Can't yum install netstat as it can't resolve with error.

2.Tried vi /etc/resolv.conf and add in exactly the nameserver given but can't write over it and save as a root super user
#generated by network manager
search localdomain

nameserver 1.1.1.1
nameserver 8.8.8.8
nameserver 8.8.4.4

:wq!

/etc/network/interfaces" E212: Can't open file for writing
Press ENTER or type command to continue

3. How to do it?

Thanks
omarfaridCommented:
add nameserver entries in /etc/resolv.conf file

Check with network admin on dns servers ip addresses used in your network

e.g.

nameserver 8.8.8.8
nameserver 8.8.4.4

also, check for entry like below in /etc/nsswitch.conf file

hosts: files dns
omarfaridCommented:
what ls -l /etc/resolv.conf shows?
Lucky ThamFreelancerAuthor Commented:
redhat_3.jpg
Lucky ThamFreelancerAuthor Commented:
can do nslookup to find out dns like 192.168.1.254 on my host laptop?


hosts: files dns myhostname
omarfaridCommented:
your file owner is root and file perms allow you to write to it.

What you do for editing and storing changes?

what id command returns?

you can use same dns server used on laptop
Lucky ThamFreelancerAuthor Commented:
What you do for editing and storing changes?

redhat_5_DNS.jpg
what id command returns?

:wq
E505 "/etc/resolv.conf" is read only (add ! to override)

:wq!
redhat_6_E212.jpg
redhat_4_Error.jpg
nociSoftware EngineerCommented:
RedHat uses yum and store network configuration in /etc/sysconfig/network-scripts
Debian uses apt (apt-get) and /etc/network/interfaces

mixing this setups will not work.

/etc/resolv.conf should be editable... unless selinux is used in enforcing mode.
 Which may verify well be the case.
In that case you may need to update the network manager config files.
Lucky ThamFreelancerAuthor Commented:
I am not so good in Redhat so can advice how to verify and resolve it accordingly.

Thanks.
nociSoftware EngineerCommented:
what does ls -Z /etc/resolv.conf show?
-Z means show security context for an object.
Lucky ThamFreelancerAuthor Commented:
redhat_9_sec.jpg
nociSoftware EngineerCommented:
selinux prevents the root user to write /etc/resolv.conf.
you need to hold the system_u:object_r:net_conf_t:s0 security context to update it.

You should be able to update the system configuration (which includes this file) using nmtui or the network manager gui tooling.
Lucky ThamFreelancerAuthor Commented:
How to do it?
nociSoftware EngineerCommented:
run the nmtui program in a shell, and configure an interface, (static) and add the dns servers you need with that spec.
Lucky ThamFreelancerAuthor Commented:
But Already a DHCP client. Why still need to add a static interface. Can just an dns / host record?
Lucky ThamFreelancerAuthor Commented:
can't save again.

redhat_10_sec.jpg
nociSoftware EngineerCommented:
Then you need to tell the DHCP server which dns servers should be used and those will endup in the /etc/resolv.conf
unless the disk is set to read/only due to errors during booting  the system.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Redhat

From novice to tech pro — start learning today.