nslookup query not working in Ubuntu
After a quick chat, I noted that the DNS entries causing you to resolve your queries. Adding DNS entries to /etc/resolv.conf
made me clear that it is indeed the DNS.
Ways of adding DNS entries listed below.
Adding additional entries to resolv.conf
Create a file under /etc/resolvconf/resolv.conf.d/
as tail
and add them there.
sudo nano /etc/resolvconf/resolv.conf.d/tail
and add nameserver 8.8.8.8
(or your preferred DNS). Once done, just restart the network manager with:
sudo service network-manager restart
Adding through network-manager
Edit Connections -> select your network (wired/wireless) and Edit -> IPv4 Settings -> and select Automatic (DHCP) address only -> add under Additional DNS servers
Related videos on Youtube
Parthapratim Neog
Updated on September 18, 2022Comments
-
Parthapratim Neog over 1 year
I am trying to use the code
nslookup -q=mx gmail.com
to find the mail server of gmail.com, but its not working on my Ubuntu. I have tried it in windows and it works fine. I can't find out what the issue on Ubuntu. The commandnslookup gmail.com
works though. Here are the responses of both commands;Response for:
nslookup gmail.com
thisisppn@thisisppn-HP-15-Notebook-PC:~$ nslookup gmail.com Server: 127.0.1.1 Address: 127.0.1.1#53 Non-authoritative answer: Name: gmail.com Address: 216.58.196.5
Response for:
nslookup -q=mx gmail.com
thisisppn@thisisppn-HP-15-Notebook-PC:~$ nslookup -q=mx gmail.com ;; connection timed out; no servers could be reached
-
AzkerM over 8 yearsLooks strange though. Can you type just
nslookup
and enter, then typeset type=mx
and enter, now just trygmail.com
. let me know whether that works? -
Parthapratim Neog over 8 yearsi know right, I even tried it out on a live server, its working fine. And Regarding your suggestion. Here is the response which is same.
thisisppn@thisisppn-HP-15-Notebook-PC:~$ nslookup > set type=mx > gmail.com ;; connection timed out; no servers could be reached >
-
AzkerM over 8 yearsare you able to ping with an FQDN? what are your DNS servers? can you post an out put of
cat /etc/resolv.conf
&route -n
. -
Parthapratim Neog over 8 years@AzkerM here is the output, I put it up on pastebin for better view. pastebin.com/akNAnNhM
-
Parthapratim Neog over 8 years@AzkerM Not sure what a FQDN is, as I am really new to Ubuntu and Linux systems. How can I find my DNS servers?
-
AzkerM over 8 yearsI'm not sure why the server ends with
1.1
where it should be127.0.0.1
. Well, I might be wrong too. However, for the sake of testing,, can you dosudo nano /etc/resolv.conf
and comment the linenameserver 127.0.1.1
starting with#
.. also the same time addnameserver 8.8.8.8
then save withCTRL+O
and hit enter. Now remember! this is a temporary edit to see whether changing DNS responds to your query. FQDN refers to Fully qualified domain name which is commonly any domain names that not IP addresses. -
AzkerM over 8 yearsLet us continue this discussion in chat.
-
-
Parthapratim Neog over 8 yearsCould you, by any chance, have an answer for this?
-
AzkerM over 8 yearsThanks @A.B. for the edit.. I was wondering how the hell did I miss that :D