有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

java dockercompose创建了一个不在公司VPN内的网络

介绍

  • 我有一个微服务在docker容器中运行
  • docker容器正在该公司的服务器(Debian 10)上运行
  • 服务器的IP地址是141.45.146.55
  • 该公司的IP地址采用141.45.0.0/16格式(见以下iptables规则)
  • 此微服务需要与另一台IP地址为141.45.11.192的服务器进行通信

问题

一切正常,直到我打开以下VPN:

Chain INPUT (policy DROP)
target     prot opt source               destination
ACCEPT     all  --  anywhere             anywhere             state ESTABLISHED
ACCEPT     all  --  anywhere             anywhere
ACCEPT     all  --  141.45.0.0/16        anywhere
ACCEPT     tcp  --  anywhere             anywhere             tcp dpt:8443 state NEW,ESTABLISHED
ACCEPT     tcp  --  anywhere             anywhere             tcp dpt:8636 state NEW,ESTABLISHED

Chain FORWARD (policy ACCEPT)
target     prot opt source               destination

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination

Chain DOCKER (0 references)
target     prot opt source               destination
ACCEPT     tcp  --  anywhere             172.18.0.2           tcp dpt:postgresql
ACCEPT     tcp  --  anywhere             172.18.0.3           tcp dpt:https
ACCEPT     tcp  --  anywhere             172.18.0.4           tcp dpt:https
ACCEPT     tcp  --  anywhere             172.18.0.5           tcp dpt:https

Chain DOCKER-ISOLATION-STAGE-1 (0 references)
target     prot opt source               destination

Chain DOCKER-ISOLATION-STAGE-2 (0 references)
target     prot opt source               destination

Chain DOCKER-USER (0 references)
target     prot opt source               destination

mircoservice现在抛出一个异常Caused by: java.net.ConnectException: Connection timed out

到目前为止我做了什么

查看iptables规则,我们可以看到docker compose创建的网络地址与公司的IP地址不同。所以我认为这就是重点,因为如果我在公司的网络之外,我就无法连接目标服务器

问题:

如何将docker(-compose)和/或防火墙配置在公司的VPN内,以便被“另一台服务器”接受


共 (0) 个答案