What DNS servers am I using?How do I view effective dns servers?How do I verify I am using 9.9.9.9 for DNS?Reverse DNS lookups slowing down network operations on LANTwo DNS servers, both incompleteCombining different DNS serversReverse dns using dns server of domainWhy is my ISP DNS still in resolv.conf after a VPN connection and how can this be fixed?systemd-resolved change dns cname recordsset DNS on ppp connection via systemd/dbus busctlHow do I view effective dns servers?Set custom DNS servers using Unbound
What exploit are these user agents trying to use?
Is Lorentz symmetry broken if SUSY is broken?
In Romance of the Three Kingdoms why do people still use bamboo sticks when papers are already invented?
How much of data wrangling is a data scientist's job?
Did Shadowfax go to Valinor?
When a company launches a new product do they "come out" with a new product or do they "come up" with a new product?
If human space travel is limited by the G force vulnerability, is there a way to counter G forces?
Alternative to sending password over mail?
How can I make my BBEG immortal short of making them a Lich or Vampire?
Will google still index a page if I use a $_SESSION variable?
Could gravitational lensing be used to protect a spaceship from a laser?
Took a trip to a parallel universe, need help deciphering
Why is the 'in' operator throwing an error with a string literal instead of logging false?
What does it mean to describe someone as a butt steak?
How to model explosives?
What is the word for reserving something for yourself before others do?
Forgetting the musical notes while performing in concert
Arrow those variables!
How can I tell someone that I want to be his or her friend?
How can I fix/modify my tub/shower combo so the water comes out of the showerhead?
How do I write bicross product symbols in latex?
AES: Why is it a good practice to use only the first 16bytes of a hash for encryption?
Can one be a co-translator of a book, if he does not know the language that the book is translated into?
In a Spin are Both Wings Stalled?
What DNS servers am I using?
How do I view effective dns servers?How do I verify I am using 9.9.9.9 for DNS?Reverse DNS lookups slowing down network operations on LANTwo DNS servers, both incompleteCombining different DNS serversReverse dns using dns server of domainWhy is my ISP DNS still in resolv.conf after a VPN connection and how can this be fixed?systemd-resolved change dns cname recordsset DNS on ppp connection via systemd/dbus busctlHow do I view effective dns servers?Set custom DNS servers using Unbound
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
How can I check which DNS server am I using (in Linux)? I am using network manager and a wired connection to my university's LAN. (I am trying to find out why my domain doesn't get resolved)
networking dns
add a comment |
How can I check which DNS server am I using (in Linux)? I am using network manager and a wired connection to my university's LAN. (I am trying to find out why my domain doesn't get resolved)
networking dns
add a comment |
How can I check which DNS server am I using (in Linux)? I am using network manager and a wired connection to my university's LAN. (I am trying to find out why my domain doesn't get resolved)
networking dns
How can I check which DNS server am I using (in Linux)? I am using network manager and a wired connection to my university's LAN. (I am trying to find out why my domain doesn't get resolved)
networking dns
networking dns
edited May 7 '14 at 19:33
Braiam
23.8k2077142
23.8k2077142
asked Jan 12 '12 at 12:07
GrzenioGrzenio
1,95282740
1,95282740
add a comment |
add a comment |
12 Answers
12
active
oldest
votes
You should be able to get some reasonable information in:
$ cat /etc/resolv.conf
26
However, please be aware that (on modern Linuxen) the contents of/etc/nsswitch.conf
dictate what name services are used (DNS, LDAP, etc) and in what order. Sayfgrep hosts: /etc/nsswitch.conf
. If it only references DNS,/etc/resolv.conf
is the right place to look for your nameservers. But chances are you're also using mDNS (aka ZeroConf, aka Avahi, aka Bonjour, etc), etc. In that case, things depend on what you're using.
– Alexios
Jan 12 '12 at 13:35
24
This file typically points at 127.0.1.1 on Ubuntu - it's the local DNS cache server, not the actual upstream.
– Barry Kelly
Mar 8 '16 at 10:24
2
@BarryKelly Check what your router uses, then
– Geremia
Mar 11 '16 at 17:10
2
And if you have several upstream server configured ? How to know which one is currently used ?
– Sylvain Leroux
Nov 24 '16 at 23:31
2
I would suggest to mention that file is a link and dynamically generated for systems using resovconf (like Ubuntu). I've seen this answer millions of times and until today is that I think it is correct, because I understand now that it is actually a dynamically generated file.
– jgomo3
Dec 26 '17 at 18:00
|
show 3 more comments
Here's how I do it:
nmcli dev show | grep DNS
This worked previous to the way above:
nm-tool | grep DNS
13
This one is usefull if you are using VPN and NetworkManager. Your/etc/resolv.conf
will point to your machine, withdnsmasq
resolving names as configured by NetworkManager.
– Grzegorz Żur
May 30 '13 at 11:32
6
On Debian this requires thenetwork-manager
package.
– TranslucentCloud
Feb 3 '15 at 19:44
2
nm-tool is not available in newer linuxes. for example it is not in the 'network-manager' package of debian 8.
– don bright
Oct 31 '15 at 15:06
2
I've updated the answer to reflect what's working for me in 2016.
– Lonniebiz
Sep 1 '16 at 16:36
2
this is the best answer, resolve.conf not always show the truth
– blade
Feb 7 '18 at 22:58
|
show 3 more comments
I think you can also query DNS and it will show you what server returned the result. Try this:
dig yourserver.somedomain.xyz
And the response should tell you what server(s) returned the result. The output you're interested in will look something like this:
;; Query time: 91 msec
;; SERVER: 172.xxx.xxx.xxx#53(172.xxx.xxx.xxx)
;; WHEN: Tue Apr 02 09:03:41 EDT 2019
;; MSG SIZE rcvd: 207
You can also tell dig
to query a specific DNS server by using dig @server_ip
7
On Debian this requires thednsutils
package.
– Faheem Mitha
Jan 14 '12 at 20:54
5
If you use any DNS masking/caching service that is run on your local machine, it will hide the real DNS servers.
– karatedog
Sep 7 '15 at 9:12
2
Ubuntu 18.04 just shows the local dns cache:SERVER: 127.0.0.53#53(127.0.0.53)
– wisbucky
Nov 14 '18 at 2:16
add a comment |
Just do an, nslookup
. Part of its results include the server that it's using.
In the example below, it shows that the DNS server used is at 8.8.8.8.
$ nslookup google.com
Server: 8.8.8.8
Address: 8.8.8.8#53
Non-authoritative answer:
Name: google.com
Address: 172.217.22.174
1
can you give an example of what to enter in the prompt?
– chovy
Jan 14 '16 at 6:41
Example:$ nslookup www.google.com
– Ren
Feb 13 '16 at 23:50
6
On Debian this requires thednsutils
package.
– Gayan Weerakutti
Aug 13 '17 at 7:00
5
On a recent Ubuntu, this again points to the local cache server 127.0.0.1 as already hinted at in this comment
– FriendFX
Dec 1 '17 at 1:50
In CentOS 7 it quits with error, but it is a vm so I didnslookup google.com
in the Windows host and I found the nameserver. Add it in/etc/resolv.conf
like:nameserver xx.xx.xx.xx
and restart servicenetwork
, and all is fine. Praise you.
– WesternGun
May 3 '18 at 15:22
add a comment |
On systems running systemd use:
systemd-resolve --status
2
systemd-resolve: unrecognized option '--status'
– A-B-B
Apr 1 '18 at 18:03
@A-B-B system? systemd version?
– G32RW
Apr 1 '18 at 20:21
229-4ubuntu21.2
– A-B-B
Apr 1 '18 at 23:34
7
This is the new default way to do it in Ubuntu 18.04 Bionic Beaver - get used to it, everybody!
– AveryFreeman
Apr 24 '18 at 20:32
4
This is the only solution that worked for me, as the others returned 127.0.0.53
– greuze
Oct 25 '18 at 7:50
|
show 1 more comment
With the new network-manager
command nmcli
, do this:
nmcli --fields ipv4.dns,ipv6.dns con show <connection_name>
On newer versions of network-manager (such as in Ubuntu 16.04), the field names are slightly different:
nmcli --fields ip4.dns,ip6.dns con show <connection_name>
If you don't know the connection name, use:
nmcli -t --fields NAME con show --active
For example:
$ nmcli --fields ip4.dns,ip6.dns con show 'Wired connection 1'
IP4.DNS[1]: 172.21.0.13
IP4.DNS[2]: 172.21.0.4
My results:order «con» «show» is not valid
.
– Sopalajo de Arrierez
Jan 30 '16 at 22:03
It works fine for me with network-manager 1.0.4 on Ubuntu 15.10. Maybe you have an older version?
– Sameer
Mar 17 '16 at 5:40
The tabular format is pretty bad. I hope to get a column like format similar to Powershell.
– CMCDragonkai
Mar 14 '17 at 6:42
1
ReturnsError: invalid field 'ip4.dns'; allowed fields: NAME,UUID,TYPE,TIMESTAMP,TIMESTAMP-REAL,AUTOCONNECT,AUTOCONNECT-PRIORITY,READONLY,DBUS-PATH,ACTIVE,DEVICE,STATE,ACTIVE-PATH.
– FriendFX
Dec 1 '17 at 1:53
add a comment |
If you are using network manager probably you get all network parameters from your dhcp server at your university.
If you don't want use your shell to check your dns settings (as described by hesse and Alexios), you can see them from the panel "Network information".
You can reach this panel by pressing right mouse button on network manager icon and selecting "Connection Information" from the menu.
add a comment |
to get the first DNS SERVER (IP only) :
cat /etc/resolv.conf |grep -i '^nameserver'|head -n1|cut -d ' ' -f2
cat
will output DNS configgrep
filters only nameserverhead
will keep only the first row/instancecut
take the ip part of the row (second column with ' ' as separator)
To put DNS ip in an environment variable, you could use as follow:
export THEDNSSERVER=$(cat /etc/resolv.conf |grep -i '^nameserver'|head -n1|cut -d ' ' -f2)
1
grep -m 1
stops matching after first match so you don't have to usehead
– sshow
Jul 28 '17 at 8:30
To lighten the pipeline even more, capture groups with Perl regexp is very neat, and grep takes a file argument:grep -Pom 1 '^nameserver KS+' /etc/resolv.conf
. Just wrote up Capture groups with grep perl regular expression
– sshow
Jul 28 '17 at 9:04
add a comment |
The command
nmcli dev list iface <interfacename> | grep IP4
Replace "interfacename" with yours.
examlpe
nmcli dev list iface eth0 | grep IP4
This will list all DNS servers(If you use more than one).
nmcli dev list iface [devicename]
is the correct command
– sebix
May 18 '15 at 17:33
I haven't noticed <interface> is hidden since i use <>
– Maythux
May 19 '15 at 5:53
1
On debian i get an error--- $ nmcli dev list iface eth0 Error: 'dev' command 'list' is not valid.
– don bright
Oct 31 '15 at 15:00
nmcli is a RH specific command.
– Rui F Ribeiro
Nov 16 '15 at 7:42
This is correct answer!
– VAdaihiep
Aug 10 '18 at 8:00
add a comment |
I have Fedora 25 and also had similar slow response on command line to sudo commands.
nmcli dev show | grep DNS
showed that only one of my 3 adapters (two active) had DNS entries.
By adding DNS entries to the one active card that didn't have an entry - presto!
All is good and response time is immediate.
add a comment |
Using resolvectl
$ resolvectl status | grep -1 'DNS Server'
DNSSEC supported: no
Current DNS Server: 1.1.1.1
DNS Servers: 1.1.1.1
1.0.0.1
For compatibility, systemd-resolve
is a symbolic link to resolvectl
on many distros as for Ubuntu 18.10:
$ type -a systemd-resolve
systemd-resolve is /usr/bin/systemd-resolve
$ ll /usr/bin/systemd-resolve
lrwxrwxrwx 1 root root 10 nov. 15 21:42 /usr/bin/systemd-resolve -> resolvectl
$ type -a resolvectl
resolvectl is /usr/bin/resolvectl
$ file /usr/bin/resolvectl
/usr/bin/resolvectl: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 3.2.0, BuildID[sha1]=09e488e849e3b988dd2ac93b024bbba18bb71814, stripped
works perfect on Ubuntu 18.10.
– Georgе Stoyanov
Mar 27 at 16:02
add a comment |
In CentOS, you can use:
/usr/sbin/named -v
add a comment |
protected by Community♦ Sep 6 '18 at 23:49
Thank you for your interest in this question.
Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).
Would you like to answer one of these unanswered questions instead?
12 Answers
12
active
oldest
votes
12 Answers
12
active
oldest
votes
active
oldest
votes
active
oldest
votes
You should be able to get some reasonable information in:
$ cat /etc/resolv.conf
26
However, please be aware that (on modern Linuxen) the contents of/etc/nsswitch.conf
dictate what name services are used (DNS, LDAP, etc) and in what order. Sayfgrep hosts: /etc/nsswitch.conf
. If it only references DNS,/etc/resolv.conf
is the right place to look for your nameservers. But chances are you're also using mDNS (aka ZeroConf, aka Avahi, aka Bonjour, etc), etc. In that case, things depend on what you're using.
– Alexios
Jan 12 '12 at 13:35
24
This file typically points at 127.0.1.1 on Ubuntu - it's the local DNS cache server, not the actual upstream.
– Barry Kelly
Mar 8 '16 at 10:24
2
@BarryKelly Check what your router uses, then
– Geremia
Mar 11 '16 at 17:10
2
And if you have several upstream server configured ? How to know which one is currently used ?
– Sylvain Leroux
Nov 24 '16 at 23:31
2
I would suggest to mention that file is a link and dynamically generated for systems using resovconf (like Ubuntu). I've seen this answer millions of times and until today is that I think it is correct, because I understand now that it is actually a dynamically generated file.
– jgomo3
Dec 26 '17 at 18:00
|
show 3 more comments
You should be able to get some reasonable information in:
$ cat /etc/resolv.conf
26
However, please be aware that (on modern Linuxen) the contents of/etc/nsswitch.conf
dictate what name services are used (DNS, LDAP, etc) and in what order. Sayfgrep hosts: /etc/nsswitch.conf
. If it only references DNS,/etc/resolv.conf
is the right place to look for your nameservers. But chances are you're also using mDNS (aka ZeroConf, aka Avahi, aka Bonjour, etc), etc. In that case, things depend on what you're using.
– Alexios
Jan 12 '12 at 13:35
24
This file typically points at 127.0.1.1 on Ubuntu - it's the local DNS cache server, not the actual upstream.
– Barry Kelly
Mar 8 '16 at 10:24
2
@BarryKelly Check what your router uses, then
– Geremia
Mar 11 '16 at 17:10
2
And if you have several upstream server configured ? How to know which one is currently used ?
– Sylvain Leroux
Nov 24 '16 at 23:31
2
I would suggest to mention that file is a link and dynamically generated for systems using resovconf (like Ubuntu). I've seen this answer millions of times and until today is that I think it is correct, because I understand now that it is actually a dynamically generated file.
– jgomo3
Dec 26 '17 at 18:00
|
show 3 more comments
You should be able to get some reasonable information in:
$ cat /etc/resolv.conf
You should be able to get some reasonable information in:
$ cat /etc/resolv.conf
answered Jan 12 '12 at 12:38
user13742
26
However, please be aware that (on modern Linuxen) the contents of/etc/nsswitch.conf
dictate what name services are used (DNS, LDAP, etc) and in what order. Sayfgrep hosts: /etc/nsswitch.conf
. If it only references DNS,/etc/resolv.conf
is the right place to look for your nameservers. But chances are you're also using mDNS (aka ZeroConf, aka Avahi, aka Bonjour, etc), etc. In that case, things depend on what you're using.
– Alexios
Jan 12 '12 at 13:35
24
This file typically points at 127.0.1.1 on Ubuntu - it's the local DNS cache server, not the actual upstream.
– Barry Kelly
Mar 8 '16 at 10:24
2
@BarryKelly Check what your router uses, then
– Geremia
Mar 11 '16 at 17:10
2
And if you have several upstream server configured ? How to know which one is currently used ?
– Sylvain Leroux
Nov 24 '16 at 23:31
2
I would suggest to mention that file is a link and dynamically generated for systems using resovconf (like Ubuntu). I've seen this answer millions of times and until today is that I think it is correct, because I understand now that it is actually a dynamically generated file.
– jgomo3
Dec 26 '17 at 18:00
|
show 3 more comments
26
However, please be aware that (on modern Linuxen) the contents of/etc/nsswitch.conf
dictate what name services are used (DNS, LDAP, etc) and in what order. Sayfgrep hosts: /etc/nsswitch.conf
. If it only references DNS,/etc/resolv.conf
is the right place to look for your nameservers. But chances are you're also using mDNS (aka ZeroConf, aka Avahi, aka Bonjour, etc), etc. In that case, things depend on what you're using.
– Alexios
Jan 12 '12 at 13:35
24
This file typically points at 127.0.1.1 on Ubuntu - it's the local DNS cache server, not the actual upstream.
– Barry Kelly
Mar 8 '16 at 10:24
2
@BarryKelly Check what your router uses, then
– Geremia
Mar 11 '16 at 17:10
2
And if you have several upstream server configured ? How to know which one is currently used ?
– Sylvain Leroux
Nov 24 '16 at 23:31
2
I would suggest to mention that file is a link and dynamically generated for systems using resovconf (like Ubuntu). I've seen this answer millions of times and until today is that I think it is correct, because I understand now that it is actually a dynamically generated file.
– jgomo3
Dec 26 '17 at 18:00
26
26
However, please be aware that (on modern Linuxen) the contents of
/etc/nsswitch.conf
dictate what name services are used (DNS, LDAP, etc) and in what order. Say fgrep hosts: /etc/nsswitch.conf
. If it only references DNS, /etc/resolv.conf
is the right place to look for your nameservers. But chances are you're also using mDNS (aka ZeroConf, aka Avahi, aka Bonjour, etc), etc. In that case, things depend on what you're using.– Alexios
Jan 12 '12 at 13:35
However, please be aware that (on modern Linuxen) the contents of
/etc/nsswitch.conf
dictate what name services are used (DNS, LDAP, etc) and in what order. Say fgrep hosts: /etc/nsswitch.conf
. If it only references DNS, /etc/resolv.conf
is the right place to look for your nameservers. But chances are you're also using mDNS (aka ZeroConf, aka Avahi, aka Bonjour, etc), etc. In that case, things depend on what you're using.– Alexios
Jan 12 '12 at 13:35
24
24
This file typically points at 127.0.1.1 on Ubuntu - it's the local DNS cache server, not the actual upstream.
– Barry Kelly
Mar 8 '16 at 10:24
This file typically points at 127.0.1.1 on Ubuntu - it's the local DNS cache server, not the actual upstream.
– Barry Kelly
Mar 8 '16 at 10:24
2
2
@BarryKelly Check what your router uses, then
– Geremia
Mar 11 '16 at 17:10
@BarryKelly Check what your router uses, then
– Geremia
Mar 11 '16 at 17:10
2
2
And if you have several upstream server configured ? How to know which one is currently used ?
– Sylvain Leroux
Nov 24 '16 at 23:31
And if you have several upstream server configured ? How to know which one is currently used ?
– Sylvain Leroux
Nov 24 '16 at 23:31
2
2
I would suggest to mention that file is a link and dynamically generated for systems using resovconf (like Ubuntu). I've seen this answer millions of times and until today is that I think it is correct, because I understand now that it is actually a dynamically generated file.
– jgomo3
Dec 26 '17 at 18:00
I would suggest to mention that file is a link and dynamically generated for systems using resovconf (like Ubuntu). I've seen this answer millions of times and until today is that I think it is correct, because I understand now that it is actually a dynamically generated file.
– jgomo3
Dec 26 '17 at 18:00
|
show 3 more comments
Here's how I do it:
nmcli dev show | grep DNS
This worked previous to the way above:
nm-tool | grep DNS
13
This one is usefull if you are using VPN and NetworkManager. Your/etc/resolv.conf
will point to your machine, withdnsmasq
resolving names as configured by NetworkManager.
– Grzegorz Żur
May 30 '13 at 11:32
6
On Debian this requires thenetwork-manager
package.
– TranslucentCloud
Feb 3 '15 at 19:44
2
nm-tool is not available in newer linuxes. for example it is not in the 'network-manager' package of debian 8.
– don bright
Oct 31 '15 at 15:06
2
I've updated the answer to reflect what's working for me in 2016.
– Lonniebiz
Sep 1 '16 at 16:36
2
this is the best answer, resolve.conf not always show the truth
– blade
Feb 7 '18 at 22:58
|
show 3 more comments
Here's how I do it:
nmcli dev show | grep DNS
This worked previous to the way above:
nm-tool | grep DNS
13
This one is usefull if you are using VPN and NetworkManager. Your/etc/resolv.conf
will point to your machine, withdnsmasq
resolving names as configured by NetworkManager.
– Grzegorz Żur
May 30 '13 at 11:32
6
On Debian this requires thenetwork-manager
package.
– TranslucentCloud
Feb 3 '15 at 19:44
2
nm-tool is not available in newer linuxes. for example it is not in the 'network-manager' package of debian 8.
– don bright
Oct 31 '15 at 15:06
2
I've updated the answer to reflect what's working for me in 2016.
– Lonniebiz
Sep 1 '16 at 16:36
2
this is the best answer, resolve.conf not always show the truth
– blade
Feb 7 '18 at 22:58
|
show 3 more comments
Here's how I do it:
nmcli dev show | grep DNS
This worked previous to the way above:
nm-tool | grep DNS
Here's how I do it:
nmcli dev show | grep DNS
This worked previous to the way above:
nm-tool | grep DNS
edited Apr 13 '17 at 12:22
Community♦
1
1
answered May 30 '13 at 11:23
LonniebizLonniebiz
2,19241220
2,19241220
13
This one is usefull if you are using VPN and NetworkManager. Your/etc/resolv.conf
will point to your machine, withdnsmasq
resolving names as configured by NetworkManager.
– Grzegorz Żur
May 30 '13 at 11:32
6
On Debian this requires thenetwork-manager
package.
– TranslucentCloud
Feb 3 '15 at 19:44
2
nm-tool is not available in newer linuxes. for example it is not in the 'network-manager' package of debian 8.
– don bright
Oct 31 '15 at 15:06
2
I've updated the answer to reflect what's working for me in 2016.
– Lonniebiz
Sep 1 '16 at 16:36
2
this is the best answer, resolve.conf not always show the truth
– blade
Feb 7 '18 at 22:58
|
show 3 more comments
13
This one is usefull if you are using VPN and NetworkManager. Your/etc/resolv.conf
will point to your machine, withdnsmasq
resolving names as configured by NetworkManager.
– Grzegorz Żur
May 30 '13 at 11:32
6
On Debian this requires thenetwork-manager
package.
– TranslucentCloud
Feb 3 '15 at 19:44
2
nm-tool is not available in newer linuxes. for example it is not in the 'network-manager' package of debian 8.
– don bright
Oct 31 '15 at 15:06
2
I've updated the answer to reflect what's working for me in 2016.
– Lonniebiz
Sep 1 '16 at 16:36
2
this is the best answer, resolve.conf not always show the truth
– blade
Feb 7 '18 at 22:58
13
13
This one is usefull if you are using VPN and NetworkManager. Your
/etc/resolv.conf
will point to your machine, with dnsmasq
resolving names as configured by NetworkManager.– Grzegorz Żur
May 30 '13 at 11:32
This one is usefull if you are using VPN and NetworkManager. Your
/etc/resolv.conf
will point to your machine, with dnsmasq
resolving names as configured by NetworkManager.– Grzegorz Żur
May 30 '13 at 11:32
6
6
On Debian this requires the
network-manager
package.– TranslucentCloud
Feb 3 '15 at 19:44
On Debian this requires the
network-manager
package.– TranslucentCloud
Feb 3 '15 at 19:44
2
2
nm-tool is not available in newer linuxes. for example it is not in the 'network-manager' package of debian 8.
– don bright
Oct 31 '15 at 15:06
nm-tool is not available in newer linuxes. for example it is not in the 'network-manager' package of debian 8.
– don bright
Oct 31 '15 at 15:06
2
2
I've updated the answer to reflect what's working for me in 2016.
– Lonniebiz
Sep 1 '16 at 16:36
I've updated the answer to reflect what's working for me in 2016.
– Lonniebiz
Sep 1 '16 at 16:36
2
2
this is the best answer, resolve.conf not always show the truth
– blade
Feb 7 '18 at 22:58
this is the best answer, resolve.conf not always show the truth
– blade
Feb 7 '18 at 22:58
|
show 3 more comments
I think you can also query DNS and it will show you what server returned the result. Try this:
dig yourserver.somedomain.xyz
And the response should tell you what server(s) returned the result. The output you're interested in will look something like this:
;; Query time: 91 msec
;; SERVER: 172.xxx.xxx.xxx#53(172.xxx.xxx.xxx)
;; WHEN: Tue Apr 02 09:03:41 EDT 2019
;; MSG SIZE rcvd: 207
You can also tell dig
to query a specific DNS server by using dig @server_ip
7
On Debian this requires thednsutils
package.
– Faheem Mitha
Jan 14 '12 at 20:54
5
If you use any DNS masking/caching service that is run on your local machine, it will hide the real DNS servers.
– karatedog
Sep 7 '15 at 9:12
2
Ubuntu 18.04 just shows the local dns cache:SERVER: 127.0.0.53#53(127.0.0.53)
– wisbucky
Nov 14 '18 at 2:16
add a comment |
I think you can also query DNS and it will show you what server returned the result. Try this:
dig yourserver.somedomain.xyz
And the response should tell you what server(s) returned the result. The output you're interested in will look something like this:
;; Query time: 91 msec
;; SERVER: 172.xxx.xxx.xxx#53(172.xxx.xxx.xxx)
;; WHEN: Tue Apr 02 09:03:41 EDT 2019
;; MSG SIZE rcvd: 207
You can also tell dig
to query a specific DNS server by using dig @server_ip
7
On Debian this requires thednsutils
package.
– Faheem Mitha
Jan 14 '12 at 20:54
5
If you use any DNS masking/caching service that is run on your local machine, it will hide the real DNS servers.
– karatedog
Sep 7 '15 at 9:12
2
Ubuntu 18.04 just shows the local dns cache:SERVER: 127.0.0.53#53(127.0.0.53)
– wisbucky
Nov 14 '18 at 2:16
add a comment |
I think you can also query DNS and it will show you what server returned the result. Try this:
dig yourserver.somedomain.xyz
And the response should tell you what server(s) returned the result. The output you're interested in will look something like this:
;; Query time: 91 msec
;; SERVER: 172.xxx.xxx.xxx#53(172.xxx.xxx.xxx)
;; WHEN: Tue Apr 02 09:03:41 EDT 2019
;; MSG SIZE rcvd: 207
You can also tell dig
to query a specific DNS server by using dig @server_ip
I think you can also query DNS and it will show you what server returned the result. Try this:
dig yourserver.somedomain.xyz
And the response should tell you what server(s) returned the result. The output you're interested in will look something like this:
;; Query time: 91 msec
;; SERVER: 172.xxx.xxx.xxx#53(172.xxx.xxx.xxx)
;; WHEN: Tue Apr 02 09:03:41 EDT 2019
;; MSG SIZE rcvd: 207
You can also tell dig
to query a specific DNS server by using dig @server_ip
edited 2 days ago
answered Jan 12 '12 at 18:08
FreiheitFreiheit
6,11111114
6,11111114
7
On Debian this requires thednsutils
package.
– Faheem Mitha
Jan 14 '12 at 20:54
5
If you use any DNS masking/caching service that is run on your local machine, it will hide the real DNS servers.
– karatedog
Sep 7 '15 at 9:12
2
Ubuntu 18.04 just shows the local dns cache:SERVER: 127.0.0.53#53(127.0.0.53)
– wisbucky
Nov 14 '18 at 2:16
add a comment |
7
On Debian this requires thednsutils
package.
– Faheem Mitha
Jan 14 '12 at 20:54
5
If you use any DNS masking/caching service that is run on your local machine, it will hide the real DNS servers.
– karatedog
Sep 7 '15 at 9:12
2
Ubuntu 18.04 just shows the local dns cache:SERVER: 127.0.0.53#53(127.0.0.53)
– wisbucky
Nov 14 '18 at 2:16
7
7
On Debian this requires the
dnsutils
package.– Faheem Mitha
Jan 14 '12 at 20:54
On Debian this requires the
dnsutils
package.– Faheem Mitha
Jan 14 '12 at 20:54
5
5
If you use any DNS masking/caching service that is run on your local machine, it will hide the real DNS servers.
– karatedog
Sep 7 '15 at 9:12
If you use any DNS masking/caching service that is run on your local machine, it will hide the real DNS servers.
– karatedog
Sep 7 '15 at 9:12
2
2
Ubuntu 18.04 just shows the local dns cache:
SERVER: 127.0.0.53#53(127.0.0.53)
– wisbucky
Nov 14 '18 at 2:16
Ubuntu 18.04 just shows the local dns cache:
SERVER: 127.0.0.53#53(127.0.0.53)
– wisbucky
Nov 14 '18 at 2:16
add a comment |
Just do an, nslookup
. Part of its results include the server that it's using.
In the example below, it shows that the DNS server used is at 8.8.8.8.
$ nslookup google.com
Server: 8.8.8.8
Address: 8.8.8.8#53
Non-authoritative answer:
Name: google.com
Address: 172.217.22.174
1
can you give an example of what to enter in the prompt?
– chovy
Jan 14 '16 at 6:41
Example:$ nslookup www.google.com
– Ren
Feb 13 '16 at 23:50
6
On Debian this requires thednsutils
package.
– Gayan Weerakutti
Aug 13 '17 at 7:00
5
On a recent Ubuntu, this again points to the local cache server 127.0.0.1 as already hinted at in this comment
– FriendFX
Dec 1 '17 at 1:50
In CentOS 7 it quits with error, but it is a vm so I didnslookup google.com
in the Windows host and I found the nameserver. Add it in/etc/resolv.conf
like:nameserver xx.xx.xx.xx
and restart servicenetwork
, and all is fine. Praise you.
– WesternGun
May 3 '18 at 15:22
add a comment |
Just do an, nslookup
. Part of its results include the server that it's using.
In the example below, it shows that the DNS server used is at 8.8.8.8.
$ nslookup google.com
Server: 8.8.8.8
Address: 8.8.8.8#53
Non-authoritative answer:
Name: google.com
Address: 172.217.22.174
1
can you give an example of what to enter in the prompt?
– chovy
Jan 14 '16 at 6:41
Example:$ nslookup www.google.com
– Ren
Feb 13 '16 at 23:50
6
On Debian this requires thednsutils
package.
– Gayan Weerakutti
Aug 13 '17 at 7:00
5
On a recent Ubuntu, this again points to the local cache server 127.0.0.1 as already hinted at in this comment
– FriendFX
Dec 1 '17 at 1:50
In CentOS 7 it quits with error, but it is a vm so I didnslookup google.com
in the Windows host and I found the nameserver. Add it in/etc/resolv.conf
like:nameserver xx.xx.xx.xx
and restart servicenetwork
, and all is fine. Praise you.
– WesternGun
May 3 '18 at 15:22
add a comment |
Just do an, nslookup
. Part of its results include the server that it's using.
In the example below, it shows that the DNS server used is at 8.8.8.8.
$ nslookup google.com
Server: 8.8.8.8
Address: 8.8.8.8#53
Non-authoritative answer:
Name: google.com
Address: 172.217.22.174
Just do an, nslookup
. Part of its results include the server that it's using.
In the example below, it shows that the DNS server used is at 8.8.8.8.
$ nslookup google.com
Server: 8.8.8.8
Address: 8.8.8.8#53
Non-authoritative answer:
Name: google.com
Address: 172.217.22.174
edited Jan 9 '17 at 11:44
Mads Skjern
2671310
2671310
answered Feb 26 '15 at 2:45
SamSam
49142
49142
1
can you give an example of what to enter in the prompt?
– chovy
Jan 14 '16 at 6:41
Example:$ nslookup www.google.com
– Ren
Feb 13 '16 at 23:50
6
On Debian this requires thednsutils
package.
– Gayan Weerakutti
Aug 13 '17 at 7:00
5
On a recent Ubuntu, this again points to the local cache server 127.0.0.1 as already hinted at in this comment
– FriendFX
Dec 1 '17 at 1:50
In CentOS 7 it quits with error, but it is a vm so I didnslookup google.com
in the Windows host and I found the nameserver. Add it in/etc/resolv.conf
like:nameserver xx.xx.xx.xx
and restart servicenetwork
, and all is fine. Praise you.
– WesternGun
May 3 '18 at 15:22
add a comment |
1
can you give an example of what to enter in the prompt?
– chovy
Jan 14 '16 at 6:41
Example:$ nslookup www.google.com
– Ren
Feb 13 '16 at 23:50
6
On Debian this requires thednsutils
package.
– Gayan Weerakutti
Aug 13 '17 at 7:00
5
On a recent Ubuntu, this again points to the local cache server 127.0.0.1 as already hinted at in this comment
– FriendFX
Dec 1 '17 at 1:50
In CentOS 7 it quits with error, but it is a vm so I didnslookup google.com
in the Windows host and I found the nameserver. Add it in/etc/resolv.conf
like:nameserver xx.xx.xx.xx
and restart servicenetwork
, and all is fine. Praise you.
– WesternGun
May 3 '18 at 15:22
1
1
can you give an example of what to enter in the prompt?
– chovy
Jan 14 '16 at 6:41
can you give an example of what to enter in the prompt?
– chovy
Jan 14 '16 at 6:41
Example:
$ nslookup www.google.com
– Ren
Feb 13 '16 at 23:50
Example:
$ nslookup www.google.com
– Ren
Feb 13 '16 at 23:50
6
6
On Debian this requires the
dnsutils
package.– Gayan Weerakutti
Aug 13 '17 at 7:00
On Debian this requires the
dnsutils
package.– Gayan Weerakutti
Aug 13 '17 at 7:00
5
5
On a recent Ubuntu, this again points to the local cache server 127.0.0.1 as already hinted at in this comment
– FriendFX
Dec 1 '17 at 1:50
On a recent Ubuntu, this again points to the local cache server 127.0.0.1 as already hinted at in this comment
– FriendFX
Dec 1 '17 at 1:50
In CentOS 7 it quits with error, but it is a vm so I did
nslookup google.com
in the Windows host and I found the nameserver. Add it in /etc/resolv.conf
like: nameserver xx.xx.xx.xx
and restart service network
, and all is fine. Praise you.– WesternGun
May 3 '18 at 15:22
In CentOS 7 it quits with error, but it is a vm so I did
nslookup google.com
in the Windows host and I found the nameserver. Add it in /etc/resolv.conf
like: nameserver xx.xx.xx.xx
and restart service network
, and all is fine. Praise you.– WesternGun
May 3 '18 at 15:22
add a comment |
On systems running systemd use:
systemd-resolve --status
2
systemd-resolve: unrecognized option '--status'
– A-B-B
Apr 1 '18 at 18:03
@A-B-B system? systemd version?
– G32RW
Apr 1 '18 at 20:21
229-4ubuntu21.2
– A-B-B
Apr 1 '18 at 23:34
7
This is the new default way to do it in Ubuntu 18.04 Bionic Beaver - get used to it, everybody!
– AveryFreeman
Apr 24 '18 at 20:32
4
This is the only solution that worked for me, as the others returned 127.0.0.53
– greuze
Oct 25 '18 at 7:50
|
show 1 more comment
On systems running systemd use:
systemd-resolve --status
2
systemd-resolve: unrecognized option '--status'
– A-B-B
Apr 1 '18 at 18:03
@A-B-B system? systemd version?
– G32RW
Apr 1 '18 at 20:21
229-4ubuntu21.2
– A-B-B
Apr 1 '18 at 23:34
7
This is the new default way to do it in Ubuntu 18.04 Bionic Beaver - get used to it, everybody!
– AveryFreeman
Apr 24 '18 at 20:32
4
This is the only solution that worked for me, as the others returned 127.0.0.53
– greuze
Oct 25 '18 at 7:50
|
show 1 more comment
On systems running systemd use:
systemd-resolve --status
On systems running systemd use:
systemd-resolve --status
answered Mar 31 '18 at 23:26
G32RWG32RW
48445
48445
2
systemd-resolve: unrecognized option '--status'
– A-B-B
Apr 1 '18 at 18:03
@A-B-B system? systemd version?
– G32RW
Apr 1 '18 at 20:21
229-4ubuntu21.2
– A-B-B
Apr 1 '18 at 23:34
7
This is the new default way to do it in Ubuntu 18.04 Bionic Beaver - get used to it, everybody!
– AveryFreeman
Apr 24 '18 at 20:32
4
This is the only solution that worked for me, as the others returned 127.0.0.53
– greuze
Oct 25 '18 at 7:50
|
show 1 more comment
2
systemd-resolve: unrecognized option '--status'
– A-B-B
Apr 1 '18 at 18:03
@A-B-B system? systemd version?
– G32RW
Apr 1 '18 at 20:21
229-4ubuntu21.2
– A-B-B
Apr 1 '18 at 23:34
7
This is the new default way to do it in Ubuntu 18.04 Bionic Beaver - get used to it, everybody!
– AveryFreeman
Apr 24 '18 at 20:32
4
This is the only solution that worked for me, as the others returned 127.0.0.53
– greuze
Oct 25 '18 at 7:50
2
2
systemd-resolve: unrecognized option '--status'
– A-B-B
Apr 1 '18 at 18:03
systemd-resolve: unrecognized option '--status'
– A-B-B
Apr 1 '18 at 18:03
@A-B-B system? systemd version?
– G32RW
Apr 1 '18 at 20:21
@A-B-B system? systemd version?
– G32RW
Apr 1 '18 at 20:21
229-4ubuntu21.2
– A-B-B
Apr 1 '18 at 23:34
229-4ubuntu21.2
– A-B-B
Apr 1 '18 at 23:34
7
7
This is the new default way to do it in Ubuntu 18.04 Bionic Beaver - get used to it, everybody!
– AveryFreeman
Apr 24 '18 at 20:32
This is the new default way to do it in Ubuntu 18.04 Bionic Beaver - get used to it, everybody!
– AveryFreeman
Apr 24 '18 at 20:32
4
4
This is the only solution that worked for me, as the others returned 127.0.0.53
– greuze
Oct 25 '18 at 7:50
This is the only solution that worked for me, as the others returned 127.0.0.53
– greuze
Oct 25 '18 at 7:50
|
show 1 more comment
With the new network-manager
command nmcli
, do this:
nmcli --fields ipv4.dns,ipv6.dns con show <connection_name>
On newer versions of network-manager (such as in Ubuntu 16.04), the field names are slightly different:
nmcli --fields ip4.dns,ip6.dns con show <connection_name>
If you don't know the connection name, use:
nmcli -t --fields NAME con show --active
For example:
$ nmcli --fields ip4.dns,ip6.dns con show 'Wired connection 1'
IP4.DNS[1]: 172.21.0.13
IP4.DNS[2]: 172.21.0.4
My results:order «con» «show» is not valid
.
– Sopalajo de Arrierez
Jan 30 '16 at 22:03
It works fine for me with network-manager 1.0.4 on Ubuntu 15.10. Maybe you have an older version?
– Sameer
Mar 17 '16 at 5:40
The tabular format is pretty bad. I hope to get a column like format similar to Powershell.
– CMCDragonkai
Mar 14 '17 at 6:42
1
ReturnsError: invalid field 'ip4.dns'; allowed fields: NAME,UUID,TYPE,TIMESTAMP,TIMESTAMP-REAL,AUTOCONNECT,AUTOCONNECT-PRIORITY,READONLY,DBUS-PATH,ACTIVE,DEVICE,STATE,ACTIVE-PATH.
– FriendFX
Dec 1 '17 at 1:53
add a comment |
With the new network-manager
command nmcli
, do this:
nmcli --fields ipv4.dns,ipv6.dns con show <connection_name>
On newer versions of network-manager (such as in Ubuntu 16.04), the field names are slightly different:
nmcli --fields ip4.dns,ip6.dns con show <connection_name>
If you don't know the connection name, use:
nmcli -t --fields NAME con show --active
For example:
$ nmcli --fields ip4.dns,ip6.dns con show 'Wired connection 1'
IP4.DNS[1]: 172.21.0.13
IP4.DNS[2]: 172.21.0.4
My results:order «con» «show» is not valid
.
– Sopalajo de Arrierez
Jan 30 '16 at 22:03
It works fine for me with network-manager 1.0.4 on Ubuntu 15.10. Maybe you have an older version?
– Sameer
Mar 17 '16 at 5:40
The tabular format is pretty bad. I hope to get a column like format similar to Powershell.
– CMCDragonkai
Mar 14 '17 at 6:42
1
ReturnsError: invalid field 'ip4.dns'; allowed fields: NAME,UUID,TYPE,TIMESTAMP,TIMESTAMP-REAL,AUTOCONNECT,AUTOCONNECT-PRIORITY,READONLY,DBUS-PATH,ACTIVE,DEVICE,STATE,ACTIVE-PATH.
– FriendFX
Dec 1 '17 at 1:53
add a comment |
With the new network-manager
command nmcli
, do this:
nmcli --fields ipv4.dns,ipv6.dns con show <connection_name>
On newer versions of network-manager (such as in Ubuntu 16.04), the field names are slightly different:
nmcli --fields ip4.dns,ip6.dns con show <connection_name>
If you don't know the connection name, use:
nmcli -t --fields NAME con show --active
For example:
$ nmcli --fields ip4.dns,ip6.dns con show 'Wired connection 1'
IP4.DNS[1]: 172.21.0.13
IP4.DNS[2]: 172.21.0.4
With the new network-manager
command nmcli
, do this:
nmcli --fields ipv4.dns,ipv6.dns con show <connection_name>
On newer versions of network-manager (such as in Ubuntu 16.04), the field names are slightly different:
nmcli --fields ip4.dns,ip6.dns con show <connection_name>
If you don't know the connection name, use:
nmcli -t --fields NAME con show --active
For example:
$ nmcli --fields ip4.dns,ip6.dns con show 'Wired connection 1'
IP4.DNS[1]: 172.21.0.13
IP4.DNS[2]: 172.21.0.4
edited Jul 2 '16 at 15:14
nturner
1034
1034
answered Nov 16 '15 at 1:28
SameerSameer
23123
23123
My results:order «con» «show» is not valid
.
– Sopalajo de Arrierez
Jan 30 '16 at 22:03
It works fine for me with network-manager 1.0.4 on Ubuntu 15.10. Maybe you have an older version?
– Sameer
Mar 17 '16 at 5:40
The tabular format is pretty bad. I hope to get a column like format similar to Powershell.
– CMCDragonkai
Mar 14 '17 at 6:42
1
ReturnsError: invalid field 'ip4.dns'; allowed fields: NAME,UUID,TYPE,TIMESTAMP,TIMESTAMP-REAL,AUTOCONNECT,AUTOCONNECT-PRIORITY,READONLY,DBUS-PATH,ACTIVE,DEVICE,STATE,ACTIVE-PATH.
– FriendFX
Dec 1 '17 at 1:53
add a comment |
My results:order «con» «show» is not valid
.
– Sopalajo de Arrierez
Jan 30 '16 at 22:03
It works fine for me with network-manager 1.0.4 on Ubuntu 15.10. Maybe you have an older version?
– Sameer
Mar 17 '16 at 5:40
The tabular format is pretty bad. I hope to get a column like format similar to Powershell.
– CMCDragonkai
Mar 14 '17 at 6:42
1
ReturnsError: invalid field 'ip4.dns'; allowed fields: NAME,UUID,TYPE,TIMESTAMP,TIMESTAMP-REAL,AUTOCONNECT,AUTOCONNECT-PRIORITY,READONLY,DBUS-PATH,ACTIVE,DEVICE,STATE,ACTIVE-PATH.
– FriendFX
Dec 1 '17 at 1:53
My results:
order «con» «show» is not valid
.– Sopalajo de Arrierez
Jan 30 '16 at 22:03
My results:
order «con» «show» is not valid
.– Sopalajo de Arrierez
Jan 30 '16 at 22:03
It works fine for me with network-manager 1.0.4 on Ubuntu 15.10. Maybe you have an older version?
– Sameer
Mar 17 '16 at 5:40
It works fine for me with network-manager 1.0.4 on Ubuntu 15.10. Maybe you have an older version?
– Sameer
Mar 17 '16 at 5:40
The tabular format is pretty bad. I hope to get a column like format similar to Powershell.
– CMCDragonkai
Mar 14 '17 at 6:42
The tabular format is pretty bad. I hope to get a column like format similar to Powershell.
– CMCDragonkai
Mar 14 '17 at 6:42
1
1
Returns
Error: invalid field 'ip4.dns'; allowed fields: NAME,UUID,TYPE,TIMESTAMP,TIMESTAMP-REAL,AUTOCONNECT,AUTOCONNECT-PRIORITY,READONLY,DBUS-PATH,ACTIVE,DEVICE,STATE,ACTIVE-PATH.
– FriendFX
Dec 1 '17 at 1:53
Returns
Error: invalid field 'ip4.dns'; allowed fields: NAME,UUID,TYPE,TIMESTAMP,TIMESTAMP-REAL,AUTOCONNECT,AUTOCONNECT-PRIORITY,READONLY,DBUS-PATH,ACTIVE,DEVICE,STATE,ACTIVE-PATH.
– FriendFX
Dec 1 '17 at 1:53
add a comment |
If you are using network manager probably you get all network parameters from your dhcp server at your university.
If you don't want use your shell to check your dns settings (as described by hesse and Alexios), you can see them from the panel "Network information".
You can reach this panel by pressing right mouse button on network manager icon and selecting "Connection Information" from the menu.
add a comment |
If you are using network manager probably you get all network parameters from your dhcp server at your university.
If you don't want use your shell to check your dns settings (as described by hesse and Alexios), you can see them from the panel "Network information".
You can reach this panel by pressing right mouse button on network manager icon and selecting "Connection Information" from the menu.
add a comment |
If you are using network manager probably you get all network parameters from your dhcp server at your university.
If you don't want use your shell to check your dns settings (as described by hesse and Alexios), you can see them from the panel "Network information".
You can reach this panel by pressing right mouse button on network manager icon and selecting "Connection Information" from the menu.
If you are using network manager probably you get all network parameters from your dhcp server at your university.
If you don't want use your shell to check your dns settings (as described by hesse and Alexios), you can see them from the panel "Network information".
You can reach this panel by pressing right mouse button on network manager icon and selecting "Connection Information" from the menu.
answered Jan 24 '12 at 5:30
tombolinuxtombolinux
34727
34727
add a comment |
add a comment |
to get the first DNS SERVER (IP only) :
cat /etc/resolv.conf |grep -i '^nameserver'|head -n1|cut -d ' ' -f2
cat
will output DNS configgrep
filters only nameserverhead
will keep only the first row/instancecut
take the ip part of the row (second column with ' ' as separator)
To put DNS ip in an environment variable, you could use as follow:
export THEDNSSERVER=$(cat /etc/resolv.conf |grep -i '^nameserver'|head -n1|cut -d ' ' -f2)
1
grep -m 1
stops matching after first match so you don't have to usehead
– sshow
Jul 28 '17 at 8:30
To lighten the pipeline even more, capture groups with Perl regexp is very neat, and grep takes a file argument:grep -Pom 1 '^nameserver KS+' /etc/resolv.conf
. Just wrote up Capture groups with grep perl regular expression
– sshow
Jul 28 '17 at 9:04
add a comment |
to get the first DNS SERVER (IP only) :
cat /etc/resolv.conf |grep -i '^nameserver'|head -n1|cut -d ' ' -f2
cat
will output DNS configgrep
filters only nameserverhead
will keep only the first row/instancecut
take the ip part of the row (second column with ' ' as separator)
To put DNS ip in an environment variable, you could use as follow:
export THEDNSSERVER=$(cat /etc/resolv.conf |grep -i '^nameserver'|head -n1|cut -d ' ' -f2)
1
grep -m 1
stops matching after first match so you don't have to usehead
– sshow
Jul 28 '17 at 8:30
To lighten the pipeline even more, capture groups with Perl regexp is very neat, and grep takes a file argument:grep -Pom 1 '^nameserver KS+' /etc/resolv.conf
. Just wrote up Capture groups with grep perl regular expression
– sshow
Jul 28 '17 at 9:04
add a comment |
to get the first DNS SERVER (IP only) :
cat /etc/resolv.conf |grep -i '^nameserver'|head -n1|cut -d ' ' -f2
cat
will output DNS configgrep
filters only nameserverhead
will keep only the first row/instancecut
take the ip part of the row (second column with ' ' as separator)
To put DNS ip in an environment variable, you could use as follow:
export THEDNSSERVER=$(cat /etc/resolv.conf |grep -i '^nameserver'|head -n1|cut -d ' ' -f2)
to get the first DNS SERVER (IP only) :
cat /etc/resolv.conf |grep -i '^nameserver'|head -n1|cut -d ' ' -f2
cat
will output DNS configgrep
filters only nameserverhead
will keep only the first row/instancecut
take the ip part of the row (second column with ' ' as separator)
To put DNS ip in an environment variable, you could use as follow:
export THEDNSSERVER=$(cat /etc/resolv.conf |grep -i '^nameserver'|head -n1|cut -d ' ' -f2)
edited Jul 26 '17 at 13:41
T77
32
32
answered Mar 27 '15 at 9:19
boly38boly38
17112
17112
1
grep -m 1
stops matching after first match so you don't have to usehead
– sshow
Jul 28 '17 at 8:30
To lighten the pipeline even more, capture groups with Perl regexp is very neat, and grep takes a file argument:grep -Pom 1 '^nameserver KS+' /etc/resolv.conf
. Just wrote up Capture groups with grep perl regular expression
– sshow
Jul 28 '17 at 9:04
add a comment |
1
grep -m 1
stops matching after first match so you don't have to usehead
– sshow
Jul 28 '17 at 8:30
To lighten the pipeline even more, capture groups with Perl regexp is very neat, and grep takes a file argument:grep -Pom 1 '^nameserver KS+' /etc/resolv.conf
. Just wrote up Capture groups with grep perl regular expression
– sshow
Jul 28 '17 at 9:04
1
1
grep -m 1
stops matching after first match so you don't have to use head
– sshow
Jul 28 '17 at 8:30
grep -m 1
stops matching after first match so you don't have to use head
– sshow
Jul 28 '17 at 8:30
To lighten the pipeline even more, capture groups with Perl regexp is very neat, and grep takes a file argument:
grep -Pom 1 '^nameserver KS+' /etc/resolv.conf
. Just wrote up Capture groups with grep perl regular expression– sshow
Jul 28 '17 at 9:04
To lighten the pipeline even more, capture groups with Perl regexp is very neat, and grep takes a file argument:
grep -Pom 1 '^nameserver KS+' /etc/resolv.conf
. Just wrote up Capture groups with grep perl regular expression– sshow
Jul 28 '17 at 9:04
add a comment |
The command
nmcli dev list iface <interfacename> | grep IP4
Replace "interfacename" with yours.
examlpe
nmcli dev list iface eth0 | grep IP4
This will list all DNS servers(If you use more than one).
nmcli dev list iface [devicename]
is the correct command
– sebix
May 18 '15 at 17:33
I haven't noticed <interface> is hidden since i use <>
– Maythux
May 19 '15 at 5:53
1
On debian i get an error--- $ nmcli dev list iface eth0 Error: 'dev' command 'list' is not valid.
– don bright
Oct 31 '15 at 15:00
nmcli is a RH specific command.
– Rui F Ribeiro
Nov 16 '15 at 7:42
This is correct answer!
– VAdaihiep
Aug 10 '18 at 8:00
add a comment |
The command
nmcli dev list iface <interfacename> | grep IP4
Replace "interfacename" with yours.
examlpe
nmcli dev list iface eth0 | grep IP4
This will list all DNS servers(If you use more than one).
nmcli dev list iface [devicename]
is the correct command
– sebix
May 18 '15 at 17:33
I haven't noticed <interface> is hidden since i use <>
– Maythux
May 19 '15 at 5:53
1
On debian i get an error--- $ nmcli dev list iface eth0 Error: 'dev' command 'list' is not valid.
– don bright
Oct 31 '15 at 15:00
nmcli is a RH specific command.
– Rui F Ribeiro
Nov 16 '15 at 7:42
This is correct answer!
– VAdaihiep
Aug 10 '18 at 8:00
add a comment |
The command
nmcli dev list iface <interfacename> | grep IP4
Replace "interfacename" with yours.
examlpe
nmcli dev list iface eth0 | grep IP4
This will list all DNS servers(If you use more than one).
The command
nmcli dev list iface <interfacename> | grep IP4
Replace "interfacename" with yours.
examlpe
nmcli dev list iface eth0 | grep IP4
This will list all DNS servers(If you use more than one).
edited May 19 '15 at 5:53
answered Mar 27 '15 at 9:44
MaythuxMaythux
1,153816
1,153816
nmcli dev list iface [devicename]
is the correct command
– sebix
May 18 '15 at 17:33
I haven't noticed <interface> is hidden since i use <>
– Maythux
May 19 '15 at 5:53
1
On debian i get an error--- $ nmcli dev list iface eth0 Error: 'dev' command 'list' is not valid.
– don bright
Oct 31 '15 at 15:00
nmcli is a RH specific command.
– Rui F Ribeiro
Nov 16 '15 at 7:42
This is correct answer!
– VAdaihiep
Aug 10 '18 at 8:00
add a comment |
nmcli dev list iface [devicename]
is the correct command
– sebix
May 18 '15 at 17:33
I haven't noticed <interface> is hidden since i use <>
– Maythux
May 19 '15 at 5:53
1
On debian i get an error--- $ nmcli dev list iface eth0 Error: 'dev' command 'list' is not valid.
– don bright
Oct 31 '15 at 15:00
nmcli is a RH specific command.
– Rui F Ribeiro
Nov 16 '15 at 7:42
This is correct answer!
– VAdaihiep
Aug 10 '18 at 8:00
nmcli dev list iface [devicename]
is the correct command– sebix
May 18 '15 at 17:33
nmcli dev list iface [devicename]
is the correct command– sebix
May 18 '15 at 17:33
I haven't noticed <interface> is hidden since i use <>
– Maythux
May 19 '15 at 5:53
I haven't noticed <interface> is hidden since i use <>
– Maythux
May 19 '15 at 5:53
1
1
On debian i get an error--- $ nmcli dev list iface eth0 Error: 'dev' command 'list' is not valid.
– don bright
Oct 31 '15 at 15:00
On debian i get an error--- $ nmcli dev list iface eth0 Error: 'dev' command 'list' is not valid.
– don bright
Oct 31 '15 at 15:00
nmcli is a RH specific command.
– Rui F Ribeiro
Nov 16 '15 at 7:42
nmcli is a RH specific command.
– Rui F Ribeiro
Nov 16 '15 at 7:42
This is correct answer!
– VAdaihiep
Aug 10 '18 at 8:00
This is correct answer!
– VAdaihiep
Aug 10 '18 at 8:00
add a comment |
I have Fedora 25 and also had similar slow response on command line to sudo commands.
nmcli dev show | grep DNS
showed that only one of my 3 adapters (two active) had DNS entries.
By adding DNS entries to the one active card that didn't have an entry - presto!
All is good and response time is immediate.
add a comment |
I have Fedora 25 and also had similar slow response on command line to sudo commands.
nmcli dev show | grep DNS
showed that only one of my 3 adapters (two active) had DNS entries.
By adding DNS entries to the one active card that didn't have an entry - presto!
All is good and response time is immediate.
add a comment |
I have Fedora 25 and also had similar slow response on command line to sudo commands.
nmcli dev show | grep DNS
showed that only one of my 3 adapters (two active) had DNS entries.
By adding DNS entries to the one active card that didn't have an entry - presto!
All is good and response time is immediate.
I have Fedora 25 and also had similar slow response on command line to sudo commands.
nmcli dev show | grep DNS
showed that only one of my 3 adapters (two active) had DNS entries.
By adding DNS entries to the one active card that didn't have an entry - presto!
All is good and response time is immediate.
edited Dec 18 '17 at 0:51
Jeff Schaller♦
44.6k1162145
44.6k1162145
answered Dec 2 '17 at 22:29
CRTLBREAKCRTLBREAK
391
391
add a comment |
add a comment |
Using resolvectl
$ resolvectl status | grep -1 'DNS Server'
DNSSEC supported: no
Current DNS Server: 1.1.1.1
DNS Servers: 1.1.1.1
1.0.0.1
For compatibility, systemd-resolve
is a symbolic link to resolvectl
on many distros as for Ubuntu 18.10:
$ type -a systemd-resolve
systemd-resolve is /usr/bin/systemd-resolve
$ ll /usr/bin/systemd-resolve
lrwxrwxrwx 1 root root 10 nov. 15 21:42 /usr/bin/systemd-resolve -> resolvectl
$ type -a resolvectl
resolvectl is /usr/bin/resolvectl
$ file /usr/bin/resolvectl
/usr/bin/resolvectl: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 3.2.0, BuildID[sha1]=09e488e849e3b988dd2ac93b024bbba18bb71814, stripped
works perfect on Ubuntu 18.10.
– Georgе Stoyanov
Mar 27 at 16:02
add a comment |
Using resolvectl
$ resolvectl status | grep -1 'DNS Server'
DNSSEC supported: no
Current DNS Server: 1.1.1.1
DNS Servers: 1.1.1.1
1.0.0.1
For compatibility, systemd-resolve
is a symbolic link to resolvectl
on many distros as for Ubuntu 18.10:
$ type -a systemd-resolve
systemd-resolve is /usr/bin/systemd-resolve
$ ll /usr/bin/systemd-resolve
lrwxrwxrwx 1 root root 10 nov. 15 21:42 /usr/bin/systemd-resolve -> resolvectl
$ type -a resolvectl
resolvectl is /usr/bin/resolvectl
$ file /usr/bin/resolvectl
/usr/bin/resolvectl: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 3.2.0, BuildID[sha1]=09e488e849e3b988dd2ac93b024bbba18bb71814, stripped
works perfect on Ubuntu 18.10.
– Georgе Stoyanov
Mar 27 at 16:02
add a comment |
Using resolvectl
$ resolvectl status | grep -1 'DNS Server'
DNSSEC supported: no
Current DNS Server: 1.1.1.1
DNS Servers: 1.1.1.1
1.0.0.1
For compatibility, systemd-resolve
is a symbolic link to resolvectl
on many distros as for Ubuntu 18.10:
$ type -a systemd-resolve
systemd-resolve is /usr/bin/systemd-resolve
$ ll /usr/bin/systemd-resolve
lrwxrwxrwx 1 root root 10 nov. 15 21:42 /usr/bin/systemd-resolve -> resolvectl
$ type -a resolvectl
resolvectl is /usr/bin/resolvectl
$ file /usr/bin/resolvectl
/usr/bin/resolvectl: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 3.2.0, BuildID[sha1]=09e488e849e3b988dd2ac93b024bbba18bb71814, stripped
Using resolvectl
$ resolvectl status | grep -1 'DNS Server'
DNSSEC supported: no
Current DNS Server: 1.1.1.1
DNS Servers: 1.1.1.1
1.0.0.1
For compatibility, systemd-resolve
is a symbolic link to resolvectl
on many distros as for Ubuntu 18.10:
$ type -a systemd-resolve
systemd-resolve is /usr/bin/systemd-resolve
$ ll /usr/bin/systemd-resolve
lrwxrwxrwx 1 root root 10 nov. 15 21:42 /usr/bin/systemd-resolve -> resolvectl
$ type -a resolvectl
resolvectl is /usr/bin/resolvectl
$ file /usr/bin/resolvectl
/usr/bin/resolvectl: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 3.2.0, BuildID[sha1]=09e488e849e3b988dd2ac93b024bbba18bb71814, stripped
answered Dec 2 '18 at 14:13
olibreolibre
7901618
7901618
works perfect on Ubuntu 18.10.
– Georgе Stoyanov
Mar 27 at 16:02
add a comment |
works perfect on Ubuntu 18.10.
– Georgе Stoyanov
Mar 27 at 16:02
works perfect on Ubuntu 18.10.
– Georgе Stoyanov
Mar 27 at 16:02
works perfect on Ubuntu 18.10.
– Georgе Stoyanov
Mar 27 at 16:02
add a comment |
In CentOS, you can use:
/usr/sbin/named -v
add a comment |
In CentOS, you can use:
/usr/sbin/named -v
add a comment |
In CentOS, you can use:
/usr/sbin/named -v
In CentOS, you can use:
/usr/sbin/named -v
answered Nov 27 '17 at 5:32
Miloud EloumriMiloud Eloumri
1011
1011
add a comment |
add a comment |
protected by Community♦ Sep 6 '18 at 23:49
Thank you for your interest in this question.
Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).
Would you like to answer one of these unanswered questions instead?