VIXated with VMware’s VIX

by bunchc on December 18, 2008

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:

Before:
2008-12-15_2039

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

2008-12-15_2049

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

2008-12-15_2054

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:

2008-12-15_2106

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

See!
2008-12-15_2112

  • http://on-net.info/shell-accounts/ linux shells

    Thank you! If you want to play with Linux but don't have a shell or can't install Linux on your box look at http://on-net.info/shell-accounts/ for a free one.

  • http://professionalvmware.com professionalvmware

    Interesting. Thanks

  • Pingback: compellent

  • Pingback: http://aris.nulis.web.id - Overturned by the Difficulty of Having the Ease » Blog Archive » Edit TCP/IP Address melalui Command Prompt Secara Otomatis

  • http://www.club-penguin.org/club-penguin-cheats/club-penguin-unlock-items-online-star-reporter-book-codes.html CLUBPENGUINCHEATCODES

    With this information that i got in this post I am lucky that i saw this I can finally finish my work.

  • http://www.air-jordan-1.com air jordan 1

    Well , the view of the passage is totally correct ,your details is really reasonable and you guy give us valuable informative post, I totally agree the standpoint of upstairs. I often surfing on this forum when I m free and I find there are so much good information we can learn in this forum!
    Chanel shoes

Previous post:

Next post: