但有時此檔案內容會不明原因的清空。如剛裝好的系統,此檔案是空的,因而在 VM 的網卡設定中無法選擇網路連線,或是 VM啟動後,沒有網路連線。
通常預設的內容如下
# This file is automatically generated.
# Hand-editing this file is not recommended.
network0.name = "Bridged"
network0.device = "vmnet0"
network1.name = "HostOnly"
network1.device = "vmnet1"
network2.name = "NAT"
network2.device = "vmnet8"
要修改網路可以使用 [System] -> [Virtual Network Editor] 的管理界面來修改。使用此界面,需要管理者的權限
進入後,看到的畫面
如上圖的設定,多加了一個網路連線,VMNet192,指定至另一個網路實體界面,用來分散網路連量。netmap.conf 的內容如下
# This file is automatically generated.
# Hand-editing this file is not recommended.
network0.name = "Bridged"
network0.device = "vmnet0"
network1.name = "HostOnly"
network1.device = "vmnet1"
network8.name = "NAT"
network8.device = "vmnet8"
network192.name = "VMNet192"
network192.device = "vmnet192"
相關的設定存放在 /etc/vmware/networking
VERSION=1,0
answer VNET_1_DHCP yes
answer VNET_1_DHCP_CFG_HASH 2D1FC829A1BF9D6AF6E0BB38C1309B6864ECCAF8
answer VNET_1_DISPLAY_NAME
answer VNET_1_HOSTONLY_NETMASK 255.255.255.0
answer VNET_1_HOSTONLY_SUBNET 172.16.196.0
answer VNET_1_VIRTUAL_ADAPTER yes
answer VNET_8_DHCP yes
answer VNET_8_DHCP_CFG_HASH 7E6621063F8AA8030863FD40BE68B9E726546C6E
answer VNET_8_DISPLAY_NAME
answer VNET_8_HOSTONLY_NETMASK 255.255.255.0
answer VNET_8_HOSTONLY_SUBNET 172.16.120.0
answer VNET_8_NAT yes
answer VNET_8_VIRTUAL_ADAPTER yes
answer VNL_DEFAULT_BRIDGE_VNET -1
add_bridge_mapping br-7a088684a735 -1
add_bridge_mapping br-9f4c8073b96f -1
add_bridge_mapping br-ffa05106c14a -1
add_bridge_mapping docker0 -1
add_bridge_mapping enp59s0f0 -1
add_bridge_mapping enp59s0f1 -1
add_bridge_mapping veth02c5edf -1
add_bridge_mapping veth7bb5c2f -1
add_bridge_mapping veth8090ffb -1
add_bridge_mapping veth9bf7fb3 -1
add_bridge_mapping vethbb87f47 -1
add_bridge_mapping vethd4007d1 -1
add_bridge_mapping enp24s0f0 0
add_bridge_mapping enp24s0f1 192
修改內容後,執行 systemctl restart vmware-vmnet.service,讓設定生效。