admin 管理员组

文章数量: 887017


2024年3月8日发(作者:bootstrap教程pdf)

ESXi5.0更改物理网卡的vmnic的顺序

特殊情况(如:更换网卡)下相同的型号的物理主机,ESXI上网卡的VMNIC命名可能发生不一致的情况,为了日常维护需求可以对其重新命名。

默认情况下,ESXi不再支持命令行方式。更改前必需打开ESXi shell。

打开ESXi shell

默认界面下:

按F2输入口令/密码:

选择Troubleshooting Options选项

选中"Enable ESXi Shell",初始状态是“Disabled”

按Enter键,ESXi Shell的状态更改为”Enabled”

如需要远程命令行修改,需要把SSH打开:

注:SSH 默认端口22

按ESC键可以退回到上层界面中。

按alt+F1键,进入到shell界面中,输入用户名和密码后,即可执行命令了

打开 命令行方式,完成。

修改前先把ESXi进入到维护模式(确保ESXi上的VMs都处于关闭状态)

进入目录/etc/vmware,找到配置文件

~ # cd /etc/vmware

/etc/vmware # ls

hostd

support

config icu ist

configrules ike

vm-support

.d ima_ pciid

vmkiscsid

secpolicy

localsas service

vmwauth

firewall lockdown settings

vpxa

ft-vmk-version

welcome

ft-vmx-version microcode ssl

建议修改前先把进行备份:

/etc/vmware # cp

,找/device/字符串,有如下类似内容:

vi

„„

/device/000:000:20.0/owner = "vmkernel"

/device/000:000:25.0/vmkname = "vmnic0"

/device/000:000:26.0/owner = "vmkernel"

/device/000:000:29.0/owner = "vmkernel"

/device/000:000:31.2/vmkname = "vmhba0"

/device/000:001:00.0/vmkname = "vmhba1"

/device/000:001:00.1/vmkname = "vmhba2"

/device/000:002:10.0/vmkname = "vmnic6"

/device/000:002:10.1/vmkname = "vmnic5"

/device/000:002:12.0/vmkname = "vmnic1"

/device/000:002:12.1/vmkname = "vmnic2"

„„

/device/后000:XXX:XX.X 为设备的PCI Device号

(XX为十进制 如:25=19、10=0A)

命令:esxcli network nic list查看其对应关系

/etc/vmware # esxcli network nic list

Name PCI Device Driver Link Speed Duplex MAC Address

MTU Description

------ ------------- ------ ---- ----- ------ -----------------

---- --------------------------------------------------------------

vmnic0 0000:000:19.0 e1000e Up 1000 Full 40:2c:f4:ea:f7:21

1500 Intel Corporation 82579LM Gigabit Network Connection

vmnic1 0000:002:0c.0 e1000 Up 1000 Full 00:0e:0c:70:4c:72

1500 Intel Corporation 82546EB Gigabit Ethernet Controller (Copper)

vmnic2 0000:002:0c.1 e1000 Up 1000 Full 00:0e:0c:70:4c:73

1500 Intel Corporation 82546EB Gigabit Ethernet Controller (Copper)

vmnic5 0000:002:0a.0 e1000 Up 1000 Full 00:0e:0c:85:c0:54

1500 Intel Corporation 82546EB Gigabit Ethernet Controller (Copper)

vmnic6 0000:002:0a.1 e1000 Up 1000 Full 00:0e:0c:85:c0:55

1500 Intel Corporation 82546EB Gigabit Ethernet Controller (Copper)

更改成物理网卡的的vmnic号

比如:vmnic6/5改成vmnic2/1、vmnic1/2改成vmnic4/3

Vi

/device/000:000:20.0/owner = "vmkernel"

/device/000:000:25.0/vmkname = "vmnic0"

/device/000:000:26.0/owner = "vmkernel"

/device/000:000:29.0/owner = "vmkernel"

/device/000:000:31.2/vmkname = "vmhba0"

/device/000:001:00.0/vmkname = "vmhba1"

/device/000:001:00.1/vmkname = "vmhba2"

/device/000:002:10.0/vmkname = "vmnic2"

/device/000:002:10.1/vmkname = "vmnic1"

/device/000:002:12.0/vmkname = "vmnic4"

/device/000:002:12.1/vmkname = "vmnic3"

修改后按ESC键 ,输入:wq!保存后退出。

重启ESXi主机。

检查修改效果

~ # esxcli network nic list

Name PCI Device Driver Link Speed Duplex MAC Address MTU

Description

------ ------------- ------ ---- ----- ------ -----------------

--------------------------------------------------------------

vmnic0 0000:000:19.0 e1000e Up 1000 Full 40:2c:f4:ea:f7:21 1500

Intel Corporation 82579LM Gigabit Network Connection

vmnic1 0000:002:0a.1 e1000 Up 1000 Full 00:0e:0c:85:c0:55 1500

Intel Corporation 82546EB Gigabit Ethernet Controller (Copper)

vmnic2 0000:002:0a.0 e1000 Up 1000 Full 00:0e:0c:85:c0:54 1500

Intel Corporation 82546EB Gigabit Ethernet Controller (Copper)

vmnic3 0000:002:0c.1 e1000 Up 1000 Full 00:0e:0c:70:4c:73 1500

Intel Corporation 82546EB Gigabit Ethernet Controller (Copper)

vmnic4 0000:002:0c.0 e1000 Up 1000 Full 00:0e:0c:70:4c:72 1500

Intel Corporation 82546EB Gigabit Ethernet Controller (Copper)

----

修改前:

修改后:


本文标签: 修改 命令行 输入 维护 网卡