From ebbc89615830eb0839607b00aba5c306d8cb1bd1 Mon Sep 17 00:00:00 2001 From: Nicolas.Schodet Date: Thu, 5 Oct 2017 20:10:10 +0000 Subject: Added a comment: systemd-nspawn with its own network in the container --- ...ent_2_520c00ed10ead57bc46940f98a2fae01._comment | 30 ++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 doc/forum/Using_ip_address_in_a_container/comment_2_520c00ed10ead57bc46940f98a2fae01._comment diff --git a/doc/forum/Using_ip_address_in_a_container/comment_2_520c00ed10ead57bc46940f98a2fae01._comment b/doc/forum/Using_ip_address_in_a_container/comment_2_520c00ed10ead57bc46940f98a2fae01._comment new file mode 100644 index 00000000..78b7563a --- /dev/null +++ b/doc/forum/Using_ip_address_in_a_container/comment_2_520c00ed10ead57bc46940f98a2fae01._comment @@ -0,0 +1,30 @@ +[[!comment format=mdwn + username="Nicolas.Schodet" + avatar="http://cdn.libravatar.org/avatar/0d7ec808ec329d04ee9a93c0da3c0089" + subject="systemd-nspawn with its own network in the container" + date="2017-10-05T20:10:10Z" + content=""" +If you use networkd, things are quite simple, you can use +`--network-zone=something` and it will create a bridge, add the host interface +to it and add an interface in the container. Default networkd configuration +will choose an IP network for the zone (it use the interface name to recognize +what must be done), use DHCP in the container, handle DHCP request on host and +route packets to the external interface. The bridge is automatically removed +when all containers are shut down. + +Without networkd, you can create a bridge on the host in +`/etc/network/interface`: + + auto br0 + iface br0 inet static + address 10.42.0.1 + netmask 255.255.0.0 + pre-up brctl addbr br0 + post-down brctl delbr br0 + bridge_fd 0 + +Then use the `--network-bridge=br0` option. It will add the host interface +automatically to the bridge and you need a way to configure the containers +interface, either using networkd or the traditional ifupdown. + +"""]] -- cgit v1.2.3