0

I have a VM machine (Kali Linux) using NAT Network. I am trying to configure the router to forward connections to Kali on port 80. The local IP of Kali is 10.0.2.15 and my local IP is 192.168.1.122. Virtual Server

When I try to save this, I get:

Error code: 4937

The IP address is not in the same subnet with LAN IP address. Please input another one.

What am I doing wrong?

migrated from security.stackexchange.com Aug 14 at 18:12

This question came from our site for information security professionals.

  • What are you trying to access the VM from? The Internet or your computer running the VM? – user Aug 14 at 17:23
  • @user, I am not sure I understand your question. I want to start a listener on my VM and use the backdoors that I create outside my network. – Kite Aug 14 at 17:26
  • Then you will need to port forward from the router to your 192.168.1.122 device, and port forward from your 192.168.1.122 device to your VM (10.0.2.15). That IP looks like a VirtualBox NAT IP address, so you can set up a port forward in VirtualBox to get port 80 exposed on the host. – user Aug 14 at 17:28
  • You should ask this on stackoverflow or super user instead. – Vipul Nair Aug 14 at 17:42
  • @user, I am not sure how to do this. My 192.168.1.122 device is my host OS. – Kite Aug 14 at 17:45
2

This is your current network:

╔══════════════╗   ╔════════════════════╗   
║VM @ 10.0.2.15║───║Host @ 192.168.1.122║───[Internet]
╚══════════════╝   ╚════════════════════╝

This is what you're trying to do (forward port 80 on your router to 10.0.2.15):

╔══════════════╗   ╔════════════════════╗   
║VM @ 10.0.2.15║───║Host @ 192.168.1.122║───[Internet]
╚══════════════╝   ╚════════════════════╝       │
       └─────────────────────────(Port 80)──────┘

This isn't going to work because the router doesn't know that 10.0.2.15 is behind 192.168.1.122.

Instead you need to do this (forward port 80 on your router to 192.168.1.122, which knows about 10.0.2.15):

╔══════════════╗   ╔════════════════════╗   
║VM @ 10.0.2.15║───║Host @ 192.168.1.122║───[Internet]
╚══════════════╝   ╚════════════════════╝       │
                               └───(Port 80)────┘

And then do this (now that 192.168.1.122 is getting traffic, send it to 10.0.2.15):

╔══════════════╗   ╔════════════════════╗   
║VM @ 10.0.2.15║───║Host @ 192.168.1.122║───[Internet]
╚══════════════╝   ╚════════════════════╝       │
       └───(Port 80)────┘      └───(Port 80)────┘
1

As user stated you need to forward traffic from your router to the VM host (192.168.1.122) from there I would recommend one of two options:

1: Configure the VM to use network bridging which will use DHCP to get an IP address from your router and will be accessible like any other device on your local network. (You would then forward traffic to the DHCP assigned address in the 192.168.1.0/16 for the VM)

2: Configure port forwarding to your VM on your hypervisor.

Example configuration: https://www.howtogeek.com/122641/how-to-forward-ports-to-a-virtual-machine-and-use-it-as-a-server/

Depending on what you're using for virtualization it will be a little different but the same concepts apply across all hypervisors.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.