问题原文
原帖链接 · Samus_ · CC BY-SA 4.0
I have a Linux machine on the intranet which I can only access via SSH. This machine needs to connect to a VPN using OpenConnect; however when I do that, I get disconnected from the SSH session since the intranet's IP is no longer valid.
I can reconnect to it from within the VPN using the IP it got assigned, but that IP changes every time the VPN is connected. I don't have control over any of the networks, only this machine.
Is there a way to keep the SSH connection alive while connecting to the VPN?
openconnect requires a --script argument which takes a script to configure routing. Without it the connection succeeds, but no names are resolved and the intranet's IP remains valid.
I'm currently using Ubuntu's default /etc/vpnc/vpnc-script. I'm good with shell scripting but I know very little about networking. If I have to modify that, I'll need some reference about what or how to change it.
社区高分解答
原帖链接 · EEAA · CC BY-SA 3.0
is there a way to keep the SSH connection alive while connecting to the VPN?
No. That system's routing changes dramatically when you connect to the VPN, which breaks all established TCP sockets.
You should look into using a terminal multiplexer like screen or tmux in your ssh session - that way you can have a persistent shell that you can re-connect to.
摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。
