问题描述
这是用例:
- 不允许使用外部 IP
- 存在 GCP 项目的自定义 VPC
- 实例 A 有一个应用程序正在运行
- 实例 B 被视为客户端
- SQL 实例 C 也在 VPC 上,并且只有内部 IP
目标是让 B 向 A 发送 HTTP 请求,以便 A 向 SQL 实例 C 发送查询。
在这种情况下要完成哪些联网步骤? (只有防火墙问题,因为所有实例都在同一个网络上?如果是,防火墙的规则是什么?)
如果 GCP 中的其他服务器位于同一 VPC 上,为什么我们无法 ping 通它们?
谢谢
VPS 防火墙设置:
[
{
"allowed": [
{
"IPProtocol": "tcp","ports": [
"22"
]
},{
"IPProtocol": "tcp","ports": [
"3389"
]
}
],"description": "Allow incoming traffic on IAP","direction": "INGRESS","disabled": false,"kind": "compute#firewall","logConfig": {
"enable": false
},"name": "fw-allow-iap","network": "https://www.googleapis.com/compute/v1/projects//global/networks/NETWORK_HERE","priority": 1000,"selfLink": "https://www.googleapis.com/compute/v1/projects//global/firewalls/fw-allow-iap","sourceRanges": [
"35.235.240.0/20"
]
},{
"allowed": [
{
"IPProtocol": "tcp","ports": [
"80"
]
}
],"description": "","name": "NETWORK_HERE-allow-http","selfLink": "https://www.googleapis.com/compute/v1/projects//global/firewalls/NETWORK_HERE-allow-http","sourceRanges": [
"0.0.0.0/0"
],"targetTags": [
"http-server"
]
},"ports": [
"443"
]
}
],"name": "NETWORK_HERE-allow-https","selfLink": "https://www.googleapis.com/compute/v1/projects//global/firewalls/NETWORK_HERE-allow-https","targetTags": [
"https-server"
]
}
]
实例 B 设置:(实例 A 也有相同的设置)
{
"canIpForward": false,"confidentialInstanceConfig": {
"enableConfidentialCompute": false
},"cpuPlatform": "Intel Haswell","deletionProtection": false,"disks": [
{
"autoDelete": true,"boot": true,"deviceName": "instance-1","diskSizeGb": "10","guestOsFeatures": [
{
"type": "UEFI_COMPATIBLE"
},{
"type": "VIRTIO_SCSI_MULTIQUEUE"
}
],"index": 0,"interface": "SCSI","kind": "compute#attachedDisk","licenses": [
"projects/debian-cloud/global/licenses/debian-10-buster"
],"mode": "READ_WRITE","source": "projects/PROJECT_ID/zones/europe-west1-b/disks/instance-1","type": "PERSISTENT"
}
],"displayDevice": {
"enableDisplay": false
},"kind": "compute#instance","machineType": "projects/PROJECT_ID/zones/europe-west1-b/machineTypes/e2-micro","metadata": {
"fingerprint": "S0UuYvDZ4Tg=","kind": "compute#metadata"
},"name": "instance-1","networkInterfaces": [
{
"kind": "compute#networkInterface","name": "nic0","network": "projects/PROJECT_ID/global/networks/NETWORK_HERE","networkIP": "10.0.1.4","subnetwork": "projects/PROJECT_ID/regions/europe-west1/subnetworks/SUBNET_HERE"
}
],"reservationAffinity": {
"consumeReservationType": "ANY_RESERVATION"
},"scheduling": {
"automaticRestart": true,"onHostMaintenance": "MIGRATE","preemptible": false
},"selfLink": "projects/PROJECT_ID/zones/europe-west1-b/instances/instance-1","serviceAccounts": [
{
"email": "PROJECT_ID-compute@developer.gserviceaccount.com","scopes": [
"https://www.googleapis.com/auth/devstorage.read_only","https://www.googleapis.com/auth/logging.write","https://www.googleapis.com/auth/monitoring.write","https://www.googleapis.com/auth/servicecontrol","https://www.googleapis.com/auth/service.management.readonly","https://www.googleapis.com/auth/trace.append"
]
}
],"shieldedInstanceConfig": {
"enableIntegrityMonitoring": true,"enableSecureBoot": false,"enableVtpm": true
},"shieldedInstanceIntegrityPolicy": {
"updateAutoLearnPolicy": true
},"startRestricted": false,"status": "RUNNING","tags": {
"items": [
"http-server","https-server"
]
},"zone": "projects/PROJECT_ID/zones/europe-west1-b"
}
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)