Linux网络管理之七:在Linux中进行DHCP的配置
时间:2009-03-23 来源:sjhf
[root@OracleOnLinux root]# cp /usr/share/doc/dhcp-3.0pl1/dhcpd.conf.sample /etc/dhcpd.conf [root@OracleOnLinux root]# vi /etc/dhcpd.conf 1 ddns-update-style interim; 2 ignore client-updates; 3 4 subnet 192.168.0.0 netmask 255.255.255.0 { 5 6 # --- default gateway 7 option routers 192.168.0.254; 8 option subnet-mask 255.255.255.0; 9 10 option nis-domain "mylinux.org"; 11 option domain-name "mylinux.org"; 12 option domain-name-servers 192.168.0.154,61.139.2.69; 13 14 option time-offset -18000; # Eastern Standard Time 15 # option ntp-servers 192.168.1.1; 16 # option netbios-name-servers 192.168.1.1; 17 # --- Selects point-to-point node (default is hybrid). Don't change this unless 18 # -- you understand Netbios very well 19 # option netbios-node-type 2; 20 21 range dynamic-bootp 192.168.0.18 192.168.0.100; 22 range dynamic-bootp 192.168.0.160 192.168.0.200; 23 default-lease-time 21600; 24 max-lease-time 43200; 25 26 # we want the nameserver to appear at a fixed address 27 host ns1 { 28 next-server marvin.redhat.com; 29 hardware ethernet 12:34:56:78:AB:CD; 30 fixed-address 192.168.0.17; 31 } 32 host db1 { 33 hardware ethernet 00:50:56:C0:00:01; 34 fixed-address 192.168.0.16; 35 } 36 37 38 39 } "/etc/dhcpd.conf" [已转换] 39L, 1054C 已写入 [root@OracleOnLinux root]# service dhcpd restart 关闭 dhcpd:[失败] 启动 dhcpd:[ 确定 ] [root@OracleOnLinux root]# ========================================================================================= linux客户机配置: [root@OracleOnLinux dhcp]# cd /etc/sysconfig/network-scripts/ [root@OracleOnLinux network-scripts]# cat ifcfg-eth1 DEVICE=eth1 ONBOOT=yes BOOTPROTO=dhcp ------------------------------------- 租借: dhclient eth1 ==================================================================================== windows客户机配置 1、设置为自动获取IP 2、手动租借:ipconfig /release 和 ipconfig /renew ==================================================================== 查看地址的租借情况: root@OracleOnLinux root]# cd /var/lib/dhcp [root@OracleOnLinux dhcp]# ls dhclient.leases dhcpd.leases dhcpd.leases~ [root@OracleOnLinux dhcp]# more dhcpd.leases # All times in this file are in UTC (GMT), not your local timezone. This is # not a bug, so please don't ask about it. There is no portable way to # store leases in the local timezone, so please don't request this as a # feature. If this is inconvenient or confusing to you, we sincerely # apologize. Seriously, though - don't ask. # The format of this file is documented in the dhcpd.leases(5) manual page. # This lease file was written by isc-dhcp-V3.0pl1 lease 192.168.0.200 { starts 4 2007/04/26 11:46:57; ends 4 2007/04/26 17:46:57; binding state active; next binding state free; hardware ethernet 00:0c:29:1d:59:af; } [root@OracleOnLinux dhcp]# more dhclient.leases lease { interface "eth1"; fixed-address 192.168.0.200; option subnet-mask 255.255.255.0; option time-offset -18000; option routers 192.168.0.254; option dhcp-lease-time 21600; option dhcp-message-type 5; option domain-name-servers 192.168.0.154,61.139.2.69; option dhcp-server-identifier 192.168.0.154; option nis-domain "mylinux.org"; option domain-name "mylinux.org"; renew 4 2007/4/26 14:22:04; rebind 4 2007/4/26 17:01:57; expire 4 2007/4/26 17:46:57; } 本文出自 “lgzeng” 博客,转载请与作者联系! |
相关阅读 更多 +
排行榜 更多 +