【问题标题】:static route w/ next hop to VPN gets "Network is unreachable'带下一跳到 VPN 的静态路由获取“网络无法访问”
【发布时间】:2016-08-10 23:06:33
【问题描述】:

Ubuntu 14.04,linux 内核 3.13.0-77-generic

我有 3 台服务器 A、B 和 C。服务器 A 和 B 在同一个网络 (Rackspace) 中,服务器 C 在另一个网络 (AWS) 中。我有一个从服务器 B 到服务器 C 所在的 VPC 的 VPN 连接。VPN 连接有效,我可以将流量从服务器 B 发送到服务器 C,反之亦然。我无法弄清楚的是如何将流量从服务器 A 路由到服务器 C。我相信解决方案是在服务器 A 上添加静态路由,如下所示:

$> route add -net 10.0.0.0 netmask 255.252.0.0 gw xxx.xxx.xxx.xxx

其中 xxx.xxx.xxx.xxx 是服务器 B 的私有 ip 地址。但是,该命令的输出是

SIOCADDRT: Network is unreachable

我可以 ping 并将流量从服务器 A 路由到服务器 B,因此我假设无法访问的网络是跨 VPN 隧道的网络。

#/ect/sysctl.conf on server B
-----------------------------
net.ipv4.ip_forward=1
net.ipv4.conf.all.accept_redirects = 0
net.ipv4.conf.all.send_redirects = 1

net.ipv4.conf.eth0.arp_notify = 1
vm.swappiness = 0
net.ipv4.tcp_rmem = 4096 87380 33554432
net.ipv4.tcp_wmem = 4096 65536 33554432
net.core.rmem_max = 33554432
net.core.wmem_max = 33554432
net.ipv4.tcp_window_scaling = 1
net.ipv4.tcp_timestamps = 1
net.ipv4.tcp_sack = 1
net.ipv4.ip_forward = 1
net.ipv4.conf.all.accept_redirects = 0
net.ipv4.conf.all.send_redirects = 0
net.ipv4.conf.default.rp_filter = 0
net.ipv4.conf.default.accept_source_route = 0
net.ipv4.conf.default.send_redirects = 0
net.ipv4.icmp_ignore_bogus_error_responses = 1

不确定我是否错误地使用了 route 命令,或者这是否是从服务器 A 通过 vpn 路由到服务器 C 的正确方法。

我还尝试在route add 命令中指定单个主机——服务器 C 的私有 ip(而不是整个 VPC 的 CIDR)——但我得到了相同的输出。

【问题讨论】:

    标签: linux networking vpn


    【解决方案1】:

    服务器 A 和 B 必须在链接本地范围内。检查地址和掩码。 托盘使用ip route,如: ip route add 10.0.0.0/14 via xxx.xxx.xxx.xxx

    【讨论】:

    • 这也返回“网络无法访问”。当我从服务器 A 运行 traceroute x.x.x.x 时,在 xxxx 之前有一个网关(我们称之为 yyyy),我可以运行 ip route add 10.0.0.0/14 via y.y.y.y,但那之后我是如何让网关进行路由的呢?
    【解决方案2】:

    地址 x.x.x.x 在 Rackspace 服务网络(所有 rackspace 实例共享的专用网络)中。根据 Rackspace 支持,无法修改他们的服务网络路由(以我想要的方式)。他们的建议是创建一个云网络(实际的专用网络),然后在该网络中设置网关并修改路由。

    【讨论】:

      猜你喜欢
      • 2021-07-08
      • 2017-10-03
      • 2020-11-25
      • 2014-10-08
      • 2019-11-03
      • 2018-02-17
      • 1970-01-01
      • 2012-06-12
      • 1970-01-01
      相关资源
      最近更新 更多