在Debian中设置网卡


发布日期 : 2013-09-24 05:20:00 UTC

访问量: 277 次浏览

在Debian中网卡的设置可以通过/etc/network/interfaces文件来进行,具体可分为三种不同的配置方式:DHCP自动获取、静态分配IP地址 和PPPoE宽带拨号。 具体设置如下:在进行配置之前,首先进入/etc/network目录中,编辑interfaces文件:

网卡通过DHCP自动获取IP地址

# Thisfiledescribesthenetworkinterfacesavailableonyoursystem

# andhowtoactivatethem.Formoreinformation,seeinterfaces(5).

# Theloopbacknetworkinterface(配置环回口)

# 开机自动激lo接口

autolo

# 配置lo接口为环回口

ifaceloinetloopback #

# Theprimarynetworkinterface(配置主网络接口)

# 开机自动激活eth0接口

autoeth0

# 配置eth0接口为DHCP自动获取

ifaceeth0inetdhcp 网卡静态分配IP地址

# Thisfiledescribesthenetworkinterfacesavailableonyoursystem

# andhowtoactivatethem.Formoreinformation,seeinterfaces(5).

# Theloopbacknetworkinterface(配置环回口)

# 开机自动激lo接口

autolo

# 配置lo接口为环回口

ifaceloinetloopback #

# Theprimarynetworkinterface(配置主网络接口)

# 开机自动激活eth0接口

autoeth0

# 配置eth0接口为静态设置IP地址

ifaceeth0inetstatic address10.16.3.99 netmask255.255.255.0 network10.16.3.0
broadcast10.16.3.255 gateway10.16.3.1

# dns-*optionsareimplementedbytheresolvconfpackage,ifinstalled(DNS设置)

dns-nameservers61.153.177.19661.153.177.197 dns-searchfireteam.org
网卡进行PPPoE宽带拨号配置

# Thisfiledescribesthenetworkinterfacesavailableonyoursystem

# andhowtoactivatethem.Formoreinformation,seeinterfaces(5).

# Theloopbacknetworkinterface(配置环回口)

# 开机自动激lo接口

autolo

# 配置lo接口为环回口

ifaceloinetloopback #

# Theprimarynetworkinterface(配置主网络接口)

# 开机自动激活eth0接口

autoeth0

# 配置eth0接口为静态设置IP地址

ifaceeth0inetstatic address10.16.3.99 netmask255.255.255.0 network10.16.3.0
broadcast10.16.3.255 

配置完毕后,重启计算机或网络服务即可将网卡配好。如进行PPPoE宽带拨号,可运行pppoeconf命令进行配置。