首页 > 代码库 > VMware 总结安装脚本

VMware 总结安装脚本

###cust configurations###

P_SN=`esxcli hardware platform get | grep "Serial Number" | awk -F ":" ‘{print $NF}‘ | sed ‘s/ //g‘`

P_NAME=`esxcli hardware platform get | grep "Product Name" | awk -F ":" ‘{print $NF}‘`

wget  http://10.10.10.10/config/newserver

LOCAL_IPADDR=`cat newserver | grep $P_SN | awk -F "," ‘{print $1}‘`

#LOCAL_GATEWAY=`cat newserver | grep $P_SN | awk -F "," ‘{print $2}‘`

LOCAL_GATEWAY="$(cat newserver | grep $P_SN | awk -F "." ‘{print $1"."$2"."$3}‘)"."254"

#LOCAL_HOSTMANE=`cat newserver | grep $P_SN | awk -F "," ‘{print $3}‘`

LOCAL_HOSTMANE="lg_${P_SN}_ops"


###network config####


esxcli network ip set --ipv6-enabled=no

esxcli network vswitch standard uplink add --uplink-name=vmnic1 --vswitch-name=vSwitch0

# Add vMotion Portgroup to vSwitch0, assign it VLAN ID 5 and create a VMkernel interface

esxcli network vswitch standard portgroup add --portgroup-name=vMotion --vswitch-name=vSwitch0

esxcli network vswitch standard portgroup set --portgroup-name=vMotion --vlan-id=2060

esxcli network ip interface add --interface-name=vmk0 --portgroup-name=vMotion

#esxcfg-vswitch --vlan=2060 --pg="Management Network" vSwitch0

esxcli network ip interface ipv4 set --interface-name=vmk0 --ipv4=$LOCAL_IPADDR --netmask=255.255.255.0 --type=static

esxcli network ip route ipv4 add --gateway=$LOCAL_GATEWAY  --network=default

# Enable vMotion on the newly created VMkernel vmk1

vim-cmd hostsvc/vmotion/vnic_set vmk0

# Set DNS and hostname

esxcli system hostname set --fqdn=$LOCAL_HOSTMANE

esxcli network ip dns search add --domain=localdomain

esxcli network ip dns server add --server=202.106.196.115

esxcli network ip dns server add --server=8.8.8.8

# Set the default PSP for EMC V-MAX to Round Robin as that is our preferred load balancing mechanism

esxcli storage nmp satp set --default-psp VMW_PSP_RR --satp VMW_SATP_SYMM

# Disable Netq #

esxcfg-module -s force_netq=0,0,0,0 tg3

esxcfg-advcfg -k FALSE netNetqueueEnabled

# Enable SSH and the ESXi Shell

vim-cmd hostsvc/enable_ssh

vim-cmd hostsvc/start_ssh

vim-cmd hostsvc/enable_esx_shell

vim-cmd hostsvc/start_esx_shell


本文出自 “让我men共同成长” 博客,转载请与作者联系!

VMware 总结安装脚本