您的位置:首页 > 其它

DHCP服务器安装与配置

2010-07-09 17:14 323 查看
FreeBSD中的DHCP服务器的安装于配置详细的中文文档请参见:http://www.freebsd.org/doc/zh_CN.GB2312/books/handbook/network-dhcp.html安装dhcp服务器(需要下载一些文件,所以最好有网络连接):
1:  cd /usr/ports/net/isc-dhcp30-server/
2:  make install clean
.codearea{ color:black; background-color:white; line-height:18px; border:1px solid #4f81bd; margin:0; width:auto !important; width:100%; overflow:auto; text-align:left; font-size:12px; font-family: "Courier New","Consolas","Fixedsys","BitStream Vera Sans Mono", courier,monospace,serif}.codearea pre{ color:black; line-height:18px; padding:0 0 0 12px !important; margin:0em; background-color:#fff !important}.linewrap pre{white-space:pre-wrap; white-space:-moz-pre-wrap; white-space:-pre-wrap; white-space:-o-pre-wrap; word-wrap:break-word; word-break:normal}.codearea pre.alt{ background-color:#f7f7ff !important}.codearea .lnum{color:#4f81bd;line-height:18px}按照说明文档 ,配置/usr/local/etc/dhcpd.conf,例如:
1:  option domain-name "xxx.edu.lanx";
2:  option domain-name-servers 218.6.200.139,61.139.2.69;
3:
4:  default-lease-time 86400;
5:  max-lease-time 86400;
6:
7:  ddns-update-style ad-hoc;
8:
9:  log-facility local7;
10:
11:  subnet 172.18.1.0 netmask 255.255.255.0 {
12:    range 172.18.1.10 172.18.1.100;
13:    option routers 172.18.1.1;
14:    option broadcast-address 172.18.1.255;
15:    default-lease-time 86400;
16:    max-lease-time 86400;
17:  }
.codearea{ color:black; background-color:white; line-height:18px; border:1px solid #4f81bd; margin:0; width:auto !important; width:100%; overflow:auto; text-align:left; font-size:12px; font-family: "Courier New","Consolas","Fixedsys","BitStream Vera Sans Mono", courier,monospace,serif}.codearea pre{ color:black; line-height:18px; padding:0 0 0 12px !important; margin:0em; background-color:#fff !important}.linewrap pre{white-space:pre-wrap; white-space:-moz-pre-wrap; white-space:-pre-wrap; white-space:-o-pre-wrap; word-wrap:break-word; word-break:normal}.codearea pre.alt{ background-color:#f7f7ff !important}.codearea .lnum{color:#4f81bd;line-height:18px}如果只是一个子网,上面就可以减少一部分设置。因为作为服务器,所以希望启动的时候就启动dhcp服务,配置/ect/rc.conf:
1:  dhcpd_enable="YES"
2:  dhcpd_ifaces="vr0"
3:  ifconifg_vr0="inet 172.18.1.1 netmask 255.255.255.0"
.codearea{ color:black; background-color:white; line-height:18px; border:1px solid #4f81bd; margin:0; width:auto !important; width:100%; overflow:auto; text-align:left; font-size:12px; font-family: "Courier New","Consolas","Fixedsys","BitStream Vera Sans Mono", courier,monospace,serif}.codearea pre{ color:black; line-height:18px; padding:0 0 0 12px !important; margin:0em; background-color:#fff !important}.linewrap pre{white-space:pre-wrap; white-space:-moz-pre-wrap; white-space:-pre-wrap; white-space:-o-pre-wrap; word-wrap:break-word; word-break:normal}.codearea pre.alt{ background-color:#f7f7ff !important}.codearea .lnum{color:#4f81bd;line-height:18px}注意ifconfig_vr0配置静态ip,否则启动dhcp服务会提示没有vr0  ( # vr0: not found),当然ip配置可以在其他地方设置。手动可以通过下面的语句来启动服务:# /usr/local/etc/rc.d/isc-dhcpd.sh start一些说明两个网段可以使用下面的配置:
1:  subnet 192.168.1.0 netmask 255.255.255.0 {
2:  range 192.168.1.10 192.168.1.100;
3:  range 192.168.1.150 192.168.1.200;
4:  }
.codearea{ color:black; background-color:white; line-height:18px; border:1px solid #4f81bd; margin:0; width:auto !important; width:100%; overflow:auto; text-align:left; font-size:12px; font-family: "Courier New","Consolas","Fixedsys","BitStream Vera Sans Mono", courier,monospace,serif}.codearea pre{ color:black; line-height:18px; padding:0 0 0 12px !important; margin:0em; background-color:#fff !important}.linewrap pre{white-space:pre-wrap; white-space:-moz-pre-wrap; white-space:-pre-wrap; white-space:-o-pre-wrap; word-wrap:break-word; word-break:normal}.codearea pre.alt{ background-color:#f7f7ff !important}.codearea .lnum{color:#4f81bd;line-height:18px}
如果你要为windows客户指定一个WINS服务器,你需要包括下面的选项到dhcpd.conf文件中:
1:  option netbios-name-servers 192.168.1.1;
.codearea{ color:black; background-color:white; line-height:18px; border:1px solid #4f81bd; margin:0; width:auto !important; width:100%; overflow:auto; text-align:left; font-size:12px; font-family: "Courier New","Consolas","Fixedsys","BitStream Vera Sans Mono", courier,monospace,serif}.codearea pre{ color:black; line-height:18px; padding:0 0 0 12px !important; margin:0em; background-color:#fff !important}.linewrap pre{white-space:pre-wrap; white-space:-moz-pre-wrap; white-space:-pre-wrap; white-space:-o-pre-wrap; word-wrap:break-word; word-break:normal}.codearea pre.alt{ background-color:#f7f7ff !important}.codearea .lnum{color:#4f81bd;line-height:18px}
你也能为某块网卡指定固定的IP地址,无论何时,这块网卡将总是从DHCP服务器获得固定的IP地址(可以写在一行内):
1:  host haagen {
2:  hardware ethernet 08:00:2b:4c:59:23;
3:  fixed-address 192.168.1.222;
4:  }
.codearea{ color:black; background-color:white; line-height:18px; border:1px solid #4f81bd; margin:0; width:auto !important; width:100%; overflow:auto; text-align:left; font-size:12px; font-family: "Courier New","Consolas","Fixedsys","BitStream Vera Sans Mono", courier,monospace,serif}.codearea pre{ color:black; line-height:18px; padding:0 0 0 12px !important; margin:0em; background-color:#fff !important}.linewrap pre{white-space:pre-wrap; white-space:-moz-pre-wrap; white-space:-pre-wrap; white-space:-o-pre-wrap; word-wrap:break-word; word-break:normal}.codearea pre.alt{ background-color:#f7f7ff !important}.codearea .lnum{color:#4f81bd;line-height:18px}
你也可为某台机器指定不同的网关地址,名服务器等:
1:  host Jephe {
2:  hardware ethernet 00:a0:c9:a6:96:33;
3:  fixed-address 192.168.1.12;
4:  option routers 192.168.11.5;
5:  }
.codearea{ color:black; background-color:white; line-height:18px; border:1px solid #4f81bd; margin:0; width:auto !important; width:100%; overflow:auto; text-align:left; font-size:12px; font-family: "Courier New","Consolas","Fixedsys","BitStream Vera Sans Mono", courier,monospace,serif}.codearea pre{ color:black; line-height:18px; padding:0 0 0 12px !important; margin:0em; background-color:#fff !important}.linewrap pre{white-space:pre-wrap; white-space:-moz-pre-wrap; white-space:-pre-wrap; white-space:-o-pre-wrap; word-wrap:break-word; word-break:normal}.codearea pre.alt{ background-color:#f7f7ff !important}.codearea .lnum{color:#4f81bd;line-height:18px} 关于DHCP租约的相关知识,请参考http://blog.csdn.net/lanxinju/archive/2010/07/09/5724007.aspx

                                            
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: