VMware Communities
gavinux
Contributor
Contributor

how to change network connection on the fly in workstation

I would like to change the network connection back and forth via windows command shell script, I found the vmrun command can change the ethernet settings, such as:

C:\> vmrun -T ws writevariable MRU1.vmx runtimeconfig ethernet1.pvnid "52 46 86 46 ad af 49 c4-7d af b1 ed 0f 96 c6 1c"

C:\> vmrun -T ws writevariable MRU1.vmx runtimeconfig ethernet1.pvnid "52 35 34 89 e3 d2 ba 36-5e 67 63 c9 ec 4d d2 60"

C:\> vmrun -T ws writevariable MRU1.vmx runtimeconfig ethernet1.pvnid "52 a7 07 39 53 27 d4 b3-92 04 6e 1c 67 a4 8e d6"

C:\> vmrun -T ws writevariable MRU1.vmx runtimeconfig ethernet1.pvnid "52 2a cb cd dc 56 e9 44-bf f2 a6 33 67 bc dc bc"

when I read it back via vmrun readvariable command, it shows the writevariable command executed correctly.

but the network packet didn't redirected to new LAN segment. it still stays at the old one.

If I use the GUI to change the LAN segment, it works perfectly. But I need to use script to do it so that I can automate the test.

What am I missing?lan_segment.png

3 Replies
continuum
Immortal
Immortal

Just an idea ....
Try to disable the nic first. Then change the pvnID. Then re-enable the nic.


________________________________________________
Do you need support with a VMFS recovery problem ? - send a message via skype "sanbarrow"
I do not support Workstation 16 at this time ...

0 Kudos
gavinux
Contributor
Contributor

This won't work. Because:

1. I don't want to touch the virtual machine.

2. I run ifconfig em0 down; ifconfig em0 up in VM, but still not working.

Parveen1988
Enthusiast
Enthusiast

Just an idea,

Try:

ifup emo

0 Kudos