在 Digital Ocean VPS 上为 Ubuntu 添加静态路由

在 Digital Ocean VPS 上为 Ubuntu 添加静态路由

我正在尝试从数字海洋 vps(ubuntu 14.08)添加到远程子网的静态路由,但每次运行以下命令时都会出现错误:

"RTNETLINK answers: Network is unreachable" 

我的公网ip是XXXX,远程网关和主机分别是YYYY和ZZZZ。

# ip route add Z.Z.Z.Z via Y.Y.Y.Y

我相信我的 VPS 有一个由 digitalocean 设置的默认路由,但我已经能够设置带有远程网关的 VPN 网络,但我只是无法 ping 远程主机 ZZZZ 或 telnet 到端口。我确认 VPN 已启动。

答案1

我使用 route 命令向特定主机或网络添加静态路由:

# route add -host <destination IP address> gw <gateway IP address>
# route add <destination IP address> gw <gateway IP address>

答案2

root@heisenberg:~# service ipsec status
IPsec running  - pluto pid: 1092
pluto pid 1092
1 tunnels up

root@heisenberg:~# ipsec auto status
ipsec auto: warning: obsolete command syntax used
000 using kernel interface: netkey
000 interface lo/lo ::1
000 interface lo/lo 127.0.0.1
000 interface lo/lo 127.0.0.1
000 interface eth0/eth0 104.131.13.155
000 interface eth0/eth0 104.131.13.155
000 %myid = (none)
000 debug none
000
000 virtual_private (%priv):
000 - allowed 6 subnets: 10.0.0.0/8, 192.168.0.0/16, 172.16.0.0/12, 25.0.0.0/8, fd00::/8, fe80::/10
000 - disallowed 0 subnets:
000 WARNING: Disallowed subnets in virtual_private= is empty. If you have
000          private address space in internal use, it should be excluded!
000
000 algorithm ESP encrypt: id=2, name=ESP_DES, ivlen=8, keysizemin=64, keysizemax=64
000 algorithm ESP encrypt: id=3, name=ESP_3DES, ivlen=8, keysizemin=192, keysizemax=192
000 algorithm ESP encrypt: id=6, name=ESP_CAST, ivlen=8, keysizemin=40, keysizemax=128
000 algorithm ESP encrypt: id=7, name=ESP_BLOWFISH, ivlen=8, keysizemin=40, keysizemax=448
000 algorithm ESP encrypt: id=11, name=ESP_NULL, ivlen=0, keysizemin=0, keysizemax=0
000 algorithm ESP encrypt: id=12, name=ESP_AES, ivlen=8, keysizemin=128, keysizemax=256
000 algorithm ESP encrypt: id=13, name=ESP_AES_CTR, ivlen=8, keysizemin=160, keysizemax=288
000 algorithm ESP encrypt: id=14, name=ESP_AES_CCM_A, ivlen=8, keysizemin=128, keysizemax=256
000 algorithm ESP encrypt: id=15, name=ESP_AES_CCM_B, ivlen=8, keysizemin=128, keysizemax=256
000 algorithm ESP encrypt: id=16, name=ESP_AES_CCM_C, ivlen=8, keysizemin=128, keysizemax=256
000 algorithm ESP encrypt: id=18, name=ESP_AES_GCM_A, ivlen=8, keysizemin=128, keysizemax=256
000 algorithm ESP encrypt: id=19, name=ESP_AES_GCM_B, ivlen=8, keysizemin=128, keysizemax=256
000 algorithm ESP encrypt: id=20, name=ESP_AES_GCM_C, ivlen=8, keysizemin=128, keysizemax=256
000 algorithm ESP encrypt: id=22, name=ESP_CAMELLIA, ivlen=8, keysizemin=128, keysizemax=256
000 algorithm ESP encrypt: id=252, name=ESP_SERPENT, ivlen=8, keysizemin=128, keysizemax=256
000 algorithm ESP encrypt: id=253, name=ESP_TWOFISH, ivlen=8, keysizemin=128, keysizemax=256
000 algorithm ESP auth attr: id=1, name=AUTH_ALGORITHM_HMAC_MD5, keysizemin=128, keysizemax=128
000 algorithm ESP auth attr: id=2, name=AUTH_ALGORITHM_HMAC_SHA1, keysizemin=160, keysizemax=160
000 algorithm ESP auth attr: id=5, name=AUTH_ALGORITHM_HMAC_SHA2_256, keysizemin=256, keysizemax=256
000 algorithm ESP auth attr: id=6, name=AUTH_ALGORITHM_HMAC_SHA2_384, keysizemin=384, keysizemax=384
000 algorithm ESP auth attr: id=7, name=AUTH_ALGORITHM_HMAC_SHA2_512, keysizemin=512, keysizemax=512
000 algorithm ESP auth attr: id=8, name=AUTH_ALGORITHM_HMAC_RIPEMD, keysizemin=160, keysizemax=160
000 algorithm ESP auth attr: id=9, name=AUTH_ALGORITHM_AES_CBC, keysizemin=128, keysizemax=128
000 algorithm ESP auth attr: id=251, name=AUTH_ALGORITHM_NULL_KAME, keysizemin=0, keysizemax=0
000
000 algorithm IKE encrypt: id=0, name=(null), blocksize=16, keydeflen=131
000 algorithm IKE encrypt: id=5, name=OAKLEY_3DES_CBC, blocksize=8, keydeflen=192
000 algorithm IKE encrypt: id=7, name=OAKLEY_AES_CBC, blocksize=16, keydeflen=128
000 algorithm IKE hash: id=1, name=OAKLEY_MD5, hashsize=16
000 algorithm IKE hash: id=2, name=OAKLEY_SHA1, hashsize=20
000 algorithm IKE hash: id=4, name=OAKLEY_SHA2_256, hashsize=32
000 algorithm IKE hash: id=6, name=OAKLEY_SHA2_512, hashsize=64
000 algorithm IKE dh group: id=2, name=OAKLEY_GROUP_MODP1024, bits=1024
000 algorithm IKE dh group: id=5, name=OAKLEY_GROUP_MODP1536, bits=1536
000 algorithm IKE dh group: id=14, name=OAKLEY_GROUP_MODP2048, bits=2048
000 algorithm IKE dh group: id=15, name=OAKLEY_GROUP_MODP3072, bits=3072
000 algorithm IKE dh group: id=16, name=OAKLEY_GROUP_MODP4096, bits=4096
000 algorithm IKE dh group: id=17, name=OAKLEY_GROUP_MODP6144, bits=6144
000 algorithm IKE dh group: id=18, name=OAKLEY_GROUP_MODP8192, bits=8192
000 algorithm IKE dh group: id=22, name=OAKLEY_GROUP_DH22, bits=1024
000 algorithm IKE dh group: id=23, name=OAKLEY_GROUP_DH23, bits=2048
000 algorithm IKE dh group: id=24, name=OAKLEY_GROUP_DH24, bits=2048
000
000 stats db_ops: {curr_cnt, total_cnt, maxsz} :context={0,5,64} trans={0,5,3072} attrs={0,5,2048}

