interfaces只能是dhcp吗?

包含网卡/无线网的网络问题和ADSL/校园网/宽带拨号支持及代理/共享等网络使用问题
回复
whaha
帖子: 104
注册时间: 2016-07-08 17:43
系统: debian8

interfaces只能是dhcp吗?

#1

帖子 whaha »

我的上网方式,路由器+pc.
pc里面的网络接口,我第一次写成

auto eth0
iface eth0 inet static
address 192.168.1.100
netmask 255.255.255.0
dns-server 114.114.114.114

发现无法上网,改写成
auto eth0
iface eth0 inet dhcp
netmask 255.255.255.0
dns-server 114.114.114.114

就可以了,请问,在pc接路由器的环境下,只能在pc机上设置为dhcp吗?
请告知理由。
头像
vickycq
帖子: 4507
注册时间: 2011-03-20 13:12
系统: Debian
来自: 山东省寿光县
联系:

Re: interfaces只能是dhcp吗?

#2

帖子 vickycq »

whaha 写了: auto eth0
iface eth0 inet static
address 192.168.1.100
netmask 255.255.255.0
dns-server 114.114.114.114
发现无法上网
添加一条网关设置试试
Debian 中文论坛 - forums.debiancn.org
欢迎所有 Debian GNU/Linux 用户
poloshiao
论坛版主
帖子: 18279
注册时间: 2009-08-04 16:33

Re: interfaces只能是dhcp吗?

#3

帖子 poloshiao »

只能在pc机上设置为dhcp吗?
http://manpages.ubuntu.com/manpages/xen ... ces.5.html
METHODS
Both inet and inet6 address family interfaces can use the following methods (However they are not required):

The loopback Method
This method may be used to define the loopback interface.

The static Method
This method may be used to define ethernet interfaces with statically allocated addresses.

The dhcp Method
This method may be used to obtain an address via DHCP.
zhangjint5
帖子: 304
注册时间: 2011-01-02 12:31

Re: interfaces只能是dhcp吗?

#4

帖子 zhangjint5 »

whaha 写了:我的上网方式,路由器+pc.
pc里面的网络接口,我第一次写成

auto eth0
iface eth0 inet static
address 192.168.1.100
netmask 255.255.255.0
dns-server 114.114.114.114

发现无法上网,改写成
auto eth0
iface eth0 inet dhcp
netmask 255.255.255.0
dns-server 114.114.114.114

就可以了,请问,在pc接路由器的环境下,只能在pc机上设置为dhcp吗?
请告知理由。
你的静态配置里面 gateway 哪去了?
回复