Thursday, May 2, 2024
 Popular · Latest · Hot · Upcoming
2
rated 0 times [  2] [ 0]  / answers: 1 / hits: 4839  / 2 Years ago, tue, may 17, 2022, 3:02:37

I have made several linux containers using the normal userspace tools (not docker), and I have been setting up a test environment.



I want to set up two containers to try out heartbeat, which requires the containers to bind to and ip address that is not yet configured, namely net.ipv4.ip_nonlocal_bind=1



Everytime I try it, it says something like this:



user@lxc1:~$ sudo sysctl -w net.ipv4.ip_nonlocal_bind=1
sysctl: cannot stat /proc/sys/net/ipv4/ip_nonlocal_bind: No such file or directory


Also modifying the sysctl.conf file doesnt help. So i did some research, and aparently the guest container binds to the host's /proc/sys (which makes sense), so i modified the hosts value by adding the proper value to the hosts sysctl.conf and then i rebooted the host for good measure:



user@host:~$ sudo sysctl -A | grep -i nonlocal
net.ipv4.ip_nonlocal_bind = 1


as noted above, the host reflects the configuration that i want to see the in guest container, but even after rebooting, the container -still- shows the same problem.



How do i modify these values in the guest container, is it even possible?


More From » networking

 Answers
2

I had the same issue. You are right that it is related to LXC containers. I added
net.ipv4.ip_nonlocal_bind = 1
to my LXC host's sysctl.conf , then ran:
sysctl -p (requires root access/sudo)



I did have to reboot the container for the change to take effect. Also, you will still get sysctl: cannot stat /proc/sys/net/ipv4/ip_nonlocal_bind: No such file or directory
on the container. If the functionality works, I am not entirely sure that it is necessary for the same command to be run on the guest container.



I can now access the container via the VIP or the defined IP.


[#26172] Tuesday, May 17, 2022, 2 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
ronicod

Total Points: 71
Total Questions: 111
Total Answers: 111

Location: Montenegro
Member since Fri, Dec 10, 2021
2 Years ago
ronicod questions
Thu, Nov 11, 21, 06:26, 3 Years ago
Sun, May 7, 23, 13:57, 1 Year ago
Sun, Jun 26, 22, 06:13, 2 Years ago
Fri, Oct 14, 22, 13:55, 2 Years ago
;