Linux Administration Cookbook
上QQ阅读APP看书,第一时间看更新

How it works...

When you request the destination of a domain on your system, what you're actually doing is sending a request to your configured resolver, which returns the address it (or further upstream systems) knows about.

In our case, we can see this request happening by connecting two Terminals to centos1.

On our first Terminal, we're going to install and start tcpdump on eth1:

$ sudo yum install tcpdump -y
$ sudo tcpdump -i eth0 -n port 53

Once set up, hop to a second connection and run your dig against the BBC (or whichever British broadcaster of choice you've gone with):

$ dig bbc.co.uk

Flip back to your first window, and you should see the results of your request:

14:58:50.303421 IP 10.0.2.15.51686 > 1.1.1.1.domain: 19866+ [1au] A? bbc.co.uk. (38)
14:58:50.331999 IP 1.1.1.1.domain > 10.0.2.15.51686: 19866 4/0/1 A 151.101.0.81, A 151.101.64.81, A 151.101.128.81, A 151.101.192.81 (102)

We asked our name server what address bbc.co.uk lived at, and in the response, we got a few IP addresses to connect to. Neat, huh?