LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (http://www.linuxquestions.org/questions/slackware-14/)
-   -   Command to know dns ? (http://www.linuxquestions.org/questions/slackware-14/command-to-know-dns-4175451031/)

afreitascs 02-20-2013 08:46 PM

Command to know dns ?
 
With what command says dns I am using in slackware?

thanks

stormtracknole 02-20-2013 09:11 PM

Quote:

Originally Posted by afreitascs (Post 4896357)
With what command says dns I am using in slackware?

thanks

cat /etc/resolv.conf maybe? If I understood your question correctly.

afreitascs 02-20-2013 09:22 PM

Quote:

Originally Posted by stormtracknole (Post 4896366)
cat /etc/resolv.conf maybe? If I understood your question correctly.

thanks for the replies

Quote:

$ cat /etc/resolv.conf
# Generated by NetworkManager
nameserver 192.168.1.1
I was wondering, with which command shows me the dns server I use to surf the internet

very thanks

stormtracknole 02-20-2013 09:25 PM

Your dns in this case would be: 192.168.1.1

afreitascs 02-20-2013 09:35 PM

Quote:

Originally Posted by stormtracknole (Post 4896375)
Your dns in this case would be: 192.168.1.1

thanks for the replies and patience

my dns is configured to use Google Public DNS!

Quote:

8.8.8.8
8.8.4.4
I want to know what command tells me this?

thanks

shrourdian 02-20-2013 09:42 PM

hi, i use dig or nslookup command

afreitascs 02-20-2013 09:53 PM

Quote:

Originally Posted by shrourdian (Post 4896383)
hi, i use dig or nslookup command

thanks for the replies

please you care to explicitly better your answer?

thanks

kikinovak 02-20-2013 10:29 PM

Quote:

Originally Posted by afreitascs (Post 4896385)
thanks for the replies

please you care to explicitly better your answer?

thanks

Right here goes.

1) If you're using DHCP, the DHCP server will write the DNS server(s) in your /etc/resolv.conf. On a desktop client in my office, here's how that looks:

Code:

[kikinovak@alphamule:~] $ cat /etc/resolv.conf
# Generated by dhcpcd from eth0
# /etc/resolv.conf.head can replace this line
domain microlinux.montpezat
search microlinux.montpezat
nameserver 192.168.2.1
# /etc/resolv.conf.tail can replace this line

If you wonder where the magic comes from, it's from the DHCP server which is configured like this:

Code:

# /etc/dhcpd.conf
authoritative;
default-lease-time 86400;
max-lease-time 86400;
option broadcast-address 192.168.2.255;
option subnet-mask 255.255.255.0;
option routers 192.168.2.254;
option domain-name-servers 192.168.2.1;
option domain-name "microlinux.montpezat";
option domain-search "microlinux.montpezat";

subnet 192.168.2.0 netmask 255.255.255.0 {
  range 192.168.2.100 192.168.2.200;
}

host alphamule {
  hardware ethernet 00:21:97:4C:37:27;
  fixed-address 192.168.2.2;
  option host-name "alphamule";
}

...



2) If your setup is static (like on a server, for example), you can edit /etc/resolv.conf manually and put your nameserver(s) in it. The minimal syntax looks like this:

Code:

nameserver 8.8.8.8
Or:

Code:

nameserver 8.8.8.8
nameserver 4.4.4.4

On my office server (running it's own DNS server), here's how things are configured:

Code:

[root@nestor:~] # cat /etc/resolv.conf
# /etc/resolv.conf
domain microlinux.montpezat
search microlinux.montpezat
nameserver 127.0.0.1

Hope that helps,

Niki

afreitascs 02-20-2013 10:32 PM

Quote:

Originally Posted by stormtracknole (Post 4896375)
Your dns in this case would be: 192.168.1.1

you made ​​me discover my mistake!

I did

Quote:

#pppoe-config
configured to use Google Public DNS

Quote:

8.8.8.8
8.8.4.4
now

Quote:

base1@base1:~$ cat /etc/resolv.conf
# MADE-BY-RP-PPPOE
nameserver 8.8.8.8
nameserver 8.8.4.4
thank you very much

afreitascs 02-20-2013 10:33 PM

Quote:

Originally Posted by kikinovak (Post 4896393)
Right here goes.

1) If you're using DHCP, the DHCP server will write the DNS server(s) in your /etc/resolv.conf. On a desktop client in my office, here's how that looks:

Code:

[kikinovak@alphamule:~] $ cat /etc/resolv.conf
# Generated by dhcpcd from eth0
# /etc/resolv.conf.head can replace this line
domain microlinux.montpezat
search microlinux.montpezat
nameserver 192.168.2.1
# /etc/resolv.conf.tail can replace this line

If you wonder where the magic comes from, it's from the DHCP server which is configured like this:

Code:

# /etc/dhcpd.conf
authoritative;
default-lease-time 86400;
max-lease-time 86400;
option broadcast-address 192.168.2.255;
option subnet-mask 255.255.255.0;
option routers 192.168.2.254;
option domain-name-servers 192.168.2.1;
option domain-name "microlinux.montpezat";
option domain-search "microlinux.montpezat";

subnet 192.168.2.0 netmask 255.255.255.0 {
  range 192.168.2.100 192.168.2.200;
}

host alphamule {
  hardware ethernet 00:21:97:4C:37:27;
  fixed-address 192.168.2.2;
  option host-name "alphamule";
}

...



2) If your setup is static (like on a server, for example), you can edit /etc/resolv.conf manually and put your nameserver(s) in it. The minimal syntax looks like this:

Code:

nameserver 8.8.8.8
Or:

Code:

nameserver 8.8.8.8
nameserver 4.4.4.4

On my office server (running it's own DNS server), here's how things are configured:

Code:

[root@nestor:~] # cat /etc/resolv.conf
# /etc/resolv.conf
domain microlinux.montpezat
search microlinux.montpezat
nameserver 127.0.0.1

Hope that helps,

Niki

thank you for explanation

allend 02-20-2013 10:35 PM

Quote:

$ cat /etc/resolv.conf
# Generated by NetworkManager
nameserver 192.168.1.1
NetworkManager has set the DNS name server to point to 192.168.1.1. This is probably a modem/router. When your modem/router connects to the internet, it will be supplied DNS name server IPs. You will need to query your modem/router settings (probably via a web interface; in a browser try going to URL http://192.168.1.1) to find these addresses.

What happens is that when an address cannot be resolved locally (e.g. by an entry in /etc/hosts) then the DNS request is sent to the name server in /etc/resolv.conf. This request is then passed to the DNS name servers in your modem/router.

/edit Too slow!

afreitascs 02-20-2013 10:37 PM

Quote:

Originally Posted by allend (Post 4896398)
NetworkManager has set the DNS name server to point to 192.168.1.1. This is probably a modem/router. When your modem/router connects to the internet, it will be supplied DNS name server IPs. You will need to query your modem/router settings (probably via a web interface; in a browser try going to URL http://192.168.1.1) to find these addresses.

What happens is that when an address cannot be resolved locally (e.g. by an entry in /etc/hosts) then the DNS request is sent to the name server in /etc/resolv.conf. This request is then passed to the DNS name servers in your modem/router.

/edit Too slow!

is ... I understand

thanks


All times are GMT -5. The time now is 08:14 AM.