linux - 在容器中,脚本需要添加一个路由,但它失败并出现错误 :ip: RTNETLINK answers: Operation not allowed
问题描述
该脚本必须在容器中添加路由,但路由添加命令失败并出现以下错误。
ip: RTNETLINK answers: Operation not permitted
上述命令以非 root 用户身份运行
bash-5.1$ /sbin/ip route add 9.0.0.0/8 via 10.196.226.1 dev eth0
ip: RTNETLINK answers: Operation not permitted
bash-5.1$ id
uid=(p2-user)
bash-5.1$ exit
exit
当我们以 root 身份运行相同的命令时,出现错误。
/ # /sbin/ip route add 9.0.0.0/8 via 10.196.226.1 dev eth0
ip: RTNETLINK answers: File exists
解决方案
推荐阅读
- java - How can i know when a JFrame is maximized state Java Swing
- android - 是否可以使用 Bluestacks 对 Nativescript 应用程序进行自动化测试?
- google-cloud-platform - 如何从 GCE VM 实例将视频上传到 Google Cloud Storage
- javascript - 使用 Jquery 选择多个元素,但使用 addClass() 仅向其中一个添加一个类
- c - 如何在 Ubuntu 上获取文件路径 VS 项目?
- python - 烧瓶:使 Dataframe.to_html() 的行可点击
- python - 如何解决Pyqt5在加载html时创建Web浏览器崩溃
- c++ - 使用指针向量的问题(带代码)C++(以及对其使用便利性的疑问)
- java - Spring kafka 消费者不尊重 auto-offset-reset = latest
- javascript - 从静态目录调用本地 Javascript 文件