操作系统:linux/debian
网络接入 中国电信 ADSL 固定IP地址
双网卡分别为:eth0(出口) eth1(接交换机)
eth0:公网 220.172.238.241
eth1:192.168.0.1
用IPTABLES 有这样一句
iptables -t nat -A POSTROUTING -o eth0 -j SNAT --to-source 220.172.238.241
DHCP 开始
1) apt-get install dhcp
2) 配置 /etc/dhcpd.conf文件内容,如下:
option domain-name "fugue.com";
option domain-name-servers 202.98.192.68;
option subnet-mask 255.255.255.0;
default-lease-time 600;
max-lease-time 7200;
# The other subnet that shares this physical network
subnet 192.168.0.0 netmask 255.255.255.0 {
range dynamic-bootp 192.168.0.30 192.168.0.254;
option broadcast-address 192.168.0.255;
option routers 192.168.0.1;
}
3)个人经验,如果是单网卡可直接/etc/init.d/dhcp restart
但如是双网卡就得指定输入接口,我这里因为NAT 过来的都是从 eth1(哈哈,因为 eth1接交换机)来的。
所以这样执行 /usr/sbin/dhcpd eth1