Difference between revisions of "Adding ethernet interface to openVZ container"
(Created page with "=Adding ethernet interface (eth0, eth1, etc.) to container= To add ethernet interface to container use command: <pre> vzctl set <CID> --netif_add <ifname> --save </pre> where...") |
m |
||
(3 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
[[Main Page|Home]] > [[CentOS]] > [[CentOS 6.x]] > [[Virtualization tools]] > [[OpenvZ]] > [[Adding ethernet interface to openVZ container]] | |||
==Enable auto adding of interface to bridge on container start== | |||
Enable automated addition of create interface to bridge using: | |||
<pre> | <pre> | ||
echo 'EXTERNAL_SCRIPT="/usr/sbin/vznetaddbr"' >> /etc/vz/vznet.conf | |||
</pre> | </pre> | ||
which basically adds '<tt>EXTERNAL_SCRIPT="/usr/sbin/vznetaddbr"</tt>' to /etc/vz/vznet.conf | |||
==Add ethernet interface to bridge== | |||
To add ethernet interface to a container use command: | |||
<pre> | <pre> | ||
vzctl set <CID> --netif_add <ifname>,,,,<bridge-name> --save | |||
</pre> | </pre> | ||
where <ifname> can be eth0, eth1 etc. and <bridge-name> is the name of bridge on base machine where interface should be added. The three omitted parameters are mac_address in container, device name on base machine and mac address on base machine respectively. If these parameters are omitted as shown above then the get reasonable defaults. | |||
To configure static IPs for container using interface, say eth0, use following configuration as '<tt>/etc/sysconfig/network-scripts/ifcfg-eth0</tt>' | To configure static IPs for container using interface, say eth0, use following configuration as '<tt>/etc/sysconfig/network-scripts/ifcfg-eth0</tt>' | ||
<pre> | <pre> | ||
Line 25: | Line 27: | ||
NM_CONTROLLED=no | NM_CONTROLLED=no | ||
</pre> | </pre> | ||
[[Main Page|Home]] > [[CentOS]] > [[CentOS 6.x]] > [[Virtualization tools]] > [[OpenvZ]] > [[Adding ethernet interface to openVZ container]] |
Latest revision as of 13:13, 24 August 2022
Home > CentOS > CentOS 6.x > Virtualization tools > OpenvZ > Adding ethernet interface to openVZ container
Enable auto adding of interface to bridge on container start
Enable automated addition of create interface to bridge using:
echo 'EXTERNAL_SCRIPT="/usr/sbin/vznetaddbr"' >> /etc/vz/vznet.conf
which basically adds 'EXTERNAL_SCRIPT="/usr/sbin/vznetaddbr"' to /etc/vz/vznet.conf
Add ethernet interface to bridge
To add ethernet interface to a container use command:
vzctl set <CID> --netif_add <ifname>,,,,<bridge-name> --save
where <ifname> can be eth0, eth1 etc. and <bridge-name> is the name of bridge on base machine where interface should be added. The three omitted parameters are mac_address in container, device name on base machine and mac address on base machine respectively. If these parameters are omitted as shown above then the get reasonable defaults.
To configure static IPs for container using interface, say eth0, use following configuration as '/etc/sysconfig/network-scripts/ifcfg-eth0'
DEVICE=eth0 BOOTPROTO=static ONBOOT=yes IPADDR=<IP address> NETMASK=<Netmask> GATEWAY=<Default Gateway> DNS1=<Local recursive DNS IP> NM_CONTROLLED=no
Home > CentOS > CentOS 6.x > Virtualization tools > OpenvZ > Adding ethernet interface to openVZ container