Chinaunix

标题: 【已解决】Debian的IP配置问题,大家看我的Debian哪里配置有问题 [打印本页]

作者: royzs    时间: 2012-09-21 10:20
标题: 【已解决】Debian的IP配置问题,大家看我的Debian哪里配置有问题
本帖最后由 royzs 于 2012-09-21 14:05 编辑

  1. # This file describes the network interfaces available on your system
  2. # and how to activate them. For more information, see interfaces(5).

  3. # The loopback network interface
  4. auto lo
  5. iface lo inet loopback

  6. # The primary network interface
  7. auto eth0
  8. allow-hotplug eth0
  9. iface eth0 inet dhcp
  10. address 192.168.1.12
  11. netmask 255.255.255.0
  12. network 192.168.1.0
  13. broadcast 192.168.1.255
  14. gateway 192.168.1.255
  15. dns-nameservers 219.141.136.10 202.106.0.20
复制代码
配置完这个IP之后
  1. /etc/init.d/networking restart
复制代码
会提示一条警告,ifconfig能看到新配置的IP,但是上不了网
重启机器后IP就没有了,只剩下一个lo的IP,我查了很多资料,Debian就是这个配置IP的啊,到底是什么原因,我改成DHCP获取就正常了

已解决,gateway写错了
作者: royzs    时间: 2012-09-21 10:44









作者: royzs    时间: 2012-09-21 11:09













作者: royzs    时间: 2012-09-21 11:29
我等








作者: longbow0    时间: 2012-09-21 12:48
不建议直接修改 /etc/network/interface,装 network-manager并配置。
作者: chenyx    时间: 2012-09-21 12:53
iface eth0 inet dhcp

楼主你是dhcp还是静态的ip?静态的话,把上面的那句注释掉.
作者: royzs    时间: 2012-09-21 12:53
longbow0 发表于 2012-09-21 12:48
不建议直接修改 /etc/network/interface,装 network-manager并配置。



是图形界面中右上角的那个图形配置IP吗,我都写进去了的,但是不管怎样都不生效,重启试过了的
作者: royzs    时间: 2012-09-21 12:54
chenyx 发表于 2012-09-21 12:53
楼主你是dhcp还是静态的ip?静态的话,把上面的那句注释掉.
  1. allow-hotplug eth0
复制代码
这句吗,是什么意思啊
作者: chenyx    时间: 2012-09-21 12:55
不是那个,就是这句 --->iface eth0 inet dhcp
这个是dhcp才用的
作者: royzs    时间: 2012-09-21 13:01
chenyx 发表于 2012-09-21 12:55
不是那个,就是这句 --->iface eth0 inet dhcp
这个是dhcp才用的


嗯,我尝试过N种配置,用静态的时候这句我是把dhcp改成了static的,但是重启服务器的时候会报警,然后有IP,但是上不网,解析不了域名,只能ping通自己的网关
作者: chenyx    时间: 2012-09-21 13:10
把你的dns服务器的ip写到/etc/resolv.conf里面,写成
nameserver 219.141.136.10
nameserver 202.106.0.20

然后再nslookup一个外网的域名,看看解析正常不
作者: chenyx    时间: 2012-09-21 13:12
另外,你静态ip设置,应该写成iface eth0 inet static
修改完配置文件,重启下network服务
作者: royzs    时间: 2012-09-21 13:15
chenyx 发表于 2012-09-21 13:10
把你的dns服务器的ip写到/etc/resolv.conf里面,写成

然后再nslookup一个外网的域名,看看解析正常不
  1. root@kvstore:/etc/network# cat interfaces
  2. # This file describes the network interfaces available on your system
  3. # and how to activate them. For more information, see interfaces(5).

  4. # The loopback network interface
  5. auto lo
  6. iface lo inet loopback

  7. # The primary network interface
  8. auto eth0
  9. allow-hotplug eth0
  10. iface eth0 inet static
  11. address 192.168.1.12
  12. netmask 255.255.255.0
  13. network 192.168.1.0
  14. broadcast 192.168.1.255
  15. gateway 192.168.1.255
  16. #dns-nameservers 219.141.136.10 202.106.0.20
复制代码
  1. root@kvstore:/etc/network# cat /etc/resolv.conf
  2. nameserver 219.141.136.10
  3. nameserver 202.106.0.20
  4. root@kvstore:/etc/network#
复制代码
这是我的配置文件内容,interface里面dns配置的已经注释掉了,但是重启网卡的时候依然报错
  1. root@kvstore:/etc/network# /etc/init.d/networking restart
  2. Running /etc/init.d/networking restart is deprecated because it may not enable again some interfaces ... (warning).
  3. Reconfiguring network interfaces...SIOCADDRT: No such process
  4. Failed to bring up eth0.
  5. done.
  6. root@kvstore:/etc/network#
复制代码
nslookup依然不能解析
作者: chenyx    时间: 2012-09-21 13:20
http://blog.chinaunix.net/uid-20653353-id-1906100.html
楼主看看这个是不是和你的情况一致
作者: chenyx    时间: 2012-09-21 13:20
另外,那个warning信息可以忽略,你现在看看ifconfig eth0,能看到你配置的ip不,解析域名正常不
作者: royzs    时间: 2012-09-21 13:39
chenyx 发表于 2012-09-21 13:20
另外,那个warning信息可以忽略,你现在看看ifconfig eth0,能看到你配置的ip不,解析域名正常不


太感谢了,解决了




欢迎光临 Chinaunix (http://bbs.chinaunix.net/) Powered by Discuz! X3.2