Hostname /IP address in Linux

I have ubuntu server. The network interfaces is set up for DHCP
when I run Ifconfig, I see the interface gets IP as shown in the screenshot
however when I run nslookup hostname, the Ip address is

I am not sure why those 2 IPs are different: and


Who is Participating?
skullnobrainsConnect With a Mentor Commented:
you are asking the dns server at to answer to a dns query for ubuntu.X where X is whatever is configured in the "search" line of your /etc/resolv.conf

if you expect dns and dhcp to be linked, you'd probably should use  single server for both. what is your dhcp software ? is it on the same host as the dns server ?

you probably should try and give a name that is a little more unique than ubuntu to your machine if you expect to debug anything
jskfanAuthor Commented:
TintinConnect With a Mentor Commented:
DHCP and DNS are two difference services, which may or may not be linked.

In your case, your DNS is giving you incorrect information, so you need to find out more about how DNS is configured in your network and how it is controlled.
A proven path to a career in data science

At Springboard, we know how to get you a job in data science. With Springboard’s Data Science Career Track, you’ll master data science  with a curriculum built by industry experts. You’ll work on real projects, and get 1-on-1 mentorship from a data scientist.

TobiasHolmConnect With a Mentor Commented:
What Tintin says is true. Also, your reverse lookup isn't working (

A tip is to try and use FQDN while troubleshooting, example: unstead of just ubuntu.

A good tool when troubleshooting DNS are "dig".  And also the tool "nslookup".
SandyConnect With a Mentor Commented:
Check with Reverse DNS entries in your nameserver to understand why these 2 IP's are showing two different names. Whether nslookup or dig -x both will try to query to withing RDNS so i suggest below action plan.

1. Check and configure reverse dns in your network.
2. Configure your ubuntu box with that dns address in /etc/resolv.conf
3. Then try to test by using #nslookup <ip> or #dig -x <ip>

jskfanAuthor Commented:
I will check it later…Thank you Guys!
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.