缘起
为了直接打通办公室内网和 AWS 内网,我搞了个“骨干网搭建”项目,其实就是打通办公室内网和 AWS 各个节点的内网。
- AWS 海外节点之间好弄,有 Transit Gateway
- AWS 北京到 AWS 海外直接也好弄,用 wireguard
难点在于办公室到 AWS 北京之间,因为我在办公室内网没有资源,于是只能求助集团的 IT 团队的网络组同事。结果歪打正着,人家打通到总部内网也是走的 IPsec 方案,于是直接可以依葫芦画瓢。
准备工作
- disable source/destination checking for EC2 using the console or aws-cli(prefer to https://docs.aws.amazon.com/vpc/latest/userguide/VPC_NAT_Instance.html#EIP_Disable_SrcDestCheck)
具体步骤
on the side of checkpoint
- Public IP: 3.3.3.3(supposed)
- Local network: 10.0.1.0/24
on the side of EC2
- Elastic IP: 2.2.2.2(supposed)
- Local network: 10.0.0.10/24
1 | # write configuration to file(take effect after next boot) |
It’s OK now.
收尾工作
- 在 AWS VPC 中修改路由表,将到 10.0.1.0/24 段也就是办公室段的路由指向这一台 EC2
- 在办公室的内网修改路由表,将 10.0.0.0/24 段也就是 AWS 内网的路由指向 checkpoint(非必需,特别是当 checkpoint 本来就是缺省网关的情况下)