fixed-address 192.168.1.65 ;
}
host webcam1 {
hardware ethernet 00:0c:0d:ee:ee:ee ;
fixed-address 192.168.1.66 ;
}
host gateway1 {
hardware ethernet 00:0c:0d:ff:ff:ff ;
fixed-address 192.168.1.254 ;
}
}
Table 7-3. Sample hardware addresses
Hardware MAC address |
Hostname |
00:0c:0d:99:99:99 |
prime |
00:0c:0d:aa:aa:aa |
cabinet |
00:0c:0d:bb:bb:bb |
chatterbox |
00:0c:0d:cc:cc:cc |
laser1 |
00:0c:0d:dd:dd:dd |
multifunction1 |
00:0c:0d:ee:ee:ee |
gateway1 |
Once your configuration has been saved in /etc/dhcpd.conf , restart dhcpd to activate it using the Services graphical tool or this command:
# service dhcpd restart
If there are errors in your configuration file, dhcpd may not start. Check the end of the file /var/log/messages to see if there are any error messages:
# tail -50 /var/log/messages|less
If there are no error messages, clients can begin using the dhcpd server to obtain their IP addresses.
You will need to open port 68 UDP in your firewall configuration in order to permit clients to reach dhcpd . You should also verify that no other DHCP servers are running on your network (check router and gateway appliances in addition to computers).
If configured to obtain IP information through DHCP, the client systems will contact the DHCP server when they are booted. You can also force them to contact the DHCP server at any time:
On a Fedora Core 4 or later system, use dhclient to configure an Ethernet port using DHCP:
# dhclient eth0
In this case, the port being configured is eth0 , the first Ethernet connection. On other Linux systems, you may need to use dhcpcd or pump in place of dhclient .
On a Windows system, you can use ipconfig to obtain or renew a DHCP lease:
C:> ipconfig /renew
Windows IP Configuration
Ethernet adapter 1:
Connection-specific DNS Suffix . : fedorabook.com
IP Address. . . . . . . . . . . . : 192.168.1.207
Subnet Mark . . . . . . . . . . . : 255.255.255.0
Default Gateway . . . . . . . . . : 192.168.1.254
Table 7-4 shows the sequence of messages that flow between a DHCP client and a DHCP server during initial negotiation and during lease renewal.
Table 7-4. DHCP messages.
Context |
|
Message type |
Origin |
Description |
Initial negotiation |
Lease renewal |
|
|
|
* |
|
DHCPDISCOVER |
Client |
Client tries to discover the DHCP server. |
* |
|
DHCPOFFER |
Server |
The DHCP server offers its location and possible lease details. |
* |
* |
DHCPREQUEST |
Client |
The client requests a lease. |
* |
* |
DHCPACK/DHCPNACK |
Server |
The server acknowledges (approves) or negatively acknowledges (rejects) the lease request. |
Early DHCP messages are sent using UDP to the broadcast address 255.255.255.255. This is necessary because the client does not have an IP address at the start of the negotiation.
dhcpd stores lease information in the file /var/lib/dhcpd/dhcpd.leases so that if it is stopped and restarted, it still has an idea of what leases are outstanding. In a similar way, dhclient stores its lease information in /var/lib/dhcp/dhclient-.leases (where < eth0> is the interface name).
7.2.3.1. ...older clients that use the bootp protocol?
The DHCP server, dhcpd , can also manage clients that use the Bootstrap Protocol (BOOTP). However, BOOTP does not use leases, so once an IP address is assigned, it stays assigned even if the computer using that address is removed from the network . IP assignments from an address pool are therefore called automatic assignments instead of dynamic assignments.
To enable dhcpd to assign BOOTP addresses, add the dynamic-bootp option to the range statement in /etc/dhcpd.conf :
range dynamic-bootp 192.168.1.128 192.168.1.191
7.2.4. Where Can I Learn More?
The manpages for dhcpd , dhcpd.conf , dhclient , and dhclient.conf
The standard that defines DHCP: RFC 2131, http://www.ietf.org/rfc/rfc2131.txt
7.3. Configuring a Domain Name Server
Domain name service (DNS) is like a telephone-directory service for TCP/IP networks. When a program such as a browser or mail server needs to contact a machine for which it has a hostname, it uses DNS to convert that name to a numeric network address. DNS can also do the reverse: convert a numeric address to a hostname.
It is necessary to have DNS set up before you can serve data to the Internet. Although you can contract for DNS service from an external provider, Fedora Core provides a nameserver that you can easily set up to provide your own DNS capability.
Fedora provides the named domain name server, which is the Berkeley Internet Name Domain (BIND). named serves two roles:
authoritative nameserver
Serves name information about one or more domains to other servers.
caching nameserver
Provides name lookups for client programs such as web browsers by contacting other nameservers. This information is cached in local storage in case it is requested again in the near future.
The Fedora package called bind contains the named service.
The named service is not run by default. Once you configure it to run (see Lab 4.6, "Managing and Configuring Services "), it will act as a caching nameserver:
If you just want to use named as a caching nameserver, you can skip to the section entitled "Using your nameservers locally."
To configure named as an authoritative nameserver for your domain, you just have to give it the information about your domain that you want it to serve to other systems. Usually at least two authoritative nameservers are set up for each domain; one is configured as the master , and the others are slaves . Changes to the DNS data are made on the master, and the slaves update themselves periodically.
You can configure an authoritative nameserver graphically or by editing configuration files and datafiles.
7.3.1.1. Configuring named graphically
Select the menu option System→Administration→Server Settings→Domain Name Server. After you enter the root password, the window shown in Figure 7-6 will appear.
Figure 7-6. BIND configuration GUI
The user interface of this tool is unique! It does not behave in the same way as other graphical configuration tools, so take your time when using it.
Читать дальше