LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 1002|回复: 3

开启 DHCP 服务遇到问题,请教。

[复制链接]
发表于 2010-3-20 10:32:55 | 显示全部楼层 |阅读模式
一台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.
发表于 2010-3-22 11:36:16 | 显示全部楼层
也许只是权限问题?
sudo /etc/init.d/dhcp3-server start
回复 支持 反对

使用道具 举报

 楼主| 发表于 2010-3-22 14:58:31 | 显示全部楼层
Post by alonersir;2076972
也许只是权限问题?
sudo /etc/init.d/dhcp3-server start


看来不是,因为已将加了 sudo 后来别的地方有人指出要创建这个文件 :

sudo touch /var/lib/dhcp3/dhcpd.leases

之后成功启动。
回复 支持 反对

使用道具 举报

发表于 2010-3-23 01:20:04 | 显示全部楼层
wlan0是做ap的么? 能否正常工作?
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表