`
icarusli
  • 浏览: 529022 次
  • 性别: Icon_minigender_1
  • 来自: 广州
社区版块
存档分类
最新评论

esx命令行操作

阅读更多

esx上特有的命令很多,有些是很方便,就用这个来记录我平时在esx上用到的命令

1:看你的esx版本。

vmware -v


2:列出esx里知道的服务

esxcfg-firewall -s


3:查看具体服务的情况

esxcfg-firewall -q sshclinet


4:重新启动vmware服务

service mgmt-vmware restart

 

5: 修改root的密码

passwd root


6:列出你当前的虚拟交换机

esxcfg-vswitch -l


7:查看控制台的设置

esxcfg-vswif -l


8:列出系统的网卡

esxcfg-nics -l


9:添加一个虚拟交换机,名字叫(internal)连接到两块物理网卡,(重新启动服务,vi就能看见了)

esxcfg-vswitch -a vSwitch1

esxcfg-vswitch -A internal vSwitch1

esxcfg-vswitch -L vmnic1 vSwitch1

esxcfg-vswitch -L vmnic2 vSwitch1

10:删除交换机,(注意,别把控制台的交换机也删了)

esxcfg-vswitch -D vSwitch1

11:删除交换机上的网卡

esxcfg-vswitch -u vmnic1 vswitch2

12:删除portgroup

esxcfg-vswitch -D internel vswitch1

13:创建 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

esxcfg-route 172.16.0.254

14:打开防火墙ssh端口

esxcfg-firewall -e sshclient

esxcfg-firewall -d sshclient

15: 创建控制台

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

16: 添加nas设备(a 添加标签,-o,是nas服务器的名字或ip,-s 是nas输入的共享名字)

esxcfg-nas -a isos -o nas.vmwar.cn -s isos

17:列出nas连接

esxcfg-nas -l

18: 强迫esx去连接nas服务器(用esxcfg-nas -l 来看看结果)

esxcfg-nas -r

esxcfg-nas -l

19:连接iscsi 设备(e:enable q:查询 d:disable s:强迫搜索)

esxcfg-swiscsi -e

20:设置targetip

vmkiscsi-tool -D -a 172.16.1.133 vmhba40

21:列出和target的连接

vmkiscsi-tool -l -T vmhba40

22:列出当前的磁盘

ls -l /vmfs/devices/disks

 

 

 

 

 

 

 

1、使用VMware Infrastructure Client连接服务器失败,如下图所示:



2、查看系统服务状态:
[root@dell1 root]# service –status-all
crond (pid 2263) is running…
Chain INPUT (policy ACCEPT 1794K packets, 90M bytes)
pkts bytes target prot opt in out source destination
Chain FORWARD (policy ACCEPT 0 packets, 0 bytes)
pkts bytes target prot opt in out source destination
Chain OUTPUT (policy ACCEPT 2532K packets, 3521M bytes)
pkts bytes target prot opt in out source destination
Incoming and outgoing ports blocked by default.
Enabled services: CIMSLP aam VCB CIMHttpsServer vpxHeartbeats LicenseClient sshServer CIMHttpServer
Opened ports:
NaviCLI : port 6390 tcp.in
NaviCLI : port 443 tcp.out
NaviCLI : port 6391 tcp.in
NaviCLI : port 6389 tcp.in tcp.out
NaviCLI : port 2163 tcp.out udp.in
NaviCLI : port 6392 tcp.in
NaviInitTool : port 2162 udp.out
gpm (pid 2215) is running…
ipmi_msghandler module loaded.
ipmi_si_drv module loaded.
ipmi_devintf module loaded.
/dev/ipmi0 exists.
Table: filter
Chain INPUT (policy ACCEPT)
target prot opt source destination
Chain FORWARD (policy ACCEPT)
target prot opt source destination
Chain OUTPUT (policy ACCEPT)
target prot opt source destination
irqbalance is stopped
iSCSI driver is not loaded
vmware-hostd is stopped
/etc/init.d/microcode_ctl: reading microcode status is not yet supported
Usage: /etc/init.d/mptctlnode {start|stop|restart}
naviagent (pid 2011) is running…
Configured devices:
lo eth1 vswif0
Currently active devices:
lo vmnic2 vmnic1 vmnic0 vswif0
rpc.mountd is stopped
nfsd is stopped
rpc.statd is stopped
nscd is stopped
ntpd is stopped
cimserver (pid 2374) is running…
portmap is stopped
Ramchecker is not running
The random data source exists
rdisc is stopped
saslauthd is stopped
smartd is stopped
snmpd is stopped
snmptrapd is stopped
sshd (pid 5568 5364 2106) is running…
syslogd (pid 1882) is running…
klogd (pid 1886) is running…
Usage: (halt|reboot|start) {start}
The vmnixmod kernel module is loaded.
The VMkernel is loaded.
At least one virtual machine is still running.
Usage: /etc/init.d/VMWAREAAM51_vmware { start | stop }
NOTE: VMware HA Agent attach artifacts cleared from /tmp
none
VMware VMkernel authorization daemon is running (pid 2274).
vmware-vpxa is running
webAccess (pid 6860) is running…
winbindd is stopped
wsmand (pid 2393) is running…
xinetd (pid 2206) is running…
ypbind is stopped
Nightly yum update is disabled.
[root@dell1 root]#
发现vmware-hostd is stopped
[root@dell1 root]# service mgmt-vmware status
vmware-hostd is stopped

3、重启mgmt-vmware服务,过一会后vmware-hostd is stopped
[root@dell1 root]# service mgmt-vmware restart
Stopping VMware ESX Server Management services:
VMware ESX Server Host Agent Services [ OK ]
VMware ESX Server Host Agent Watchdog [ OK ]
VMware ESX Server Host Agent [ OK ]
Starting VMware ESX Server Management services:
VMware ESX Server Host Agent (background) [ OK ]
Availability report startup (background) [ OK ]

4、查看磁盘空间使用情况:
[root@dell1 root]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sdg7 4.5G 4.5G 0 100% /
/dev/sdg1 99M 26M 68M 28% /boot
none 132M 0 132M 0% /dev/shm
/dev/sdg3 981M 47M 885M 6% /var/log
发现磁盘没有剩余可用空间,进一步分析:
[root@dell1 root]# cd /var/core/
[root@dell1 core]# du . -sh
3.1G .
[root@dell1 core]# ls
23045.core 23072.core 23099.core 23127.core 23156.core 23193.core 23230.core 23260.core 23294.core 23337.core 23364.core
23046.core 23073.core 23100.core 23128.core 23157.core 23194.core 23231.core 23261.core 23295.core 23338.core 23365.core
23047.core 23074.core 23101.core 23129.core 23161.core 23195.core 23232.core 23262.core 23297.core 23339.core 23366.core
23048.core 23075.core 23102.core 23130.core 23162.core 23196.core 23233.core 23263.core 23298.core 23340.core 23367.core
23049.core 23076.core 23103.core 23131.core 23163.core 23197.core 23234.core 23264.core 23299.core 23341.core 23368.core
23050.core 23077.core 23104.core 23132.core 23164.core 23198.core 23235.core 23265.core 23300.core 23342.core 23369.core
23051.core 23078.core 23105.core 23133.core 23165.core 23199.core 23236.core 23266.core 23301.core 23343.core 23370.core
23052.core 23079.core 23106.core 23134.core 23166.core 23200.core 23237.core 23267.core 23302.core 23344.core 23371.core
23053.core 23080.core 23107.core 23135.core 23167.core 23202.core 23238.core 23268.core 23303.core 23345.core 23372.core
23054.core 23081.core 23108.core 23136.core 23169.core 23206.core 23239.core 23269.core 23305.core 23346.core 23373.core
23055.core 23082.core 23109.core 23137.core 23170.core 23207.core 23241.core 23271.core 23307.core 23347.core 23374.core
23056.core 23083.core 23110.core 23138.core 23171.core 23208.core 23244.core 23273.core 23308.core 23348.core 26261.core
23057.core 23084.core 23111.core 23139.core 23172.core 23209.core 23245.core 23274.core 23309.core 23349.core 7363.core
23058.core 23085.core 23112.core 23140.core 23173.core 23212.core 23246.core 23275.core 23310.core 23350.core 8628.core
23059.core 23086.core 23113.core 23141.core 23174.core 23213.core 23247.core 23276.core 23311.core 23351.core 8643.core
23060.core 23087.core 23114.core 23142.core 23175.core 23214.core 23248.core 23277.core 23315.core 23352.core 8657.core
23061.core 23088.core 23115.core 23143.core 23177.core 2321.core 23249.core 23278.core 23316.core 23353.core 8671.core
23062.core 23089.core 23116.core 23144.core 23179.core 23220.core 23250.core 23280.core 23317.core 23354.core 8685.core
23063.core 23090.core 23117.core 23145.core 23181.core 23221.core 23251.core 23284.core 23318.core 23355.core 8699.core
23064.core 23091.core 23118.core 23146.core 23182.core 23222.core 23252.core 23285.core 23319.core 23356.core
23065.core 23092.core 23119.core 23147.core 23183.core 23223.core 23253.core 23286.core 23323.core 23357.core
23066.core 23093.core 23120.core 23149.core 23184.core 23224.core 23254.core 23288.core 23324.core 23358.core
23067.core 23094.core 23121.core 23150.core 23185.core 23225.core 23255.core 23289.core 23326.core 23359.core
23068.core 23095.core 23123.core 23151.core 23187.core 23226.core 23256.core 23290.core 23331.core 23360.core
23069.core 23096.core 23124.core 23152.core 23190.core 23227.core 23257.core 23291.core 23333.core 23361.core
23070.core 23097.core 23125.core 23153.core 23191.core 23228.core 23258.core 23292.core 23335.core 23362.core
23071.core 23098.core 23126.core 23154.core 23192.core 23229.core 23259.core 23293.core 23336.core 23363.core
原来是var/core磁盘空间溢出,清理/var/core后:
[root@dell1 core]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sdg7 4.5G 1.4G 2.9G 33% /
/dev/sdg1 99M 26M 68M 28% /boot
none 132M 0 132M 0% /dev/shm
/dev/sdg3 981M 47M 885M 6% /var/log

5、重新启动mgmt-vmware服务:

[root@dell1 core]# service mgmt-vmware restart
Stopping VMware ESX Server Management services:
VMware ESX Server Host Agent Services [ OK ]
VMware ESX Server Host Agent Watchdog [ OK ]
VMware ESX Server Host Agent [ OK ]
Starting VMware ESX Server Management services:
VMware ESX Server Host Agent (background) [ OK ]
Availability report startup (background) [ OK ]
[root@dell1 core]#
[root@dell1 core]# service mgmt-vmware status
vmware-hostd (pid 10339) is running…
[root@dell1 core]#

6、重新使用VMware Infrastructure Client连接服务器成功

分享到:
评论

相关推荐

    VMware_ESX_Server_常用命令行

    本篇将详细阐述VMware ESX Server的常用命令行操作,帮助管理员更高效地管理和维护虚拟环境。 一、登录与退出 在ESX Server中,可以通过SSH(Secure Shell)或直接连接到控制台来访问命令行界面。使用`esxcli`或`...

    vCenter6.7命令行手册

    vSphere命令行接口分为几种不同类型,包括ESX命令行界面(ESXCLI)、PowerShell核心的VMware模块(如PowerCLI)和vSphere命令行界面(vCLI)。ESXCLI是直接在ESXi主机上使用的工具,用于执行与主机硬件和软件配置...

    VMware ESX-ESX 3-5 Installation

    在创建虚拟机时,需要从ESX Server的支持列表中选择合适的操作系统,以确保兼容性。若不匹配,可能会导致安装失败或系统错误,如蓝屏。 值得注意的是,虚拟机的硬件驱动,特别是网卡,有时可能需要手动安装驱动。在...

    VM ESX 3.5 介绍

    安装完成后,可以通过vSphere Client或者通过SSH命令行方式来管理ESX 3.5 Update 3,进行各种虚拟机的部署、监控和维护等工作。 ### 总结 通过上述步骤,我们成功地在VmWare Workstation 6.5环境中创建了一个用于...

    VMWARE ESX4安裝手冊

    - 登录ESX4控制台,通过命令行或vSphere客户端进行网络配置。 - 设置静态IP地址或配置DHCP服务。 - 开启SSH服务以便远程管理。 #### 2. 创建虚拟机 - 使用vSphere客户端创建新的虚拟机。 - 为虚拟机分配CPU、内存等...

    VMware ESX Server 常用命令介绍

    了解并熟练掌握ESX Server的命令行操作是管理员进行高效运维的关键。本文将详细介绍一些VMware ESX Server中的常用命令,包括系统管理、网络维护和磁盘管理等方面。 ### 系统管理 1. **`esxcfg-info`**: 这个命令...

    vmware_ESX Server 4

    4. **管理接口**:ESX Server 4提供了Web管理界面(vSphere Client)和命令行接口(CLI),使得管理员可以远程配置和管理虚拟环境。vSphere Client提供图形化的操作界面,方便用户创建、迁移和监控虚拟机,而CLI则为...

    ESX Server Web配置Web管理功能

    如果使用物理控制台,可以按下`ALT + F1`切换到命令行界面。 - **启动Web管理服务**:运行以下命令来启动Web管理服务: ``` # service vmware-webAccess start ``` - **设置开机启动**:接下来,确保每次系统启动...

    忘记ESX root用户的密码

    这种方法适用于ESX 4.0版本,对于其他版本的ESX或ESXi,虽然基本流程相似,但具体命令和界面可能会有所不同。在实际操作过程中,请务必谨慎行事,并确保遵循所有安全最佳实践。此外,定期更换密码并记录密码也是一个...

    coraid hba卡 esx4.1驱动

    "coraid hba卡 esx4.1驱动"是指专门为Coraid存储系统设计的HBA(Host Bus Adapter)适配器驱动程序,用于VMware ESX 4.1操作系统。这个驱动允许ESX主机与Coraid存储设备进行高效、稳定的数据传输,从而实现存储资源...

    如何使用新VMware-vSphere命令行接口vCLI.doc

    这个工具对于那些习惯于使用命令行操作或者希望自动化管理任务的IT专业人员来说非常有用。vCLI不仅提供了对ESXi主机的基本配置和管理功能,还能执行更高级的操作,如性能监控、软件升级和网络配置。 vCLI的历史可以...

    如何更改ESX服务器的IP地址-及VMware_ESX常用命令

    更改ESX服务器的IP地址涉及多个步骤,包括准备、具体操作和验证。理解这些步骤对于成功地进行网络配置至关重要。同时,熟悉ESX的其他常用命令能帮助IT专业人员更高效地管理和维护虚拟化环境。在进行任何更改前,始终...

    ESX-Server安装手册

    - **基于Linux**: 服务控制台基于修改版的Red Hat Enterprise Linux 3 (Update 6),这使得熟悉Red Hat Linux或其它Unix家族操作系统经验的用户可以更轻松地使用ESX Server的命令行工具。 #### 三、硬件兼容性与故障...

    ESX和vCenter安装指南

    - **使用vSphere命令行移除ESX/ESXi上选定的自定义软件包**:通过命令行工具实现更灵活的管理。 #### 准备vCenter Server数据库 - **vCenter Server数据库修补程序和配置要求**:确保数据库软件处于最新状态,并...

    ibm x3850 m2 上 vmware esx4.0 报错处理过程

    ### IBM X3850 M2 上 ...- **文档记录**:在整个故障处理过程中,详细记录每一步操作及其结果,为后续可能遇到的相似问题提供参考。 通过上述步骤和技术要点的介绍,希望能帮助遇到类似问题的技术人员有效解决问题。

    ESX on WKS651安装指导文档

    安装完成后,你需要通过vSphere Client或命令行工具(如SSH)连接到ESX主机,进行初始配置,包括: - 设置root用户的密码 - 配置网络接口,包括IP地址、子网掩码、网关等 - 安装管理代理(如VMware Tools),提高...

Global site tag (gtag.js) - Google Analytics