debian網卡設置

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刪除掉就可以了
 
文章來源於網絡
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章