【发布时间】: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