LinuxSir.cn,穿越时空的Linuxsir!

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

lfs6.4 dhcpd不能联网

[复制链接]
发表于 2009-6-22 03:14:56 | 显示全部楼层 |阅读模式
在ubuntu 9.10 下做的lfs,dhcp是按BLFS6.3的介绍安装设置的,开机正常进入,或者说没发生致命性错误。
ip adds 是192.168.1.100/24,和平常由路由器dhcp分配的一样。ping  localhost 127.0.0.1及网关192.168.1.1都成功,/etc/resolv.conf 中显示的nameserver 是本地电信的dns。并且说是dhcp管理eht0生成的。
但ping ip如66.249.89.104 显示:network is unreachable. ping www.google.cn 显示:unknow host  用lynx 显示:unable to connet to remote host.
不知有什么建议?
发表于 2009-6-22 12:26:29 | 显示全部楼层
如果 ping dns服务器也不通的话,说明连网路由不正常。
回复 支持 反对

使用道具 举报

 楼主| 发表于 2009-6-22 16:50:38 | 显示全部楼层
我忘了说了,其实我ping了本地的dns,同样不通,network is unreachable。但进入另一操作系统,联网正常。比如ubuntu9.10中的/etc/resolv.conf 内容和LFS中的是一样的。二个name server地址。
或者编译时的某个地方出了错?但我记得只在编译第一个binutils时好像出过错,但后来google好了,后来有地方出了错,返回去再做后按书上的检测方法检测正常。总之,好像没有什么大错。不过还是第一次接触这个,什么都不懂。看来得再编一次。不过再玩是必然的,而这个dhcp的问题没弄清总觉得不舒服。
回复 支持 反对

使用道具 举报

发表于 2009-6-22 18:58:48 | 显示全部楼层
如果 ping 本地网关 192.168.1.1 是通的话,用 route 命令检查一下是否默认网关设置故障;如果是这个问题,可以用如下命令设置它就好了:

#route add default gw 192.168.1.1
回复 支持 反对

使用道具 举报

 楼主| 发表于 2009-6-22 20:44:08 | 显示全部楼层
刚才试了阁下的建议。
#routel
192.168.1.0/24
192.168.1.0      broadcast
192.168.1.255  broadcast
192.168.1.100
127.0.0.1
127.0.0.1/8
其余的选项没记住。
#ip route
192.168.1.0/24 dev eth0 proto kernel scope link src 192,168.1.100
#ip route add 192.168.1.1 dev eth0
#ip route
192.168.1.1 dev eth0
192.168.1.0/24 dev eth0 proto kernel scope link src 192,168.1.100
重起后,手工配置的那条就又不见了。
上面的意思是不是dhcp配置的gw是192.168.1.0?
又:加default gw 显示好像是garbage,反正出错。
回复 支持 反对

使用道具 举报

发表于 2009-6-22 22:39:02 | 显示全部楼层
楼主,手册请仔细读,dhcpd 并不是您想象中的意思。
偶猜您是指 dhcp[color="Red"]cd。

老实说,看不懂您首帖,排除 dhcpd 常识性错误,剩下部分有多种歧义

如果您概念清晰 或 严格按手册做,网络问题很简单的。
请仔细检查配置文件。

手工配置网络,请详读 iproute2 manpage 或
http://www.policyrouting.org/iproute2.doc.html
http://man.chinaunix.net/linux/how/Adv-Routing-HOWTO-3.html
其实,个人用可以考虑使用经典的 net-tools,简单、实用、好用。
回复 支持 反对

使用道具 举报

 楼主| 发表于 2009-6-22 23:14:57 | 显示全部楼层
现在用ubuntu挂载lfs分区。
$more /mnt/lfs/etc/resolv.conf
# Generated by dhcpcd for interface eth0
search domain
nameserver 202.101.224.69
nameserver 202.101.226.68
地址是本地电信的dns.
在chroot环境下routel好像是当前主机的route状态。
root:/# routel
         target            gateway          source    proto    scope    dev tbl
   192.168.1.0/ 24                   192.168.1.100   kernel     link   eth0
192.168.122.0/ 24                   192.168.122.1   kernel     link virbr0
   169.254.0.0/ 16                                              link   eth0
        default        192.168.1.1                   static            eth0
    192.168.1.0          broadcast   192.168.1.100   kernel     link   eth0 local
127.255.255.255          broadcast       127.0.0.1   kernel     link     lo local
  192.168.1.100              local   192.168.1.100   kernel     host   eth0 local
  192.168.122.1              local   192.168.122.1   kernel     host virbr0 local
  192.168.122.0          broadcast   192.168.122.1   kernel     link virbr0 local
  192.168.1.255          broadcast   192.168.1.100   kernel     link   eth0 local
      127.0.0.0          broadcast       127.0.0.1   kernel     link     lo local
192.168.122.255          broadcast   192.168.122.1   kernel     link virbr0 local
      127.0.0.1              local       127.0.0.1   kernel     host     lo local
     127.0.0.0/ 8            local       127.0.0.1   kernel     host     lo local
        fe80::/ 64                                   kernel          virbr0
        fe80::/ 64                                   kernel            eth0
        default        unreachable                   kernel              lo unspec
            ::1                 ::                     none              lo local
fe80::21c:c4ff:fecf:601                 ::                     none              lo local
fe80::fc9d:31ff:fe9e:71f4                 ::                     none              lo local
        ff00::/ 8                                                    virbr0 local
        ff00::/ 8                                                      eth0 local
        default        unreachable                   kernel              lo unspec
root:/# ip route
192.168.1.0/24 dev eth0  proto kernel  scope link  src 192.168.1.100  metric 1
192.168.122.0/24 dev virbr0  proto kernel  scope link  src 192.168.122.1
169.254.0.0/16 dev eth0  scope link  metric 1000
default via 192.168.1.1 dev eth0  proto static


我的lfs系统下的routel命令显示的好像就少了一条‘default        192.168.1.1                   static            eth0 ’如linux001兄所建议。但先前没有配置好。用的是这个命令“#ip route add 192.168.1.1 dev eth0”      或者现在试试安装net-tools.
回复 支持 反对

使用道具 举报

 楼主| 发表于 2009-6-22 23:37:11 | 显示全部楼层
呵呵,受教了。安装了net-tools,问题果然变得简单多了。按linux001兄的建议:#route add default gw 192.168.1.1 一切解决。多谢二位。
回复 支持 反对

使用道具 举报

发表于 2009-6-22 23:41:48 | 显示全部楼层
看来LZ没有严格按LFS+BLFS的包来安装。安装好 net-tools 后,就会有正常的 ifconfig route netstat arp 等命令,不是你用的 ip 命令。
回复 支持 反对

使用道具 举报

 楼主| 发表于 2009-6-23 00:08:22 | 显示全部楼层
还没学BLFS。太心急了,lfs好了之后,就从blfs学了安装dhcpcd.
回复 支持 反对

使用道具 举报

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

本版积分规则

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