Forum / NoMachine for Windows / How to connect to VM without external ip in Google Cloud platform
Tagged: No external ip bastion host gcp
- This topic has 3 replies, 3 voices, and was last updated 6 years ago by
Tom.
-
AuthorPosts
-
June 25, 2020 at 14:36 #28281
vcologluParticipantHow can I connect to a VM without an external ip (ideally a Linux desktop) in Google Cloud Platform? Ideally, I would like to use a bastion host in GCP. Obviously, I mean using NoMachine. Let’s say my home computer is a Windows 10.
https://cloud.google.com/compute/docs/instances/connecting-advanced
Thank you
July 1, 2020 at 12:32 #28351
kroyContributorDid you already look at and follow the instructions: https://www.nomachine.com/accessing-your-remote-desktop-on-google-cloud-platform-via-nomachine
July 6, 2020 at 08:03 #28410
vcologluParticipantYes, this example uses the external ip of the virtual machine. I was looking for a solution that does not rely on the external ip so that I can turn off the external ip on virtual machine.
July 7, 2020 at 09:14 #28432
TomParticipantHello,
you must configure Bastion host as an intermediate host between the home computer and the destination host (Linux host).I assume that the Linux desktop you want to connect to has disabled external IP connections. Bastion host and Linux desktop are in the same internal LAN.
In the VPC network in Firewall:
1) Add a rule allowing connections to port 4000 (you can set a different port) e.g. using „Targets tags”. If your Windows host has a fixed IP you can set the connection permission only for that IP.
2) Add a rule that accepts connections from the local network to any port or only to port 4000 e.g. using „Targets tags”In Compute Engine:
Assign this rule 1 to the Bastion host, e.g. using „Targets tags”.
Assign the rule 2 to a Linux host, e.g. with “Target tags”.Log in to the Bastion host and add rules to redirect traffic on port 4000 to Linux host using iptables
Set traffic redirection from port 4000 to Linux host:
sysctl net.ipv4.ip_forward=1
iptables -t nat -A PREROUTING -p tcp –dport 4000 -j DNAT –to-destination x.x.x.x:4000
iptables -t nat -A PREROUTING -p udp –dport 4000 -j DNAT –to-destination x.x.x.x:4000
iptables -t nat -A POSTROUTING -j MASQUERADE
Where x.x.x.x is the local Linux host IP.
Now connecting to Bastion host on port 4000 using NXPlayer the connection will be transferred to your Linux host.
Regards
Tom -
AuthorPosts
This topic was marked as solved, you can't post.
