gateway1:~# cat /etc/network/interfaces
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).
# The loopback network interface
auto lo
iface lo inet loopback
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).
#
# The loopback network interface(配置环回口)
# 开机自动激lo接口
auto lo
# 配置lo接口为环回口
iface lo inet loopback
#
# The primary network interface (配置主网络接口)
#开机自动激活eth0接口
auto eth0
#配置eth0接口为DHCP自动获取
iface eth0 inet dhcp
网卡静态分配IP地址
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).
#
# The loopback network interface(配置环回口)
# 开机自动激lo接口
auto lo
# 配置lo接口为环回口
iface lo inet loopback
#
# The primary network interface (配置主网络接口)
#开机自动激活eth0接口
auto eth0
#配置eth0接口为静态设置IP地址
iface eth0 inet static
address 10.16.3.99
netmask 255.255.255.0
network 10.16.3.0
broadcast 10.16.3.255
gateway 10.16.3.1
# dns-* options are implemented by the resolvconf package, if installed(DNS设置)
#请按照时间情况添写DNS ip地址
dns-nameservers x.x.x.x x.x.x.x
dns-search fireteam.org
网卡进行PPPoE宽带拨号配置
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).
#
# The loopback network interface(配置环回口)
# 开机自动激lo接口
auto lo
# 配置lo接口为环回口
iface lo inet loopback
#
# The primary network interface (配置主网络接口)
#开机自动激活eth0接口
auto eth0
#配置eth0接口为静态设置IP地址
iface eth0 inet static
address 10.16.3.99
netmask 255.255.255.0
network 10.16.3.0
broadcast 10.16.3.255
配置完毕后,重启计算机或网络服务即可将网卡配好。如进行PPPoE宽带拨号,可运行pppoeconf命令进行配置。
第二:
vi /etc/network/interfaces 网卡配置文件
#回环网卡lo
auto lo
iface lo inet loopback
#第一块网卡eth0
auto eth0
#动态DHCP
iface eth0 inet dhcp
#静态IP
iface eth0 inet static
address 172….
netmask 255….
gateway 172…
dns-nameservers 172…(或在/etc/resolv.conf 设置DNS服务器 nameserver 172…)
重启网卡
/etc/init.d/networking restart
ifdown eth0
ifup eth0
Debian在/etc/udev/rules.d/z25_persistent-net.rules绑定MAC地址与eth0这样interface名。
如果更改了网卡物理地址或新换了网卡,需把这里的名字与/etc/network/interfaces里的同步。
如果用了DHCP协议,/etc/dhcp3/dhclient.conf也是一个需要查看的地方。
我自己遇到这样的问题:每次开机后,ifcofig发现ethxx(其中xx代表数字)中xx会加1,比如这次是etch0,下次开机就是eth1,以此类推eth2...eth21...,解决的办法如下:
***************************
auto lo
iface lo inet loopback
allow-hotplug eth0
iface eth0 inet dhcp
***************************
以上为原来的设置,改动后的设置如下:
***************************
auto lo
iface lo inet loopback
#allow-hotplug eth0
auto eth0
iface eth0 inet dhcp
***************************
然后把/etc/udev/rules.d/目录下的这个文件z25_persistent-net.rules删除掉就可以了。