On a Linux system, use the route command with the -n option to display the routing
table.* The -n option prevents route from converting IP addresses to hostnames,
which gives a clearer display. Here is a routing table from a sample Red Hat system:
IP uses the information from the routing table (the forwarding table) to construct the
routes used for active connections. The routes associated with active connections are
stored in the routing cache. On Linux systems, the routing cache can be examined by
adding the -C argument to the route command line:
The routing cache is different from the routing table because the cache shows established
routes. The routing table is used to make routing decisions; the routing cache
is used after the decision is made. The routing cache shows the source and destination
of a network connection and the gateway and interface used to make that connection.
1 2 3 4 5 6 7 8 9
(172.24.0.4) at 02:42:ac:18:00:04 [ether] on br-0e67b8dd25a6 ? (172.22.0.2) at 02:42:ac:16:00:02 [ether] on br-56ca89db6d16 ? (192.168.16.2) at 02:42:c0:a8:10:02 [ether] on br-28e79d560103 ? (192.168.8.11) at 00:0c:29:74:4e:c9 [ether] on eth0 ? (192.168.8.14) at 00:0c:29:00:b3:7f [ether] on eth0 ? (192.168.8.13) at 00:0c:29:d6:b7:bf [ether] on eth0 ? (192.168.8.9) at 00:0c:29:1b:54:94 [ether] on eth0 ? (192.168.8.34) at 00:0c:29:2b:ba:43 [ether] on eth0 ? (192.168.8.12) at 00:0c:29:d2:41:d7 [ether] on eth0
# head -22 /etc/services # Network services, Internet style # # Note that it is presently the policy of IANA to assign a single well-known # port number for both TCP and UDP; hence, officially ports have two entries # even if the protocol doesn't support UDP operations. # # Updated from http://www.iana.org/assignments/port-numbers and other # sources like http://www.freebsd.org/cgi/cvsweb.cgi/src/etc/services . # New ports will be added on request if they have been officially assigned # by IANA and used in the real-world or are needed by a debian package. # If you need a huge list of used numbers please install the nmap package.
The host table is a simple text file that associates IP addresses with hostnames. On
most Unix systems, the table is in the file /etc/hosts. Each table entry in /etc/hosts contains
an IP address separated by whitespace from a list of hostnames associated with
that address. Comments begin with #.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
head -22 /etc/hosts ## # Host Database # # localhost is used to configure the loopback interface # when the system is booting. Do not change this entry. ## 127.0.0.1 localhost 255.255.255.255 broadcasthost ::1 localhost # 0.0.0.0 account.jetbrains.com # 0.0.0.0 www.jetbrains.com # Added by Docker Desktop # To allow the same kube context to work on the host and the container: 127.0.0.1 kubernetes.docker.internal # End of section
overcomes both major weaknesses of the host table:
• DNSscales well. It doesn’t rely on a single large table; it is a distributed database
system that doesn’t bog down as the database grows. DNScurrently provides
information on approximately 100,000,000 hosts, while fewer than 10,000
were listed in the host table.
• DNSguarantees that new host information will be disseminated to the rest of the
network as it is needed.
DNSis a distributed hierarchical system for resolving hostnames into IP addresses.
Under DNS, there is no central database with all of the Internet host information.
The information is distributed among thousands of name servers organized into a
hierarchy similar to the hierarchy of the Unix filesystem. DNShas a root domain at
the top of the domain hierarchy that is served by a group of name servers called the