59
edits
Changes
m
MAC addresses must be entered in XX:XX:XX:XX:XX:XX format. {{Note | that this optionis incremental, so devices are added to already existing ones.}}
==== Examples ====Example:
{{Note|Use random MAC addresses. Do not use MAC addresses of real eth devices, because this can lead to collisions.}}
Warning==== syntax vzctl version >= 3.0.14 ==== Read Update infos about [http: sintax seems changed in (current) version //openvz.org/news/updates/vzctl-3.0.14-1 vzctl 3.0. Actual sintax 14] <pre>vzctl set <VEID> --netif_add <ifname>[,<mac>,<host_ifname>,<host_mac]</pre> Here* <tt>ifname</tt> isthe ethernet device name in the VE* <tt>mac</tt> is its MAC address in the VE* <tt>host_ifname</tt> is the ethernet device name on the host ([[VE0]])* <tt>host_mac</tt> is its MAC address on the host ([[VE0]]) {{Note|All parameters except ifname are optional and are automatically generated if not specified.}} Example:==== Examples ====
where eth0 is the interface being created in your Virtual Machine, while veth101.0 is being created in the host machine.
==== Example ====:
add infos of syntax change in 3.0.14
You might want to add the module to <code>/etc/init.d/vz script</code>, so it will be loaded during startup.
{{Note|since vzctl version 3.0.11, vzethdev is loaded by /etc/init.d/vz}}
=== Adding veth to a VE ===
{{Note|Use random MAC addresses. Do not use MAC addresses of real eth devices, because this can lead to collisions and MAC addresses must be entered in XX:XX:XX:XX:XX:XX format.}}
==== syntax vzctl version < 3.0.14 ====
<pre>
vzctl set <VEID> --veth_add <dev_name>,<dev_addr>,<ve_dev_name>,<ve_dev_addr>
</pre>
Here
* <tt>dev_name</tt> is the ethernet device name that you are creating on the [[VE0|host system]]
* <tt>ve_dev_addr</tt> is its MAC address
NB there are no spaces after the commas
<pre>
vzctl set 101 --veth_add veth101.0,00:12:34:56:78:9A,eth0,00:12:34:56:78:9B --save
Host-side ethernet device will have <tt>veth101.0</tt> name and <tt>00:12:34:56:78:9A</tt> MAC address.
VE-side ethernet device will have <tt>eth0</tt> name and <tt>00:12:34:56:78:9B</tt> MAC address.
<pre>
vzctl set 101 --netif_add eth0,00:12:34:56:78:9A,veth101.0,00:12:34:56:78:9B --save
</pre>
=== Removing veth from a VE ===
==== syntax vzctl version < 3.0.14 ====
<pre>
vzctl set <VEID> --veth_del <dev_name>
Here <tt>dev_name</tt> is the ethernet device name in the [[VE0|host system]].
<pre>
vzctl set 101 --veth_del veth101.0 --save
</pre>
After executing this command veth device with host-side ethernet name veth101.0 will be removed from VE 101 and veth configuration will be updated in VE config file.
==== syntax vzctl version >= 3.0.14 ====
<pre>
vzctl set <VEID> --netif_del <dev_name>|<all>
</pre>
Here
* <tt>dev_name</tt> is the ethernet device name in the [[VE]].
{{Note|If you want to remove all ethernet devices in VE, use all.}}
Example:
<pre>
vzctl set 101 --netif_del eth0 --save
</pre>
== Common configurations with virtual ethernet devices ==