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

When running vpnc in docker, get 'Cannot open "/proc/sys/net/ipv4/route/flush": Read-only file system'

· 52CE 我爱测

I'm trying to run console Cisco VPN client in Docker. I start the container like that: docker run -it -v /srv/vpn/keys/:/root/keys/ --network=host --cap-add=NET_ADMIN --device=/dev/net/tun -v /dev/net/tun:/dev/net/tun vpn-vpnc-cl…

问题原文

原帖链接 · Dmitriusan · CC BY-SA 3.0

I'm trying to run console Cisco VPN client in Docker. I start the container like that:

docker run -it -v /srv/vpn/keys/:/root/keys/ --network=host --cap-add=NET_ADMIN  --device=/dev/net/tun -v /dev/net/tun:/dev/net/tun vpn-vpnc-client_img

And then run the vpnc client inside Docker container

vpnc-connect /root/keys/vpnc.conf --local-port 0

It produces the following output:

Cannot open "/proc/sys/net/ipv4/route/flush": Read-only file system
Cannot open "/proc/sys/net/ipv4/route/flush": Read-only file system
Cannot open "/proc/sys/net/ipv4/route/flush": Read-only file system
Cannot open "/proc/sys/net/ipv4/route/flush": Read-only file system
Cannot open "/proc/sys/net/ipv4/route/flush": Read-only file system
Cannot open "/proc/sys/net/ipv4/route/flush": Read-only file system
Cannot open "/proc/sys/net/ipv4/route/flush": Read-only file system
Cannot open "/proc/sys/net/ipv4/route/flush": Read-only file system
Cannot open "/proc/sys/net/ipv4/route/flush": Read-only file system
Cannot open "/proc/sys/net/ipv4/route/flush": Read-only file system
Cannot open "/proc/sys/net/ipv4/route/flush": Read-only file system
Cannot open "/proc/sys/net/ipv4/route/flush": Read-only file system
Cannot open "/proc/sys/net/ipv4/route/flush": Read-only file system
Cannot open "/proc/sys/net/ipv4/route/flush": Read-only file system
Cannot open "/proc/sys/net/ipv4/route/flush": Read-only file system
Cannot open "/proc/sys/net/ipv4/route/flush": Read-only file system
VPNC started in background (pid: 257)...

vpnc connects and creates proper routes, so VPN seems to work. My concern is the warning message. According to the documentation, for /proc/sys/net/ipv4/route/flush

Writing to this file results in a flush of the routing cache.

I don't understand this statement. Is it critical that routing cache did not get flushed?

Also, as I understand, I can issue

echo 1 > /proc/sys/net/ipv4/route/flush

manually after start of the container. But I use monit inside docker container to restart the vpnc if connection gets lost. Can I bind mount /proc/sys/net/ipv4/route/flush from host inside container somehow, and issue the command to flush routing cache from monit script inside container?

已采纳解答

原帖链接 · Dan Lenski · CC BY-SA 4.0

I am one of the core developers of OpenConnect and maintainers of the vpnc-script — which is used by both vpnc and OpenConnect for routing and DNS configuration.

This error message actually comes from the vpnc-script, not from vpnc itself, and…

  1. This error doesn't matter at all. It come from the command ip -4 route flush cache, which triggers IPv4 route flushing, which is an unnecessary, deprecated, no-op in modern Linux kernels.

    We retain it only for backwards-compatibility, in case someone somewhere is running vpnc/OpenConnect on an annnnnnnnnnnnnnnnncieeeeeeent Linux kernel.

  2. We suppressed the error message in a 2019 change to the standard vpnc-script.

    If you simply replace your vpnc-script with the latest version, the error will go away.

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

资料来源与适用范围

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

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

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