LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 06-23-2017, 03:57 AM   #1
KavithaNM
LQ Newbie
 
Registered: Jun 2017
Posts: 12

Rep: Reputation: Disabled
Cannot resolve hostname on Centos guest(HOME nw/ DNSclient issue)


Cannot resolve hostname on Centos guest(HOME nw/ DNSclient issue)
nslookup hostname doesnt work but nslookup www.google.com works
Setting up DNS at Home network(Centos 6.8 64 bit minimal guest on Oracle virtual VM)
Ping cmd is working for all!
HOSTNAME="virtcentos.local"
(192.168.1.35 virtcentos virtcentos.local)

curl -X GET http://localhost:8444/verify (works)
ping www.google.com(works)

curl -X GET http://virtcentos:8444/verify - doesnt work
curl -X GET http://virtcentos.local:8444/verify - doesnt work
curl -X GET http://192.168.1.35:8444/verify - doesnt work

nslookup www.google.com(works)
nslookup virtcentos - doesnt work
nslookup virtcentos - doesnt work
nslookup 192.168.1.35 - doesnt work
========================
# /etc/nsswitch.conf
hosts: files dns
===================
# cat /etc/resolv.conf
; generated by /sbin/dhclient-script
nameserver 192.168.1.1
===========================
cat "/etc/sysconfig/network-scripts/ifcfg-eth0"
DEVICE=eth0
BOOTPROTO=dhcp
HOSTNAME=virtcentos.local
HWADDR=xx:XX:XX:XX:XX:XX
UUID=XX-XX-XX-XX-XX
ONBOOT=yes
TYPE=Ethernet
NM_CONTROLLED=no
DHCP_HOSTNAME=virtcentos.local
PEERDNS=yes
=========================
cat "/etc/sysconfig/network"
NETWORKING=yes
HOSTNAME="virtcentos.local"
GATEWAY=192.168.1.1
====================
vi /etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.1.35 virtcentos virtcentos.local
==================================

Hostname is not resoling to ipaddress and viceverca.
Kindly help!
 
Old 06-23-2017, 05:38 AM   #2
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,700

Rep: Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895
Depends on how you configured the virtual network adapter but you are using DHCP so although you have added an entry in the hosts file it may be different than the actual address. nslookup does not use local DNS resolver so it will fail. Also whatever service is running on port 8444 may only be configured to listen on localhost.
 
Old 06-23-2017, 07:04 AM   #3
KavithaNM
LQ Newbie
 
Registered: Jun 2017
Posts: 12

Original Poster
Rep: Reputation: Disabled
Post

Many thanks Michael for the quick reply!
I had tried adding "127.0.0.1 virtcentos virtcentos.local" in "/etc/hosts" earlier , but this didn't work too!

