Create a firewall rule To allow IAP to connect to your VM instances,
create a firewall rule that: applies to all VM instances that you want to be accessible by using IAP. allows ingress traffic from the IP range 35.235.240.0/20.
This range contains all IP addresses that IAP uses for TCP forwarding. allows connections to all ports that you want to be accessible by using IAP TCP forwarding, for example, port 22 for SSH and port 3389 for RDP.
Command:
Firewall for IAP
gcloud compute firewall-rules create allow-rdp-ingress-from-iap \ --direction=INGRESS \ --action=allow \ --rules=tcp:3389 \ --source-ranges=35.235.240.0/20
Tunnel Command
gcloud compute start-iap-tunnel INSTANCE_NAME 3389 \
--local-host-port=localhost:LOCAL_PORT \
--zone=ZONE
gcloud compute start-iap-tunnel nshcloudlabs-instance-group-1-9v0v 3389 --local-host-port=localhost:3389 --zone=us-central1-a
Permissions for user:
roles/iap.tunnelResourceAccessor
References:
https://cloud.google.com/iap/docs/using-tcp-forwarding
Comments
Post a Comment