Jump to: navigation, search

Virtual Ethernet device

298 bytes added, 17:50, 16 February 2012
no edit summary
himself, including IPs, gateways, etc.
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.
== Virtual Ethernet device usage ==
=== Kernel module ===
First of all, make sure the The <code>vzethdev</code> module is should be loaded:. You can check it with the following commands.
# lsmod | grep vzeth
=== MAC addresses ===
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.
MAC addresses must be entered in XX:XX:XX:XX:XX:XX format.
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: It is to be used like this:
chmod +x
* <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.}}
vzctl set 101 --netif_add eth0 --save
Or, if If you want to specify everything:
vzctl set 101 --netif_add eth0,00:12:34:56:78:9A,veth101.0,00:12:34:56:78:9B --save
Or, if If you want to specify the bridge and leave autogenerate the other values autogenerated:
vzctl set 101 --netif_add eth0,,,,vmbr1 --save

Navigation menu