This section provides a brief description of the configuration files for Domain Name
Service (DNS), the service that is used to convert between host names and IP addresses. The file
/etc/nsswitch.conf
controls the use of various system database files and name
services.
When DNS is enabled by the nsswitch.conf
file, the file
/etc/resolv.conf
controls how the lookups are performed. The changes that you make
to these system files take after effect you save your changes to the files.
You can also use the redhat-config-network graphical utility to configure DNS. It is available when the redhat-config-network package is installed. This package and the commands it provides are not available with a minimal RHEL installation.
For more information, go to:
Disable DNS
To disable DNS lookups:
- Edit file
/etc/nsswitch.conf
. - Place a pound sign (
#
) at the beginning of the line that readshosts: files dns
. - After editing, that line must look like the following code:
#hosts: files dns
Enabling DNS lookups
To enable DNS lookups:
- Edit
/etc/nsswitch.conf
. - Remove any pound signs (
#
) at the beginning of the line that readshosts: files dns
. After editing, that line looks like:hosts: files dns
Specifying the DNS domain and servers with the /etc/resolv.conf file
To specify the DNS domain and servers:
- Edit the file /etc/resolv.conf.
- When DHCP is enabled for a network interface, the file
/etc/resolv.conf is automatically generated by the DHCP client program with the
DNS servers specified by the DHCP server. Note: You normally edit /etc/resolv.conf only when using fixed (static) IP addresses.
- The /etc/resolv.conf file should specify the domain name suffix to use when a hostname is not fully qualified.
- You must also specify the name of at least one DNS server to use for hostname and IP
resolution. Below is an example of /etc/resolv.conf for the domain machines
mycompany.com
with two DNS servers:search machines.mycompany.com nameserver 172.16.0.5 nameserver 172.16.0.6
Passive capture on RHEL - Configuring network interfaces
The network configuration files in the /etc/sysconfig directory are
read and processed during system initialization. To apply changes, eboot the machine by using the
command shutdown -r
.
Instead of rebooting the machine, you can also bring the machine into single-user mode by using
the command shutdown now
. At the command prompt, enter the command
exit
to leave single-user mode and reenter multi-user mode, which enables
networking and starts the network interfaces.
Configuring NTP for passive capture on RHEL
You can configure an NTP daemon to synchronize the time of the machine with one or more NTP servers.
First, install the NTP package, which is not included with a minimal installation. After you install the NTP package, select NTP servers, create configuration files, and then enable and start the service.
Configuration overview | Configuration steps |
---|---|
Install the NTP package | If you have not done so already, install the NTP package from your Linux distribution. |
Select NTP servers |
To synchronize your workstation's time, the NTP daemon on your workstation contacts one or more
NTP servers specified in the configuration file If an NTP server is not available on the local network, do one of the following steps:
As user
The output must look like the following, which displays the contacted server and the time difference between the local workstation and the server.
If the query fails, following output is likely to come:
|
Create configuration files |
Perform the following steps as user root on the machine:
|
Enable and start the NTP service |
Perform the following steps as user root on the machine:
|
Install NTP package and select NTP servers
To synchronize your workstation's time, the NTP daemon on your workstation contacts one
or more NTP servers specified in the configuration file /etc/ntp.conf
.
If you have not done so already, install the NTP package for your Linux distribution.
- If an NTP server is not available on the local network, do one of the following
steps:
- Select a public NTP server (visit http://www.ntp.org/ and click Public Time Server Lists). If you select a public NTP server, read the Rules of Engagement (click Rules of Engagement on the main page of the NTP site).
- Use the NTP time server pool (visit http://www.pool.ntp.org/ and click How do I use pool.ntp.org).
- As user
root
on the workstation, verify that the machine can contact the selected NTP servers. Use thentpdate
command with the query-q
option. For example, to query an NTP server whose IP address is1.2.3.4
, use the following command:ntpdate -q 1.2.3.4
The output must look like the following, which displays the contacted server and the time difference between the local workstation and the server.
server 1.2.3.4, stratum 2, offset 150.695779, delay 0.03366 17 Nov 10:27:09 ntpdate[21597]: step time server 1.2.3.4 offset 150.695779 sec
If the query fails, following output is likely to come:
server 1.2.3.4, stratum 0, offset 0.000000, delay 0.00000 17 Nov 10:29:04 ntpdate[21599]: no server suitable for synchronization found