大网数据广告活动
服务器运维问答

openfortivpn kills my routes

· 52CE 我爱测

I am trying to use openfortivpn to connect. Previously I had been using the Fortinet VPN client on MS-Windows - I now get blue screens every time I try to start it (I am downloading the upgraded version, but want to configure thi…

问题原文

原帖链接 · symcbean · CC BY-SA 4.0

I am trying to use openfortivpn to connect. Previously I had been using the Fortinet VPN client on MS-Windows - I now get blue screens every time I try to start it (I am downloading the upgraded version, but want to configure this on Linux for other reasons).

The infrastructure I am connecting to has a lot of sub-nets, some of which conflict with my local sub-nets. So with the default settings (--set-routes=1) it overwrites my local routes and box disconnects from the local network. The command line options only seem to allow everything or nothing.

I was able to capture the config which was being applied when it started up and configured routes automatically. Cherry picking the relevant entries and trying to apply them (after restarting the VPN with --no-routes, then manually noting the IP address) resulted in a working connection.

ip route add to 10.0.99.0/255.255.255.0 via 10.220.136.94 dev ppp0

But the local address will change each time I connect; I cannot use this as a literal value in the script.

how do I script this to happen automatically?

The man page for openfortivpn mentions some environment variables which control routing - but typing

 "VPN_ROUTE_GATEWAY" openfortivpn

into Google just gives me links to the source code for openfortivpn (and my knowledge of C is too rusty to reverse engineer this).

已采纳解答

原帖链接 · JC Arnu · CC BY-SA 4.0

It turns out it will be possible to automatically do that trick using an ip-up script, I'm still trying to make it work.

And here is the answer : You can create an "ip-up" file and use --pppd-ipparam for routing:

Just add the following file into your /etc/ppp/ip-up.d/yourendpointname:

-you can call it whatever you want-

#!/bin/sh -e

if [ "$PPP_IPPARAM" = "yourendpointname" ]; then
  /sbin/ip route add 10.0.99.0/24 via $PPP_LOCAL
  # add other routes here as needed
fi

Here, "yourendpointname" should match the --pppd-ipparam parameter you want to use in openfortivpn call.

Lastly chmod 755 the ip-up file then use --pppd-ipparam=yourendpointname when calling openfortivpn.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2019-10-10)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 4.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。