VMplayer: How to bridge to a specific network port
Suppose you need to bridge another network interface under your VM to a specific physical network port. First, you need to create a vmnet port and bind with that specific port. Here are the commands:
vmnet-bridge -n 2 -i eth1 -d /var/run/vmnet-bridge-2.pid -1vmnet2 mknod /dev/vmnet2 c 119 4 vmnet-netifup -d /var/run/vmnet-netifup-vmnet2.pid /dev/vmnet2 vmnet2 ifconfig vmnet2 up
Then you can check with ‘ifconfig vmnet2’ or do ‘tcpdump -ni vmnet2’ to make sure vmnet2 has the traffics that you expected
Alternatively, you can try using /usr/lib/vmware/bin/vmware-netcfg to configure.
Then edit the .vmx file of your VM host by adding the following line:
ethernet1.connectionType = "custom" ethernet1.vnet = "/dev/vmnet2"
Note that VMplayer doesn’t provide any interface to change from bridged network port to custom network port, you have to do it manually by modifying the .vmx file.
If your VM is currently running, don’t just restart the OS. You need to quit and start the VMplayer to read the new changes.
After starting the VMplayer, you should see something like this in the settings:
Click here for more detail description.
If you need to perform promiscuous mode under the VM, then make sure to change the permission in the vmnet port being bridged.
chmod a+rw /dev/vmnet2
(Somehow I have to fiddle the custom port setting between vmnet0 and vmnet2 during the VM is running in order to get the promiscuous mode working)