Recently in Ubuntu/Kubuntu/Debian Category

Ubuntu Desktop / Ubuntu Server / Kubuntu與Debian會紀錄網路卡的MAC Address來判斷目前所用的網卡是否與紀錄一致, 倘若不同, 就會自動新增一筆紀錄. 所以就算更換新的網卡(同樣道理, 在A 電腦的VirtualOS 的網卡與B電腦的VirtualOS 的網卡Mac Address 不同), 舊網卡的資料還是一樣會被判定成eth0, 而其他新增的網卡會依照eth1,eth2...一直自動新增下去.

解決的辦法:

sudo vi /etc/udev/rules.d/70-persistent-net.rules

你會看到類似以下的參數設定...

# PCI device 0x10de:0x00df (forcedeth)
#SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:11:22:33:44:55", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"

# PCI device 0x10de:0x00df (forcedeth)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="55:44:33:22:11:00", ATTR{type}=="1", KERNEL=="eth*", NAME="eth1"


只保留最底下的參數 (# PCI device 0x10de:0x00df (forcedeth) 開始), 其餘的通通刪除, 並且將NAME="eth1" 更改成 NAME="eth0"


範例:
# PCI device 0x10de:0x00df (forcedeth)
#SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:11:22:33:44:55", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"


# PCI device 0x10de:0x00df (forcedeth)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="55:44:33:22:11:00", ATTR{type}=="1", KERNEL=="eth*", NAME="eth1"


更改之後, /etc/udev/rules.d/persistent-net.rules 內的參數如下:

# PCI device 0x10de:0x00df (forcedeth)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="55:44:33:22:11:00", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"


修改完畢並且儲存之後重新啟動伺服器 (sudo shutdown -r now)就行了.



注: 這方法適用於所有使用Ubuntu/Debian 的伺服器/電腦.  不管是否用Virtualbox, 都可以用.  比如VMWare 或者安裝在真正的硬碟而非虛擬OS.


參考資料: http://nabeko-notebook.blogspot.com/2009/04/eth0debianubuntu.html
  1. 進入OS之後, VirtualBox Windows 的Menu, Device->Install Guest Additions

  2. 在Kubuntu裡會看到已經自動將Gues Additions mount 成CDROM了.

  3. 打開terminal (KDE->Application->System->Terminal)

  4. 輸入 cd /media/cdrom0

  5. Intel 處理器, 請輸入 sudo sh ./VBoxLinuxAdditions-x86.run 或者;

  6. AMD處理器, 請輸入 sudo sh ./VboxLinuxAdditions-amd64.run

  7. 開始安裝...

About this Archive

This page is an archive of recent entries in the Ubuntu/Kubuntu/Debian category.

CentOS is the previous category.

Find recent content on the main index or look in the archives to find all content.