Skip to content

Port forwarding with NAT

manaswis edited this page Mar 29, 2013 · 9 revisions

In order to use your Virtual Machine (VM) as a server so that WSN Nodes can send requests to it, you need to setup NAT Settings. Follow the below mentioned instructions for a Windows 7 Machine:

Prerequisites

On the host machine
Make sure VMnet1 and VMnet8 adapters are enabled.

  1. Open Control Panel
  2. Open Network and Sharing Center
  3. Select "Change adapter settings"
  4. Right click VMNet8 network adapter and enable. Repeat the same for VMNet1 network adapter.

In the Virtual Machine:
Make sure your VM is using NAT type of network connection and you know your VM's IP before hand. Follow the below mentioned instructions to know the IP address of the VM.

  1. Start VM.
  2. In the terminal, type ifconfig.
  3. Note down your VM's IP address.
  4. Shut down the virtual machine.

Its important that you shut down the VM before you start the procedure.

Procedure

On the host machine: Port Forwarding steps

  1. Open command prompt with administrator access.

    • Click Start button.
    • Type cmd or Command Prompt in the Search box.
    • Right click and press "Run As Administrator"
  2. In the command prompt, go to the directory where VMware Player is installed. C:\Program Files\ and so on..

  3. Run the following command:
    rundll32.exe vmnetui.dll VMNetUI_ShowStandalone
    This will open the network editor.

  4. Select VMnet8 option from the list in the top most box.

  5. Go to NAT Settings->Add.

  6. In the Map Incoming Port dialog box, enter the following details:

    • Host Port: 9000
    • Type: TCP
    • Virtual Machine IP Address: Enter the IP address of the VM
    • Virtual Machine port: 9000
    • Description : SensorActVPDS
      In the similar way, add two more entries for the following ports:
      * 9001 - For SensorActBroker
      * 9003 - For SensorActUI
  7. Click OK in the dialog boxes open.

In addition to the above procedure, you also need to open the above ports on your machine.

On the host machine: Steps for Opening ports

  1. Open Control Panel

  2. Click Windows Firewall

  3. Go to the advanced settings from the left sidebar

  4. From the sidebar on the left, select Inbound Rules-> New Rule (from the right sidebar under Actions)

  5. Follow the Inbound Rule Wizard -

    • Rule Type: Port
    • Select TCP on the next screen and type 9000, 9001 and 9003 in the Specific local ports field
    • Select Allow collection
    • Check all
    • Enter any name for the rule and its associated description.
  6. Click Ok

Now start the whole SensorAct system (mongo on the host machine and SensorAct on the VM).
You will now be able to send data to your server using the host machine's IP.

NOTE: You can still access the SensorAct application using VM's IP address but it won't allow you to send data from the WSN Nodes   

For Device Configuration, use the host machine's IP as the Server IP on the P2P page (instructions for the P2P settings here)

You can access your web application using http://<HostIPAddress>:9003/