Wednesday, September 7, 2011

Mounting a Windows share from VMware esx 4

Mounting a windows share from VMware esx 4 can be useful for install updates.
First of all you must enable netbios ports on esx firewall, for this task you can run the following commands on your esx server
that will create a netbios.xml file and enable it on the firewall.
cat <<EOF> /etc/vmware/firewall/netbios.xml

 

<!-- Firewall configuration information for netbios connection -->

<ConfigRoot>

<service>

<id>netbios</id>

<rule id='0000'>

<direction>outbound</direction>

<protocol>tcp</protocol>

<port type='dst'>

<begin>137</begin>

<end>139</end>

</port>

<flags>-m state --state NEW</flags>

</rule>

<rule id='0001'>

<direction>outbound</direction>

<protocol>tcp</protocol>

<port type='dst'>445</port>

<flags>-m state --state NEW</flags>

</rule>

</service>

</ConfigRoot>

 

EOF

 

chmod 600 /etc/vmware/firewall/netbios.xml

esxcfg-firewall -e netbios

Once you have enabled the netbios outgoing ports on your firewall you can mount a windows share with something like this:


mount -t cifs //192.168.1.1/download -o username=john,ro /mnt/cdrom

If you are installing esx updates then you surely must put the system in maintenance mode.

And then install the bundles:


cd /mnt/cdrom

 

echo Installing bundles for esx v4.x

for i in *.zip; do esxupdate --bundle=$i update; done
Remember to exit from maintenance mode.

No comments:

Post a Comment