esxcli随笔

1、esxcli创建虚拟标准交换机

esxcli network nic list

esxcli network vswitch standard add --vswitch-name=vSwitch1
esxcli network vswitch standard add --vswitch-name=vSwitch2

esxcli network vswitch standard uplink add --uplink-name=vmnic3 --vswitch-name=vSwitch1
esxcli network vswitch standard uplink add --uplink-name=vmnic5 --vswitch-name=vSwitch1
esxcli network vswitch standard uplink add --uplink-name=vmnic4 --vswitch-name=vSwitch2
esxcli network vswitch standard uplink add --uplink-name=vmnic6 --vswitch-name=vSwitch2

esxcli network vswitch standard portgroup add --portgroup-name="compute_inside" --vswitch-name=vSwitch1
esxcli network vswitch standard portgroup set --portgroup-name="compute_inside" --vlan-id=301

esxcli network vswitch standard portgroup add --portgroup-name="storage_ext" --vswitch-name=vSwitch2
esxcli network vswitch standard portgroup set --portgroup-name="storage_ext" --vlan-id=300

2、esxcli更改管理ip

在原始ip主机上操作:

esxcli network ip interface remove --interface-name=vmk1        
esxcli network vswitch standard portgroup remove --portgroup-name=vMotion --vswitch-name=vSwitch0      
esxcli network vswitch standard portgroup add --portgroup-name=vMotion --vswitch-name=vSwitch3    
esxcli netwrok vswitch standard portgroup set --portgroup-name=vMotion --vlan-id=4045
esxcli network ip interface add --interface-name=vmk1 --portgroup-name=vMotion     
esxcli network ip interface ipv4 set -g 192.168.34.254 --interface-name=vmk1 -I 192.168.234.27 -N 255.255.255.0 -t static 
esxcli netwrok ip interface tag --interface-name=vmk1 --tagname=vMotion

在改后主机上操作:

esxcli network ip interface ipv4 get
esxcli network ip interface remove --interface-name=vmk0
esxcli network vswitch standard portgroup remove --portgroup-name="Management Network" --vswitch-name=vSwitch0 
esxcli network vswitch standard portgroup add --portgroup-name="Management Network" --vswitch-name=vSwitch3
esxcli network vswitch standard portgroup set --portgroup-name="Management Network" --vlan-id=4045
esxcli network ip interface add --interface-name=vmk0 --portgroup-name="Management Network"
esxcli network ip interface ipv4 set -g 192.168.233.254 --interface-name=vmk0 -I 192.168.233.27 -N 255.255.255.0 -t static
esxcli network ip interface tag add --interface-name=vmk0 --tagname=Management
esxcli network ip interface tag remove --interface-name=vmk1 --tagname=Management

 

  

 

posted @ 2021-11-03 08:59  汝南  阅读(359)  评论(0)    收藏  举报