- 論壇徽章:
- 0
|
vi /etc/network/interfaces 網(wǎng)卡配置文件
#回環(huán)網(wǎng)卡lo
auto lo
iface lo inet loopback
#第一塊網(wǎng)卡eth0
auto eth0
#動態(tài)DHCP
iface eth0 inet dhcp
#靜態(tài)IP
iface eth0 inet static
address 172….
netmask 255….
gateway 172…
dns-nameservers 172…(或在/etc/resolv.conf 設(shè)置DNS服務(wù)器 nameserver 172…)
重啟網(wǎng)卡
/etc/init.d/networking restart
ifdown eth0
ifup eth0
Debian在/etc/udev/rules.d/z25_persistent-net.rules綁定MAC地址與eth0這樣interface名。
如果更改了網(wǎng)卡物理地址或新?lián)Q了網(wǎng)卡,需把這里的名字與/etc/network/interfaces里的同步。
如果用了DHCP協(xié)議,/etc/dhcp3/dhclient.conf也是一個需要查看的地方。
我自己遇到這樣的問題:每次開機后,ifcofig發(fā)現(xiàn)ethxx(其中xx代表數(shù)字)中xx會加1,比如這次是etch0,下次開機就是eth1,以此類推eth2...eth21...,解決的辦法如下:
***************************
auto lo
iface lo inet loopback
allow-hotplug eth0
iface eth0 inet dhcp
***************************
以上為原來的設(shè)置,改動后的設(shè)置如下:
***************************
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 |
|