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

Connecting to an l2tp VPN via script doesnt always use the same network interface

· 52CE 我爱测

I have a linux web server and I need to create an on-demand l2tp ipsec VPN connection with a network route. The VPN connection works and the route is automatically created via a script in /etc/ppp/ip-up.d that expects device ppp0…

问题原文

原帖链接 · Josh Kim · CC BY-SA 4.0

I have a linux web server and I need to create an on-demand l2tp ipsec VPN connection with a network route. The VPN connection works and the route is automatically created via a script in /etc/ppp/ip-up.d that expects device ppp0. Everything works fine when I run the following on the command line:

echo "c myvpn" > /var/run/xl2tpd/l2tp-control

As expected, the vpn connects via ppp0 and my route is created. However, when I run this exact same command from a script, sometimes the VPN connects using ppp1 which causes the route creation to fail.

Why is this happening? There is no other network activity going on. Is there a way to specify which network interface gets used?

已采纳解答

原帖链接 · Anton Danilov · CC BY-SA 4.0

By default the name of ppp interface isn't fixed, but you can change this behaviour with unit 0 option in the pppd options file (0 is the numeric suffix of ppp interface name), that used by xl2tpd (option pppoptfile in the xl2tpd configuration file). To monitor activity of network stack you can use ip monitor command.

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

资料来源与适用范围

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

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

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