解決拷貝的虛擬機器網絡卡配置不正確的問題

2021-07-25 08:54:32 字數 1539 閱讀 7517

解決拷貝的虛擬機器網絡卡配置不正確的問題

一、背景

在開發的過程中,我們經常會拷貝虛擬機器。有時候我們拷貝來的虛擬機器的網絡卡不能正常啟動。出現「沒有找到合適的裝置:沒有找到可擁有鏈結system eth0的裝置」。

二、解決問題

我的虛擬機器的網路介面卡的網路連線模式是橋接模式。

a、清空 /etc/udev/rules.d/70-persistent-net.rules 檔案。

b、重啟機器。(可使用reboot命令重啟機器)。重啟後的系統裡的/etc/udev/rules.d/70-persistent-net.rules會生成新的網絡卡mac位址等網絡卡資訊。

c、配置網絡卡檔案ifcfg-eth(0-n)。如果有多個網絡卡,系統/etc/sysconfig/network-scripts路徑下有多個以ifcfg-eth開頭的檔案。我們系統就乙個網絡卡,所以配置ifcfg-eth0檔案即可。配置資訊如下:

70-persistent-net.rules資訊如下:

[root@localhost ~]# cat /etc/udev/rules.d/70-persistent-net.rules

# this file was automatically generated by the /lib/udev/write_net_rules

# program, run by the persistent-net-generator.rules rules file.

# you can modify it, as long as you keep each rule on a single

# line, and change only the value of the name= key.

# pci device 0x8086:0x100f (e1000)

# pci device 0x8086:0x100f (e1000)

# pci device 0x8086:0x100f (e1000)

subsystem=="net", action=="add", drivers=="?*", attr=="00:0c:29:65:ce:1f", attr=="1", kernel=="eth*", name="eth0"

ifcfg-eth0的資訊如下:

device=eth0

bootproto=none

hwaddr=00:0c:29:65:ce:1f

onboot=yes

netmask=255.255.255.0

ipaddr=192.168.1.120

gateway=192.168.1.1

type=ethernet

說明:把70-persistent-net.rules 檔案中attr 和 ifcfg-eth0中的hwaddr的值配置成一樣,70-persistent-net.rules

檔案中的name和ifcfg-eth0的device的值配置成一樣。最後重啟機器就可以了。

cxf解決多網絡卡的ip獲取不正確的問題

今天幫助解決乙個問題,cxf對外發布webservice的時候,由於伺服器是多網絡卡環境,從wsdl返回的ip是乙個內外位址,解析出錯,所以後來在網上查了下,需要設定publishedendpointurl設定網域名稱即可。用ip的時候wsdl如下 如果在spring裡面設定如下配置,即可 最終返回...

VMware虛擬機器網絡卡配置 Linux

編輯 虛擬網路編輯器 檢視閘道器 編輯 vim etc sysconfig network scripts ifcfg ens33 onboot yes 開啟自動啟用網路連線,這個一定要改 ipaddr 192.168.101.10 設定ip位址 netmask 255.255.225.0 設定子網...

CentOS6 5配置網絡卡 虛擬機器

輸入以下命令 setup彈出以下視窗 上圖中,選擇第三項 網路配置。彈出如下介面 上圖中,第乙個是配ip,第二個是配dns。我們選第乙個,彈出如下介面 給eth0這塊網絡卡配置ip,彈出如下介面 上圖中,號代表自動獲取ip,如果要自動獲取,區域網內必須要有自動分配ip的伺服器存在 即dhcp伺服器 ...