|
一台PC 两个网卡 eth1 eth2 ,eth1 通过 pppoe 拨号连接 internet ,连接为 ppp0
eth2 连接内网其他机器,已经做好 eh2 到 ppp0 的 nat。
现在的网络设置, eth1没在 interfaces 文件做任何IP设置,只是让它 pppoe 拨号。
# PPPoE connection
auto provider
iface provider inet ppp
pre-up /sbin/ifconfig eth1 up
provider provider
eth2和 wlan0 组成 br0, br0则设定了固定的IP地址 192.168.1.254
iface br0 inet static
address 192.168.1.254
bridge_ports eth2 wlan0
netmask 255.255.255.0
network 192.168.1.0
broadcast 192.168.1.255
pre-up /sbin/ifconfig eth2 0.0.0.0 up
pre-up /sbin/ifconfig wlan0 0.0.0.0 up
pre-up /sbin/iwconfig wlan0 mode master
pre-up /sbin/brctl addbr br0
pre-up /sbin/brctl addif eth2
pre-up /sbin/brctl addif wlan0
post-down /sbin/ifconfig eth2 0.0.0.0 down
post-down /sbin/ifconfig wlan0 0.0.0.0 down
post-down /sbin/brctl delif br0 eth2
post-down /sbin/brctl delif br0 wlan0
post-down /sbin/brctl delbr br0
然后在 iptables里对 -s 192.168.1.x做 -o ppp0 的 NAT,内网机器设为同一网段,网关为 br0 的地址 192.168.1.254,然后接到eth1口上,可以上网。
现在想在这台PC作 DHCP 服务,使其他内网连到这台机器上自动获取地址。
但是实验了几次,总是DHCP启动失败。
如果是作为 dhcp 服务器的话,是否要指定 eth0 的内网地址(192.168.1X),而让 br0 自动获取地址?
dhcpd.conf 的设置
subnet 192.168.1.0 netmask 255.255.255.0 {
range 192.168.1.3 192.168.1.100;
option domain-name-servers 208.67.222.222;
#option domain-name "mydebian.org";
option routers 192.168.1.254; #( br0 的内网IP地址)
option broadcast-address 192.168.1.255;
default-lease-time 600;
max-lease-time 7200;
}
dhcp3.server设置
# On what interfaces should the DHCP server (dhcpd) serve DHCP requests?
# Separate multiple interfaces with spaces, e.g. "eth0 eth1".
INTERFACES="br0"
运行 /etc/init.d/dhcp3-server start
错误信息为
Internet Systems Consortium DHCP Server V3.1.3
dhcpd: Copyright 2004-2009 Internet Systems Consortium.
dhcpd: All rights reserved.
dhcpd: For info, please visit https://www.isc.org/software/dhcp/
dhcpd: unable to create icmp socket: Operation not permitted
dhcpd: Internet Systems Consortium DHCP Server V3.1.3
dhcpd: Copyright 2004-2009 Internet Systems Consortium.
dhcpd: All rights reserved.
dhcpd: For info, please visit https://www.isc.org/software/dhcp/
dhcpd: Can't open /var/lib/dhcp3/dhcpd.leases for append. |
|