Networking: Forward Traffic to a Specific VM Port

How to forward traffic to a specific port on your VM: you need to map a free TCP port from the node that hosts the VM to a free TCP port on the VM.

🚧

Quick navigation

Jump to: Definitions | Limitations | Forward traffic to a specific VM port | Handle incoming traffic on the VM

By default, when you deploy a VM, Orka assigns an SSH, a VNC, and a ScreenShare port to it. During deployment, you can specify additional ports on the VM to which Orka will forward incoming traffic. You need to handle the incoming traffic on the VM separately.

To forward traffic to a specific port, you need to map a free port from the node that hosts the VM to a free port on the VM. The port on the node will listen for requests and then forward them to the respective port on the respective VM.

🚧

Quick command summary

orka vm deploy -v <VM_NAME> --ports <NODE_PORT>:<VM_PORT> -y
POST /resources/vm/deploy/

Definitions

  • VM port: The port to which to forward traffic on the virtual machine. Also: guest port.
  • Node port: The port to map on the node that hosts the virtual machine. Also: host port.

Limitations

  • You can use a node port only once.
  • You can map and forward traffic only to TCP ports.
  • You cannot create port mappings with the following ports and port ranges:
    • 22 (reserved for SSH)
    • 80 (reserved for operational purposes)
    • 443 (reserved for operational purposes)
    • 5000-5014 (reserved for Apple Screen Sharing)
    • 5999-6013 (reserved for VNC)
    • 6443 (reserved for operational purposes)
    • 8822-8836 (reserved for SSH)

Forward traffic to a specific VM port

orka vm deploy -v <VM_NAME> --ports <NODE_PORT>:<VM_PORT> -y
curl --location --request POST "http://<ORKA_API_IP>/resources/vm/deploy/" \
  --header "Content-Type: application/json" \
  --header "Authorization: Bearer <TOKEN>" \
  --data "{
	\"orka_vm_name\": \"<VM_NAME>\",
	\"reserved_ports\": [ \"<NODE_PORT>:<VM_PORT>\"]
}"

The following example maps port 1337 on the node to port 3000 on the VM, using the Orka CLI.

Handle incoming traffic on the VM

Mapping the VM and node ports does not automatically open a port on your VM. You need to handle the incoming traffic on the VM separately. For example, set up software that listens for incoming traffic on the specified VM port.


© 2019-2023 Copyright MacStadium, Inc. – Documentation built with readme.com. Orka is a registered trademark of MacStadium, Inc.