VIXated with VMware’s VIX
December 18th, 2008 by bunchc
Since my first few posts on this got a bit of attention, I thought I’d add some more to this. In today’s post we’ll cover adding or deleting a route, and setting a default route. I’ve got requests for others that will keep the next few weeks worth of VIX posts busy.
We’ll cover this against both a Windows and a Linux guest, because well… VIX is flexible like that. Remember, if you have any trouble, check that your VMware Tools are running, your command syntax is correct, and that you have the right user & password settings.
On Windows:
Traditionally this would be done by logging into the guest OS, and running one of the following commands:
Adding:
Temporary Route: route add 192.168.100.0 mask 255.255.255.0 192.168.15.1 1
Permanent Route: route add -p 192.168.100.0 mask 255.255.255.0 192.168.15.1 1
Deleting:
route delete 192.168.100.0
Doing this in VIX is as simple as:
Adding:
vmrun -T esx -h https://esx/sdk -u cody.bunch -p password -gu guest.user -gp guest.password runProgramInGuest "[datastore] vm/vmx.vmx" c:\windows\system32\route.exe add -p 192.168.100.0 mask 255.255.255.0 192.168.15.1
Deleting:
vmrun -T esx -h https://esx/sdk -u cody.bunch -p password -gu guest.user -gp guest.password runProgramInGuest "[datastore] vm/vmx.vmx" c:\windows\system32\route.exe delete 192.168.100.0
Setting the default was accomplished back in our setting the IP address post.
C:\Program Files\VMware\VMware VIX>vmrun -T esx -h https://esx.example.com/sdk -u nerv\cody.bunch -p apassword -gu Administrator -gp anotherpassword runProgramInGuest “[sanstorage1] test/test.vmx” c:\windows\system32\netsh int ip set address “Local Area Connection” static 192.168.15.25 255.255.255.0 192.1
On Linux
On Linux, where my knowledge is quite limited, I’ve come to understand (thanks Google) that it’s as simple as the “route add –net” commands to add and delete routes. I did find however, that for making this route persistent, can vary across distro of choice, and thus I’ve not included it here.
Adding:
route add –net 192.168.100.0/24 gw 192.168.15.1
Deleting:
route del –net 192.168.100.0/24 gw 192.168.15.1
In VIX:
Before:
Adding:
vmrun -T esx -h http://dc01.nerv.local/sdk -u user -p password -gu root -gp rootpassword runProgramInGuest "[Local
Storage] shell.nerv.local/shell.nerv.local.vmx" /sbin/route add -net 192.168.10
0.0/24 gw 192.168.15.1
Deleting:
vmrun -T esx -h http://dc01.nerv.local/sdk -u user -p password -gu root -gp rootpassword runProgramInGuest "[Local
Storage] shell.nerv.local/shell.nerv.local.vmx" /sbin/route add -net 192.168.10
0.0/24 gw 192.168.15.1
- Posted in API, ESX, VI3, VIX, VMware, Virtual Infrastructure, administration, esx 3.5, guest OS

Add New Comment
Viewing 2 Comments
Thanks. Your comment is awaiting approval by a moderator.
Do you already have an account? Log in and claim this comment.
Do you already have an account? Log in and claim this comment.
Do you already have an account? Log in and claim this comment.
Add New Comment
Trackbacks
(Trackback URL)
February 14, 2009 at 2:54 pm
compellent... In case you werent sure, a storage area network, or SAN, is a collection of computers and storage devices connected ...
March 10, 2009 at 12:19 am
[...] perintah-perintah yang lain silakan lihat di : http://www.petri.co.il/configure_tcp_ip_from_cmd.htm http://professionalvmware.com/2008/12/18/vixated-with-vmwares-vix/?disqus_reply=7064484#comment-7064... http://www.markwilson.co.uk/blog/2005/10/using-netsh-to-set-multiple-dns-server.htm Other Posts [...]