寻觅生命中的那一片浅草......

vmware esxi 3.5命令

今天在esxi 3.5上装panabit,把lnc0配置好后,再把lnc1,lnc2归入网桥1,lnc1为外网,lnc2为内网,一点击提交,本地Netmeter就显示本地网卡的流量为几百K每秒,顿觉不妙,导致路由器也死了,ping路由器网关,显示超时,怀疑是产生广播风暴了。

因为上面有运行一个2003系统,正在破解一个rar文件的密码,不能重启,想到如果把esxi的物理网卡地址改成跟虚拟机的网卡不同网段,是否依然会产生风暴呢?我打开显示器,把IP地址设置为10.1.2.22,连接到路由器2上,同时,本地计算机也连到路由器2,连接上后,本地网卡显示流量依然为几百K每秒,无法用infrastructure client连接服务器端。既然连接到路由器上不可以,那就试下host to host把,真是天助我也,服务器连路由器的线是交叉线,连做线都省了,本机和服务器连起来后,一切正常,也可以用infrastructure client连接,马上把装了panabit的机器关掉,重新将本机和服务器连接到路由器1,哈哈,可以用Remote Desktop连接2003,看来物理网卡的IP网管跟虚拟机的网卡网段是没有关联的,即使不在同一网段,不影响本机对虚拟机的访问,只是不能用infrastructure client管理esxi了,因为物理网卡的地址依然是10.1.2.22,重新回到显示器前,这下好了,Configure Management Network那个不能用了,按ESC、ENTER也没有用,幸好昨天查如何开启ESXi的SSH时知道如何进命令行模式,进入后,以为在/etc/sysconfig/下会有类似于eth0,eth1之类的文件,结果发现没有,整个磁盘都差不多找遍了,都没有,幸好网上找到这篇文章:


更改esx console的物理IP地址及esx console命令
http://aiirii.spaces.live.com/blog/cns!E59E9AB7297384A7!692.entry?sa=578345425

但上面所写的命令,在esxi 3.5 update 2上已经不适用了,在/sbin下主要有如下的命令
~ # cd /sbin
/sbin # ls esxcfg*
esxcfg-advcfg     esxcfg-init-eesx  esxcfg-nas        esxcfg-swiscsi
esxcfg-dhcp       esxcfg-locker     esxcfg-nics       esxcfg-vmhbadevs
esxcfg-dumppart   esxcfg-loglevel   esxcfg-rescan     esxcfg-vmknic
esxcfg-hwiscsi    esxcfg-module     esxcfg-resgrp     esxcfg-vswitch
esxcfg-info       esxcfg-mpath      esxcfg-route

查看vmknic信息
/sbin # esxcfg-vmknic -l
Interface  Port Group          IP Address      Netmask         Broadcast       MAC Address       MTU     TSO MSS   Enabled
vmk4       Management Network  192.168.100.120 255.255.255.0   192.168.100.255 00:1e:c9:ff:3c:cd 1500    40960     true

修改vmknic的IP地址等
/sbin # esxcfg-vmknic -i 192.168.100.120 -n 255.255.255.0 “Management Network”

修改网关
/sbin # esxcfg-route 192.168.100.1

修改马上生效,不用重启network

以上各命令均可加-h参数显示帮助信息,另外说下查看物理网卡信息的命令
/sbin # esxcfg-nics -l
Name    PCI      Driver      Link Speed    Duplex MTU    Description
vmnic1  05:00.00 tg3         Down 0Mbps    Half   1500   Broadcom Corporation NetXtreme BCM5721 Gigabit Ethernet
vmnic0  04:00.00 tg3         Up   100Mbps  Full   1500   Broadcom Corporation NetXtreme BCM5721 Gigabit Ethernet

经过以上设置,可以用infrastructure client连接了。

copy以上介绍那篇文章的内容:

今天安装了另外一台esx 3.5 测试,安装完成后,发觉设置错了网段,本来想用修改linux网卡Ip的方法操作,后来,上网找了下,有专用的命令可用,很简单,如下:
列出当前网卡信息
esxcfg-vswif -l

删除原来的配置vswif0, 没有修改的命令,该文件应该在:/etc/sysconfig/network-scripts/ifcfg-vswif0
esxcfg-vswif -d vswif0

新增配置
esxcfg-vswif -a vswif0 -p “Service Console” -i 172.28.2.2 -n 255.255.255.0 -b 172.28.2.255
(也可使用-i命令直接修改,没测试过)

检查修改后配置是否正确
esxcfg-vswif -l

修改原来hosts的IP, 及网关
vi /etc/hosts
vi /etc/sysconfig/network

附:vmware esx 上的命令行
http://leesun.blog.51cto.com/58664/60092
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

http://itil.org.cn/thread-1336-1-1.html
There are two ways you can change the IP address:
From the VI Client
Or, from the Physcial Console Connection
See the following sections for details on each method.

From the VI Client

Using the Virtual Infrastructure Client, the DNS information (Configuration tab > DNS and Routing) can be changed on the fly. Similarly, the gateway address (routing subtab of the DNS and Routing window) and the hostname (DNS Configuration subtab of DNS and Routing) can be changed through the user interface. Hostname and domain changes through the VI Client do not take place until the ESX host is rebooted.

From the Physical Console Connection

Changing the IP for the service console must be done from a physical console connection, either at the host, through a KVM or other remote console connection. If you make changes through a network connection such as SSH, network connectivity to the service console will disconnect because the service console’s network interface will change.
For this example, it is assumed that vswif0 is the service console adapter that is the interface to which to apply the IP address change. Running the command

esxcfg-vswif -i x.x.x.x vswif0

will set the IP address to the value substituted for x.x.x.x in the command. You will need to edit the /etc/hosts file and change it so that it reflects the new IP address in use for the service console.
The gateway address and hostname are in /etc/sysconfig/network.

After you edit these files, you must reboot the host or restart the network service using the following command:

service network restart

Note: This command breaks any current network connections to the service console.

You can also dynamically change the host name using the command:

hostname newname

Note: This command creates a temporary host name change. This change is lost when the system is rebooted.

To change the DNS server settings, edit the /etc/resolv.conf file and update the nameserver IPs and search domain if applicable.

尚无评论

发表评论

2024年四月
« 5月    
1234567
891011121314
15161718192021
22232425262728
2930