43
edits
Changes
m
Virtual A virtual Ethernet device consist of two Ethernet devices --,one in [[CT0]] (e.g., vethN.0) and another a corresponding one in CT(e. These devices g., eth0) that are connected to eachother. If a packet is sent to one device it will come out the other device.
First of all, make sure the The <code>vzethdev</code> module is should be loaded:. You can check it with the following commands.
In the below commandsThe following steps to generate a MAC address are not necessary, since newer versionsof vzctl will automatically generate a MAC address for you. These steps are providedin case you want to set a MAC address manually. You should use a random MAC addressesaddress when adding a network interface to a container. Do not use MAC addresses of real eth devices, because this can lead to collisions.
YOU MAY NOT NEED TO GENERATE MAC ADDRESSES BY HAND BECAUSE vzctl --veth_addMAY GENERATE THEM AUTOMATICALLY AS NECESSARY. Nevertheless, there There is a utility script available for generating MAC addresses: http://www.easyvmx.com/software/easymac.sh. It is to be used like this:
Or, if If you want to specify everything:
Or, if If you want to specify the bridge and leave autogenerate the other values autogenerated:
no edit summary
himself, including IPs, gateways, etc.
== Virtual Ethernet device usage ==
=== Kernel module ===
<pre>
# lsmod | grep vzeth
=== MAC addresses ===
MAC addresses must be entered in XX:XX:XX:XX:XX:XX format.
chmod +x easymac.sh
* <tt>host_ifname</tt> is the Ethernet device name on the host ([[CT0]])
* <tt>host_mac</tt> is its MAC address on the host ([[CT0]])
* <tt>bridge</tt> is an optional parameter which can be used in custom network start scripts to automatically add the interface to a bridge.(See the reference to the vznetaddbr script below and persistent bridge configurations.)
{{Note|All parameters except <code>ifname</code> are optional and . Missing parameters, except for bridge, are automatically generated , if not specified. This is the preferred method.}}
Example:
vzctl set 101 --netif_add eth0 --save
vzctl set 101 --netif_add eth0,00:12:34:56:78:9A,veth101.0,00:12:34:56:78:9B --save
vzctl set 101 --netif_add eth0,,,,vmbr1 --save