You are not logged in.
This post talks about systemd-networkd NAT for systemd-nspawn but doesn't explain on how to set it up. I current have virbr0 created by Libvirtd which I can get a NAT address inside the container with LXC and systemd-nspawn --network-bridge=virbr0 --port 80:80 -jbM ubuntu-nginx but port 80 is not forwarded on the host unlike if I ran docker run -d -p 80:80 nginx. How can I create a virbr0 like NAT interface using systemd-networkd instead of Libvirtd and get systemd-nspawn port forwarding to work?
Offline
https://wiki.archlinux.org/index.php/Sy … containers + `man systemd-nspawn`
-p, --port=
If private networking is enabled, maps an IP port on the host onto
an IP port on the container. Takes a protocol specifier (either
"tcp" or "udp"), separated by a colon from a host port number in
the range 1 to 65535, separated by a colon from a container port
number in the range from 1 to 65535. The protocol specifier and its
separating colon may be omitted, in which case "tcp" is assumed.
The container port number and its colon may be ommitted, in which
case the same port as the host port is implied. This option is only
supported if private networking is used, such as --network-veth or
--network-bridge=.
which implies you're doing it correctly; did you try running tcpdump to see where your packets are rejected?
Last edited by Spider.007 (2015-05-30 14:00:43)
Offline
https://wiki.archlinux.org/index.php/Sy … containers + `man systemd-nspawn`
-p, --port=
If private networking is enabled, maps an IP port on the host onto
an IP port on the container. Takes a protocol specifier (either
"tcp" or "udp"), separated by a colon from a host port number in
the range 1 to 65535, separated by a colon from a container port
number in the range from 1 to 65535. The protocol specifier and its
separating colon may be omitted, in which case "tcp" is assumed.
The container port number and its colon may be ommitted, in which
case the same port as the host port is implied. This option is only
supported if private networking is used, such as --network-veth or
--network-bridge=.
which seems to say valid options are tcp:80:80, 80:80 and 80. I am under the impression --port automatically setups up the necessary routing like Docker but that doesn't seem to be the case. If private networking is enabled with
systemd-nspawn --private-network --port 80:80 -jbM ubuntu-nginx
then only localhost would be available inside but the port should still be forwarded to the host?
Last edited by Name Taken (2015-05-30 14:19:48)
Offline
Did you get this to work?
Offline
This works for me now.
Offline