- 论坛徽章:
- 0
|
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删除掉就可以了。
本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u1/55352/showart_1420884.html |
|