This is a placeholder page for the discussion of what the Cloud image (Base at first, Atomic to follow) requires from a networking stack on it's images.
- configure DHCP, renew dhcp leases
- configure with cloud-init
- configure with traditional RH-ecosystem ifcfg-eth0 file (log warnings for unsupported options)
Questions!
- Q: any need to support more than one interface? - Q: if single interface, should we standardize on "eth0"" - Q: dns configuration? - Q: support static IP (via cloud-init?)
Several use cases in EC2 involve instances with multiple network interfaces and occasionally multiple addresses on a single interface. I do not believe all of those need to be configured automatically, but it ought to remain possible for a user/script/etc to make network configuration changes that persist across reboots.
systemd-networkd use cases
Here are some sample use cases for systemd-networkd and example configurations.
Simple DHCP on a single interface
For an interface eth0
, a single .network
file is needed:
# cat /etc/systemd/network/eth0.network [Match] Name=eth0 [Network] DHCP=yes
Static address on a single interface
For an interface eth0
, a single .network
file is needed:
# cat /etc/systemd/network/eth0.network [Match] Name=eth0 [Network] Address=192.168.0.50/24 Address=2001:db8:dead:beef::/64 # These are optional but worth mentioning DNS=8.8.8.8 DNS=8.8.4.4 NTP=pool.ntp.org
You can also split up the addresses into separate blocks:
# cat /etc/systemd/network/eth0.network [Match] Name=eth0 [Network] DNS=8.8.8.8 DNS=8.8.4.4 NTP=pool.ntp.org [Address] Address=192.168.0.50/24 [Address] Address=2001:db8:dead:beef::/64
Or add static routes:
# cat /etc/systemd/network/eth0.network [Match] Name=eth0 [Network] DNS=8.8.8.8 DNS=8.8.4.4 NTP=pool.ntp.org [Address] Address=192.168.0.50/24 [Address] Address=2001:db8:dead:beef::/64 [Route] Destination=10.0.10.0/24 Gateway=192.168.50.1 [Route] Destination=10.0.20.0/24 Gateway=192.168.50.1
Do DHCP on all network devices
You can use wildcards almost anywhere in the [Match]
block. For example, this will cause systemd-networkd to do DHCP on all interfaces:
[Match] Name=eth* [Network] DHCP=yes
Bridging
Let's consider an example where we have eth0
and we want to add it to a bridge. This could be handy for servers where you want to build containers or virtual machines and attach them to the network bridge.
Start by setting up our bridge interface, br0
:
# cat /etc/systemd/network/br0.netdev [NetDev] Name=br0 Kind=bridge
Now that we have a bridge device, let's configure the network for the bridge:
# cat /etc/systemd/network/br0.network [Match] Name=br0 [Network] IPForward=yes DHCP=yes
The IPForward=yes
will take care of the sysctl forwarding setting for us (net.ipv4.conf.br0.forwarding = 1
) automatically when the interface comes up.
Now, let's take the ethernet adapter and add it to the bridge:
# cat /etc/systemd/network/eth0.network [Match] Name=eth0 [Network] Bridge=br0
Simply reboot the system and it will come up with eth0
as a port on br0
.