VMware ESXi:通过命令行配置虚拟交换机vSwitch1

1、添加虚拟交换机 vSwitch1:

esxcli network nic list

esxcli network vswitch standard add --vswitch-name=vSwitch1
esxcli network vswitch standard uplink add --uplink-name=vmnic0 --vswitch-name=vSwitch1
esxcli network vswitch standard uplink add --uplink-name=vmnic1 --vswitch-name=vSwitch1
esxcli network vswitch standard set --mtu=9000 --vswitch-name vSwitch1

2、绑定及故障切换策略:

esxcli network vswitch standard policy failover get -v vSwitch1
esxcli network vswitch standard policy failover set -a vmnic0,vmnic1 -v vSwitch1
esxcli network vswitch standard policy failover set -a vmnic0,vmnic1 -b true -f link -l explicit -n true -v vSwitch1
esxcli network vswitch standard policy failover get -v vSwitch1

3、配置安全策略

esxcli network vswitch standard policy security set -f true -m true -p false -v vSwitch0
esxcli network vswitch standard policy security set -f true -m true -p false -v vSwitch1
esxcli network vswitch standard policy security get -v vSwitch0
esxcli network vswitch standard policy security get -v vSwitch1

4、添加端口组:

esxcli network vswitch standard portgroup add --portgroup-name="172.16.42.0" --vswitch-name=vSwitch1
esxcli network vswitch standard portgroup set --portgroup-name="172.16.42.0" --vlan-id=600

esxcli network vswitch standard portgroup add --portgroup-name="100.1.2.0" --vswitch-name=vSwitch1
esxcli network vswitch standard portgroup set --portgroup-name="100.1.2.0" --vlan-id=700

5、配置vMotion接口:

esxcli network vswitch standard portgroup add --portgroup-name="vMotion" --vswitch-name=vSwitch1
esxcli network vswitch standard portgroup set --portgroup-name="vMotion" --vlan-id=1010
esxcli network ip interface add --interface-name=vmk1 --portgroup-name=vMotion
esxcli network ip interface ipv4 set -g 10.10.10.254 --interface-name=vmk1 -I 10.10.10.55 -N 255.255.255.0 -t static
esxcli network ip interface set --mtu 9000 -i vmk1
esxcli network ip interface tag add -i vmk1 -t VMotion

附:查询命令

esxcfg-vmknic -l
vim-cmd hostsvc/vmotion/netconfig_get

esxcli network vswitch standard list
esxcli network ip interface list
点赞

发表评论

电子邮件地址不会被公开。必填项已用 * 标注