More details:
/sbin/dhclient process is running.
nslookup doesn't resolve virtcentos, virtcentos.local or 192.168.1.35(ifconfig -a shows this IP for eth0)
(I am able to connect to internet and download packages, but the local IP and hostname are not recognized by DNS!

(home internet connection: Windows 10 host is using Wi Fi which is wired to the CentOS guest using bridge adapter on Oracle virtual machine)

dns port(udp and tcp) status
============================
nmap -sU -p 53 192.168.1.1
PORT STATE SERVICE
53/udp open|filtered domain

nmap -sT -p 53 192.168.1.1
PORT STATE SERVICE
53/tcp closed domain
=================
PFA the result of nslookup debug(nslookup >set debug and >set d2)

Kindly let me know if you can get any clue from these?

Thanks and regards
Kavitha.
Attached Files
File Type: txt nslookup debuggig.txt (5.4 KB, 42 views)
 
Old 06-23-2017, 08:58 AM   #4
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,700

Rep: Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895
You stated that you are setting up DNS at HOME. What local DNS server are you running? If it is not then nslookup as far as I know will never resolve a local hostname.
 
Old 06-23-2017, 09:41 AM   #5
KavithaNM
LQ Newbie
 
Registered: Jun 2017
Posts: 12

Original Poster
Rep: Reputation: Disabled
Post

Thank you Michael for your reply!
No, I am not setting up any DNS server! But have a DHCP client(or DNS client) setup(eth0 interface of my CentOS guest)!

[I am using home network for internet connectivity(Windows 10 host(laptop) has wifi connected. Centos guest(VM) is connected through Bridged adapter(Broadcom BCM wifi adapter) through wired connection!]

Kindly let me know if the details are not sufficient or clear enough!
I will try to give more information!

Thanks and Regards
Kavitha
 
Old 06-23-2017, 10:41 AM   #6
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,700

Rep: Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895
CentOS does not install/configure anything by default for local name resolution. While the DHCP client will automatically setup DNS information it only resolves internet host names and not devices on your local LAN. With only a few computers on your LAN you can add them to each device's hosts file. This only works with static IP address or you configure the DHCP server to use address reservation.

You could setup a local DNS server, install Avahi which I believe is available for CentOS 6 but never have tried. You can use samba, WINS, netbios for name resolution.

https://wiki.archlinux.org/index.php...File%20sharing

The other issue is that whatever is running on port 8444 may only be configured to listen on localhost interface i.e. 127.0.0.1 and not eth0 192.168.1.35.
 
Old 06-23-2017, 11:25 AM   #7
KavithaNM
LQ Newbie
 
Registered: Jun 2017
Posts: 12

Original Poster
Rep: Reputation: Disabled
Smile Dynamic DNS from ISP provides changing ip address to my home network

Many thanks Michael for all the useful information!
I will try to see if avahi can be setup on my CentOS guest or any of the other DNS servers you have suggested!

Currently, by using the Dynamic DNS , eth0 interface of CentOS system gets changing dynamic Internet IP address via DHCP from my ISP. In my home networking environment, the IP address is provided by DHCP and therefore changes from time to time.

I will also check out if the port 8444 availability for localhost alone or not!

Thanks and Regards,
Kavitha
 
Old 06-23-2017, 11:45 AM   #8
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,700

Rep: Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895
Most router's these days have the capability for address reservation which basically means the DHCP server will always assign the same address to the same device.
 
Old 06-23-2017, 12:05 PM   #9
KavithaNM
LQ Newbie
 
Registered: Jun 2017
Posts: 12

Original Poster
Rep: Reputation: Disabled
Thank you Michael!
I did try this on my windows 10 host "Router Admin Login" to reserve IP Address for my CentOS guest using its HWaddress.
But for some reason the eth0 on the CentOS guest did not come up successfully after "Service network restart".
Therefore I removed the IPaddress reservation!

Thanks and Regards,
Kavitha
 
Old 06-23-2017, 12:12 PM   #10
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,700

Rep: Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895
Since the VM is configured using bridged mode CentOS is using your LAN's DHCP server which is typically the router and not VirtualBox.
 
Old 06-23-2017, 12:21 PM   #11
KavithaNM
LQ Newbie
 
Registered: Jun 2017
Posts: 12

Original Poster
Rep: Reputation: Disabled
Thank you for the information Michael!
This is helpful!

Regards
Kavitha
 
Old 06-24-2017, 11:03 AM   #12
KavithaNM
LQ Newbie
 
Registered: Jun 2017
Posts: 12

Original Poster
Rep: Reputation: Disabled
Thumbs up

Many thanks Michael!

"https://virtcentos.local:8443/" is accessible from host after adding the IP and hostname on Windows hosts file(..\etc\hosts).
I had been struggling with this for so long and now it works because of your inputs!
Thank you so much once again!
Wish you all the good things!
Experts like you make our lives so easy!

Thanks and Regards
Kavitha
 
Old 06-26-2017, 11:15 PM   #13
KavithaNM
LQ Newbie
 
Registered: Jun 2017
Posts: 12

Original Poster
Rep: Reputation: Disabled
Many thanks Michael for your valuable inputs!
solution that worked on my windows host and CentOS guest environment:
1.Adding CentOS guest IP & hostname in Windows host(\..\etc\hosts).
2.Changed the CentOS guest network from NAT to "Host only network"(earlier I was trying to access the guest from host using internet & DNS)

Thanks and Regards
Kavitha
 
  


Reply

Tags
centos6, dns changes, home network, virtual box, windows 10



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Linux Centos 6.5 Hostname resolve in LAN network - Urgent itjackie Linux - Networking 2 08-06-2015 12:43 PM
How I can resolve the error Postfix? warning: hostname does not resolve to address kanzer Linux - Server 1 03-22-2013 08:56 AM
clients CAN resolve hostname of server w/nslookup, but CANNOT access by hostname WTF? psycroptic Linux - Networking 9 11-10-2012 11:24 AM
Resolve hostname from IP cornish Linux - Networking 10 10-10-2007 10:21 AM
resolve hostname linuxtesting2 Solaris / OpenSolaris 5 03-20-2007 12:27 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 04:29 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration