Make Simple NVA route IAP traffic through NIC 0 (#2262)

This commit is contained in:
Julio Castillo
2024-05-09 18:29:25 +02:00
committed by GitHub
parent c58850c096
commit d838c4ac47
2 changed files with 948 additions and 944 deletions

View File

@@ -1,6 +1,6 @@
#cloud-config
# Copyright 2023 Google LLC
# Copyright 2024 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -51,6 +51,9 @@ write_files:
%{ endfor ~}
iptables -t nat -A POSTROUTING -o ${interface.name} -j MASQUERADE
%{ endif ~}
%{ if interface.number == 0 ~}
ip route add 35.235.240.0/20 via `curl http://metadata.google.internal/computeMetadata/v1/instance/network-interfaces/0/gateway -H "Metadata-Flavor:Google"` dev ${interface.name}
%{ endif ~}
%{ for route in interface.routes ~}
ip route add ${route} via `curl http://metadata.google.internal/computeMetadata/v1/instance/network-interfaces/${interface.number}/gateway -H "Metadata-Flavor:Google"` dev ${interface.name}
%{ endfor ~}

File diff suppressed because it is too large Load Diff