Linux 也可以作为 DHCP 客户,即你要安装 dhcpcd rpm 软件包 ,Linux 作为 DHCP 服务器,只需要安装 dhcpd rpm 包。
#route add -host 255.255.255.255 dev eth0
如果报告错误消息:255.255.255.255:Unkown host
试着加下面的入口到 /etc/hosts 文件:
#route add -host dhcp dev eth0 。
#Sample /etc/dhcpd.conf
default-lease-time 1200; max-lease-time 9200; option subnet-mask 255.255.255.0; option broadcast-address 192.168.1.255; option routers 192.168.1.254; option domain-name-servers 192.168.1.1,192.168.1.2; option domain-name "mydomain.org"; subnet 192.168.1.0 netmask 255.255.255.0 { range 192.168.1.10 192.168.1.100; range 192.168.1.150 192.168.1.200; }
|
服务器发送下面的参数给 DHCP 客户机:用 255.255.255.0 作为子网掩码,用 192.168.1.255 作为广播地址,用 192.168.1.254 作为默认网关,用 192.168.1.1 and 192.168.1.2 作为 DNS 服务器如果你要为 windows 客户指定一个 WINS 服务器,你需要包括下面的选项到 dhcpd.conf 文件中:option netbios-name-servers 192.168.1.1。
host haagen {
hardware ethernet 08:00:2b:4c:59:23; fixed-address 192.168.1.222; } 也可连写为一行: host Jephe {hardware ethernet 00:a0:c9:a6:96:33;fixed-address 192.168.1.12;} 你也可为某台机器指定不同的网关地址,名服务器等: host Jephe {hardware ethernet 00:a0:c9:a6:96:33;fixed-address 192.168.1.12;option routers 192.168.11.5;} |
#touch /var/state/dhcp/dhcpd.leases
|
因此这样设置如下:
subnet 192.168.1.0 netmask 255.255.255.0 {
range 192.168.1.2 192.168.1.4; default-lease-time 86400; max-lease-time 259200; option subnet-mask 255.255.255.0; option broadcast-address 192.168.1.255; option routers 192.168.1.254; option domain-name-servers 192.168.1.254; } subnet 202.102.34.102 netmask 255.255.255.255 { } |
上一篇:《用apt+synaptic 在线安装或升级Fedora core 4.0 软件包》 |