Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Error] sysctl -w net.ipv4.ip_forward=1 not working with all system #352

Open
TaylorGotIT opened this issue Jan 17, 2025 · 3 comments
Open

Comments

@TaylorGotIT
Copy link

link_base.go
link_base.go:50: [Error] sysctl -w net.ipv4.ip_forward=1 sysctl: error setting key 'net.ipv4.ip_forward': Read-only file system

i am using vyos container to run anylink. VYOS get "net.ipv4.ip_forward=1" by default , and do not need to run this shell cmd.
this may need to be checked with System-Type.

@bjdgyc
Copy link
Owner

bjdgyc commented Jan 20, 2025

你容器里面可以执行这个命令吗 iptables -t nat -A POSTROUTING -s 192.168.90.0/24 -o eth0 -j MASQUERADE

@TaylorGotIT
Copy link
Author

你容器里面可以执行这个命令吗 iptables -t nat -A POSTROUTING -s 192.168.90.0/24 -o eth0 -j MASQUERADE

vyos的容器是podman,无root用户权限。因为启动报错,容器还没拉起;

@TaylorGotIT
Copy link
Author

https://docs.docker.com/reference/cli/docker/container/run/#sysctl

Image
开启内核 net.ipv4.ip_forward=1 转发功能,Docker官方的做法是这样的
如果直接在程序内实现,运行时就必须使用root权限运行(--privileged),这样会不安全。

不知道是否可以出一个非root版的Docker镜像。

参考了以下链接:
https://rmoff.net/2021/01/13/running-as-root-on-docker-images-that-dont-use-root/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants