
1. 看你的esx版本
vmware –v
2. 查看显示ESX硬件,内核,存储,网络等信息
esxcfg-info -a(显示所有相关的信息)
esxcfg-info -w(显示esx上硬件信息)
3. 列出esx里知道的服务
esxcfg-firewall –s
4. 查看具体服务的情况
esxcfg-firewall -q sshclinet
5. 重新启动vmware服务
service mgmt-vmware restart
6. 修改root的密码
passwd root
7. 设置kernel高级选项
esxcfg-advcfg -d(将系统内核恢复默认值)
8. 管理资源组
esxcfg-resgrp -l(显示所有资源组)
9. 列出你当前的虚拟交换机
esxcfg-vswitch -l
esxcfg-vswitch -v 10 -p "Service Console" vSwitch0 (将vSwitch0上的Service Console划分到vLan 10上,如果vLan号为0则不设置vLan)
10. 查看控制台的设置
esxcfg-vswif -l (列出已添加的网卡)
esxcfg-vswif -a (添加网卡)
11. 列出系统的网卡
esxcfg-nics –l
12. 添加一个虚拟交换机,名字叫(internal)连接到两块物理网卡,(重新启动服务,vi就能看见了)
esxcfg-vswitch -a vSwitch1
esxcfg-vswitch -A internal vSwitch1
esxcfg-vswitch -L vmnic1 vSwitch1
esxcfg-vswitch -L vmnic2 vSwitch1
13. 删除交换机,(注意,别把控制台的交换机也删了)
esxcfg-vswitch -D vSwitch1
14. 删除交换机上的网卡
esxcfg-vswitch -u vmnic1 vswitch2
15. 删除portgroup
esxcfg-vswitch -D internel vswitch1
16. 创建 vmkernel switch,如果你希望使用vmotion,iscsi的这些功能,你必须创建(通常是不需要添加网关的)
esxcfg-vswitch -l
esxcfg-vswitch -a vswitch2
esxcfg-vswitch -A "vm kernel" vswitch2
esxcfg-vswitch -L vmnic3 vswitch2
esxcfg-vmknic -a "vm kernel" -i 172.16.1.141 -n 255.255.252.0 (添加一个vmkernel)
17. 防火墙设置
# vi /etc/ssh/sshd_config,找到PermitRootLogin no这项,改为PermitRootLogin yes (开启SSH)
esxcfg-firewall -e sshclient (打开防火墙ssh端口)
esxcfg-firewall -d sshclient (关闭防火墙ssh端口)
esxcfg-firewall -e veritasNetBackup(允许Veritas Netbackup服务)
esxcfg-firewall -o 123,udp,out,ntp(为ntp服务打开UDP协议中的123端口的输出)
18. 路由管理
esxcfg-route(VM生成网卡的路由管理)
esxcfg-route(显示路由表)
esxcfg-route 172.16.0.254(设置vmkernel网关)
19. 创建控制台
esxcfg-vswitch -a vSwitch0
esxcfg-vswitch -A "service console" vSwitch0
esxcfg-vswitch -L vmnic0 vSwitch0
esxcfg-vswif -a vswif0 -p "service console" -i 172.16.1.140 -n 255.255.252.0
20. 添加nas设备(a添加标签,-o,是nas服务器的名字或ip,-s是nas输入的共享名字)
esxcfg-nas -a isos -o nas.vmwar.cn -s isos
21. nas连接管理
esxcfg-nas -r (强迫esx去连接nas服务器)
e用esxcfg-nas -l来看看结果)
esxcfg-nas -a(添加NAS文件系统到/vmfs目录下)
esxcfg-nas -d(删除NAS文件系统)
22. 扫描SCSI设备上的LUN信息
esxcfg-rescan 23. 连接iscsi设备(e:enable q:查询 d, disable s:强迫搜索) esxcfg-swiscsi -e 24. 设置targetip vmkiscsi-tool -D -a 172.16.1.133 vmhba40 25. 列出和target的连接 vmkiscsi-tool -l -T vmhba40 26. 列出当前的磁盘 ls -l /vmfs/devices/disks 27. 内核dump管理工具 esxcfg-dumppart -l(显示当前dump分区配置信息) 28. 路径管理 esxcfg-mpath -l(显示所有路径) esxcfg-mpath -a(显示所有HBA卡) 29. ESX授权管理配置 esxcfg-auth esxcfg-auth --enablenis(运行NIS验证) 30. 管理启动设备 esxcfg-boot esxcfg-boot -b(更新启动设备) 31. 执行initrd的初始化设置 esxcfg-init esxcfg-init(初始化设备) 32. esxcfg-linuxnet(在linux debug模式中,转换vswif设备命名为linux自带的eth命名规则) esxcfg-linuxnet --setup 33. 升级 esxcfg-upgrade(ESX2.X升级到ESX3.X) 二. 使用命令更改Service Console IP 在CLI下更改service console的ip地址,注意大小写,vmware是把物理nic虚拟成vmnic,在vmnic上创建虚拟交换机vswitch,是把网卡当成交换机来使用,不能对网卡进行ip地址的设置,只能在vswitch上创建interface就是vswif,对vswif进行ip设置 1. 使用CLI创建Service Console [创建vSwitch0 [在vSwitch0上创建Portgroup,命名为Service Console [将vmnic0绑定在vSwitch0 [可以看到service console已经绑定 vmnic0 Switch Name Num Ports Used Ports Configured Ports MTU Uplinks vSwitch0 5 1500 vmnic0 PortGroup Name VLAN ID Used Ports Uplinks Service Console 0 1 vmnic0 #创建vswif0并与service console绑定,在ESX里ip地址只能跟vswif0绑定,也就是虚拟交换机的interface [可以看到Service console的IP已经配置到vswif0 Name Port Group IP Address Netmask Broadcast Enabled DHCP vswif0 Service Console 192.168.1.50 255.255.255.0 192.168.1.255 true false [root@VI3 root]# esxcfg-vswitch –l Switch Name Num Ports Used Ports Configured Ports MTU Uplinks vSwitch0 5 1500 vmnic0 PortGroup Name VLAN ID Used Ports Uplinks Service Console 0 1 vmnic0 [重启服务,到这里正常情况下就可以使用VI连接到ESX --------------↓如果不小心配置错了要删除,请看下面↓--------------- [代表的虚拟网卡的interface0,service console对应vswif0 Name Port Group IP Address Netmask Broadcast Enabled DHCP [删除vswif0 [root@VI3 root]# esxcfg-vswitch -l Switch Name Num Ports Used Ports Configured Ports MTU Uplinks vSwitch0 5 1500 vmnic0 PortGroup Name VLAN ID Used Ports Uplinks Service Console 0 1 vmnic0 [root@VI3 root]# esxcfg-vswitch –D “Service Console” 删除vSwitch0上面portgroup [root@VI3 root]# esxcfg-vswitch –D “VM Network” vSwitch0 [删除vswitch0 [之前操作删除了vswitch信息,现在是空白 Switch Name Num Ports Used Ports Configured Ports MTU Uplinks PortGroup Name VLAN ID Used Ports Uplinks 2. 如果不行检查一下以下配置文件. [这里纪录主机名字和网关 NETWORKING=yes G网关 G网关指定在vswif0 [看看这里的信息是否跟之前配置吻合 D之前把service cosole与vswif0关联 MACADDR=00:50:56:43:a3:52 P这里的protgroup与service console一致 BOOTPROTO=static BROADCAST=192.168.251.255 I与service console一致 NETMASK=255.255.255.0 ONBOOT=yes 如果以上不一致,可以手动更改 在vi编辑器中,i键是插入模式,进行文本更改,esc键退出插入模式,:wq保存并退出. 编辑完成reboot.可能启动后显示地址跟设置不同,但是可以使用VI连接到ESX ESX 4.0默认是不打开Web Access服务的,如果要使用该功能,需要开启,方法如下: 1、service vmware-webAccess status #查看状态 2、service vmware-webAccess start #启动服务 3、service vmware-webAccess stop #停止服务 4、chkconfig --level 345 vmware-webAccess on #启动ESX后自动开启服务(测试未成功) 5、chkconfig --level 345 vmware-webAccess off #关闭启动ESX开启服务功能 6、chkconfig --list #查看启动内容 安装ESX4.1后,不能直接通过webAceess访问原因是没有开启这个服务。 1、修改文件,使这个服务每次都能开机自动启动: cd /etc/init.d cp vmware-webAccess vmware-webAccess.orig chkconfig vmware-webAccess on 2、启动这个服务: service vmware-webAccess start 时间同步 11:# service ntpd restart 重启服务 Shutting down ntpd: [ OK ] ntpd: Synchronizing with time server: tail /var/ [FAILED] Starting ntpd: [ OK ] 显示同步失败 2:# tail /var/log/messages 查看日志 Apr 14 10:39:41 VmServer07 ntpd: ntpd shutdown succeeded Apr 14 10:39:41 VmServer07 ntpdate[3402]: can't find host server Apr 14 10:39:50 VmServer07 ntpdate[3402]: no server suitable for synchronization found Apr 14 10:39:50 VmServer07 ntpd: failed 显示没有合适的同步服务器 3:# vi /etc/ntp.conf 查看ntp服务配置文件 restrict kod nomodify notrap noquery nopeer restrict 127.0.0.1 server 127.127.1.0 driftfile /var/lib/ntp/drift # Authentication delay. If you use, or plan to use someday, the 修改server地址为192.168.40.5(192.168.40.5为可用的ntp服务器地址) 4:# vi/etc/ntp/step-tickers 修改server地址为192.168.40.5 Server 192.168.40.5 如果想让次Esxserver做为NTP服务器可以在此添加网络上的NTPServer地址,比如教育网可以添加成 server s2a.time.edu.cn server s2b.time.edu.cn server s2c.time.edu.cn server s2d.time.edu.cn server s2e.time.edu.cn) 4:# esxcfg-firewall –q ntpClient Service ntpClient is blocked. 显示客户端的查询服务被阻止 5:esxcfg-firewall --enableService ntpClient 开启ntp的客户端查询服务,Esx做为客户端就可以和192.168.40.5进行时间同步了。 6:所有设定完成,检验一下可否域时间服务器192.168.40.5同步时间 # service ntpd restart Shutting down ntpd: [ OK ] ntpd: Synchronizing with time server: [ OK ] Starting ntpd: [ OK ] # ntpdate –u 192.168.40.5 手动同步时间 14 Apr 16:56:11 ntpdate[3092]: adjust time server 192.168.40.5 offset -0.006880 sec 7:# chkconfig -level 345 ntpd on 设置ntpd服务自动启动 8:# watch “ntpq -p” 可以查询ntpd进程运行状态
