The software described in this documentation is either in Extended Support or Sustaining Support. See https://www.oracle.com/us/support/library/enterprise-linux-support-policies-069172.pdf for more information.
Oracle recommends that you upgrade the software described by this documentation as soon as possible.
By default, a container connected by macvlan relies on the
DHCP server on your local network to obtain its IP address. If
you want the container to act as a server, you would usually
configure it with a static IP address. You can configure DHCP
to serve a static IP address for a container or you can define
the address in the container's config
file.
To configure a static IP address that a container does not obtain using DHCP:
Edit
/container/
, wherename
/rootfs/etc/sysconfig/network-scripts/ifcfg-iface
iface
is the name of the network interface, and change the following line:BOOTPROTO=dhcp
to read:
BOOTPROTO=none
Add the following line to
/container/
:name
/configlxc.network.ipv4 =
xxx
.xxx
.xxx
.xxx
/prefix_length
where
is the IP address of the container in CIDR format, for example:xxx
.xxx
.xxx
.xxx
/prefix_length
192.168.56.100/24
.NoteThe address must not already be in use on the network or potentially be assignable by a DHCP server to another system.
To configure DNS, edit the
hosts
andresolv.conf
files under/container/
.name
/rootfs/etcYou might also need to configure the firewall on the host to allow access to a network service that is provided by a container.