000 000 “globacom-vpn”:104.131.13.155/32===104.131.13.155<104.131.13.155>:17/1701---104.131.0.1...41.203.65.124<41.203.65.124>===10.100.108.0/24;erouted;eroute 所有者:#5 000 “globacom-vpn”:myip=104.131.13.155;hisip=10.100.108.51;000 “globacom-vpn”:ike_life:86400s;ipsec_l​​ife:3600s;rekey_margin:540s; rekey_fuzz:100%;密钥尝试次数:3 000 “globacom-vpn”:策略:PSK+ENCRYPT+TUNNEL+UP+IKEv2ALLOW+SAREFTRACK+lKOD+rKOD;优先级:32,24;接口:eth0;000 “globacom-vpn”:dpd:动作:清除;延迟:10;超时:20;000 “globacom-vpn”:最新的 ISAKMP SA:#4;最新的 IPsec SA:#5;
000 “globacom-vpn”:需要的 IKE 算法:AES_CBC(7)_256-SHA1(2)_000-MODP1536(5)、AES_CBC(7)_256-SHA1(2)_000-MODP1024(2)、AES_CBC(7)_128-SHA1(2)_000-MODP1536(5)、AES_CBC(7)_128-SHA1(2)_000-MODP1024(2)、3DES_CBC(5)_000-SHA1(2)_000-MODP1536(5)、3DES_CBC(5)_000-SHA1(2)_000-MODP1024(2); flags=-strict 000 “globacom-vpn”: 找到 IKE 算法: AES_CBC(7)_256-SHA1(2)_160-MODP1536(5)AES_CBC(7)_256-SHA1(2)_160-MODP1024(2)AES_CBC(7)_128-SHA1(2)_160-MODP1536(5)AES_CBC(7)_128-SHA1(2)_160-MODP1024(2)3DES_CBC(5)_192-SHA1(2)_160-MODP1536(5)3DES_CBC(5)_192-SHA1(2)_160-MODP1024(2) 000 “globacom-vpn”: 最新 IKE 算法: 3DES_CBC_192-SHA1-MODP1024 000 “globacom-vpn”:需要 ESP 算法:AES(12)_256-SHA1(2)_000、AES(12)_128-SHA1(2)_000、3DES(3)_000-SHA1(2)_000;flags=-strict 000 “globacom-vpn”:已加载 ESP 算法:AES(12)_256-SHA1(2)_160、AES(12)_128-SHA1(2)_160、3DES(3)_192-SHA1(2)_160 000 “globacom-vpn”:最新的 ESP 算法:3DES_000-HMAC_SHA1; pfsgroup=000 000 #5:“globacom-vpn”:500 STATE_QUICK_I2(已发送 QI2,已建立 IPsec SA);EVENT_SA_REPLACE 在 2048 秒内;最新的 IPSEC;eroute 所有者;isakmp#4;空闲;导入:管理员启动 000 #5:“globacom-vpn”[电子邮件保护] [电子邮件保护] [电子邮件保护] [电子邮件保护]ref=0 refhim=4294901761 000 #4:“globacom-vpn”:500 STATE_MAIN_I4(ISAKMP SA 已建立);EVENT_SA_REPLACE 在 85210 秒内;最新的 ISAKMP;lastdpd=10s(seq 输入:1782 输出:0);空闲;导入:管理员启动 000

相关内容