- 論壇徽章:
- 0
|
用FreeBSD做NAT網(wǎng)關(guān),服務(wù)器端開啟DHCP的問題
請(qǐng)看下文:
下載:
ftp://ftp.lab.mlc.edu.tw/UNIX/isc/dhcp/dhcp-3.0rc11.tar.gz
編譯與安裝:
./configure
make
make install
相關(guān)程式檔案安裝至/usr/sbin/
touch /var/db/dhcpd.leases
echo 255.255.255.255 For-DHCP >;>; /etc/hosts
route add -host For-DHCP -interface vr1(放在rc.local)
vr1:網(wǎng)路卡代號(hào),如果您的主機(jī)裝有兩塊網(wǎng)卡,這裡的網(wǎng)卡代號(hào)表示DHCP要從哪一塊網(wǎng)卡廣播出去。
我的vr0第一塊網(wǎng)卡接真實(shí)IP並做為NAT。
-------------/usr/local/etc/dhcpd.conf-------------------
server-identifier gateway.nat ; # 標(biāo)明此伺服器名稱
default-lease-time 21600; # 租約使用時(shí)間: 6 小時(shí)
max-lease-time 86400; # 最大租期長(zhǎng)度: 1 天
option domain-name-servers 168.95.192.1,168.95.1.1 ; # 可用的名稱伺服器
option domain-name "nat"; # 所屬的網(wǎng)域名稱
option routers 192.168.1.254 ; # 子網(wǎng)路路由器(gateway)
option broadcast-address 192.168.1.255 ; # 廣播封包位置
option perform-mask-discovery on;
option mask-supplier on;
ddns-update-style none;
#### ------ 宣告 NAT 網(wǎng)域之動(dòng)態(tài)IP ------ ####
group {
subnet 192.168.1.0 netmask 255.255.255.0 { # 子網(wǎng)路與網(wǎng)路遮罩
range dynamic-bootp 192.168.1.20 192.168.1.30 ; # 動(dòng)態(tài)分配 IP 位置範(fàn)圍
}
}
啟動(dòng) /usr/sbin/dhcpd -cf /usr/local/etc/dhcpd.conf vr1(rc.local)
/usr/sbin/dhcpd -cf 設(shè)定檔 網(wǎng)路卡代號(hào)
我發(fā)現(xiàn)這一行一定要有,因配合bind-8.2.3-REL,ddns-update-style動(dòng)態(tài)更新DNS資料,設(shè)定方式有三種:
ddns-update-style ad-hoc
ddns-update-style interim
ddns-update-style none
執(zhí)行成功後的訊息畫面。
Internet Software Consortium DHCP Server V3.0rc11
Copyright 1995-2001 Internet Software Consortium.
All rights reserved.
For info, please visit http://www.isc.org/products/DHCP
Wrote 0 deleted host decls to leases file.
Wrote 0 new dynamic host decls to leases file.
Wrote 0 leases to leases file.
Listening on BPF/vr1/00:50:ba:cd:08:5e/192.168.1.0
Sending on BPF/vr1/00:50:ba:cd:08:5e/192.168.1.0
Sending on Socket/fallback/fallback-net |
|