You are not logged in.
Hi there,
I think I followed the guide https://wiki.archlinux.org/index.php/Systemd-nspawn correctly.
I have /etc/systemd/network/50-containers.network setup on my host.
But I can't get network working from a container.
http://s.natalian.org/2015-07-01/no-net … tainer.png
http://ix.io/jpm is a log of how I started the container.
On https://wiki.archlinux.org/index.php/Systemd-networkd there is talk of setting up a container on a bridge. I am not sure what's the _right way_ to do it, but I don't really like bridge since I feel I need the host to dispatch everything to the containers anyway.
So what I was hoping to do was with https://wiki.archlinux.org/index.php/Sy … witch.conf I would be running containers for different httpd services. Like foobar container would be set off with nginx running on the host like so:
server {
server_name foobar.example.com;
location / {
proxy_pass http://foobar;
}
}
Ideally there was some lightweight systemd configuration to dispatch various services to containers, be it http or via a certain port to a container. Since I can't be bothered to run nginx really.
-- mod edit: read the Forum Etiquette and only post thumbnails http://wiki.archlinux.org/index.php/For … s_and_Code [jwr] --
Offline
Can you ping the host from the container and vice versa? You need to use the local interface, e.g. 10.0.0.1
If you want to reach beyond the local virtual network between host and container, make sure ip_forward is set on the host, e.g. as root:
echo 0 > /proc/sys/net/ipv4/ip_forward
echo 1 > /proc/sys/net/ipv4/ip_forward
(For some strange reason, I have to toggle the bit (set to 0, then 1) before it works, putting it in /etc/sysctl.d is not sufficient. Would appreciate it if somebody could reproduce this.)
Offline
I managed to reproduce your issue! http://s.natalian.org/2015-07-02/ip_for … nf_bug.mp4
Only when I had `/etc/sysctl.d/40-ip-forward.conf` set!
Otherwise I did get it working, when setting up still manually:
http://s.natalian.org/2015-07-02/systemd-nspawn.mp4
Update: Filed a bug https://github.com/systemd/systemd/issues/468
Last edited by hendry (2015-07-02 04:03:53)
Offline
Another issue I have is that even though I've gone through the hassle of setting up systemd-networkd in the container, it doesn't work on boot!
http://s.natalian.org/2015-07-02/system … -host0.mp4
This might be a clue:
Jul 02 11:52:10 container systemd-networkd[43]: host0: Cannot configure IPv4 forwarding for interface host0: Read-only file system
Jul 02 11:52:10 container systemd-networkd[43]: host0: Could not start IPv6 router discovery: Address family not supported by protocol
Jul 02 11:52:10 container systemd-networkd[43]: could not add new link: Address family not supported by protocol
Jul 02 11:52:10 container systemd-networkd[43]: lo: Cannot configure IPv4 forwarding for interface lo: Read-only file system
Update: Filed a bug https://github.com/systemd/systemd/issues/469
Last edited by hendry (2015-07-02 04:03:34)
Offline
Great! I added a comment to your first bug report. I don't have your second issue, however.
Offline
If you set up your interfaces with systemd-networkd you have to include an IPForward setting in the .network config file, the global setting will be overridden by per-interface settings when systemd-networkd manages them.
Offline