38
edits
Changes
Moved old way to after new way. Deleted old stuff from examples.
MAC addresses must be entered in XX:XX:XX:XX:XX:XX format.
chmod +x easymac.sh
=== Adding veth to a VE ===
==== syntax vzctl version >= 3.0.14 ====
Read Update infos about [http://openvz.org/news/updates/vzctl-3.0.14-1 vzctl 3.0.14]
<pre>
vzctl set <VEID> --netif_add <ifname>[,<mac>,<host_ifname>,<host_mac]
</pre>
Here
* <tt>ifname</tt> is the 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 ([[CT0]])
* <tt>host_mac</tt> is its MAC address on the host ([[CT0]])
{{Note|All parameters except ifname are optional and are automatically generated if not specified.}}
Example:
<pre>
vzctl set 101 --netif_add eth0
</pre>
Or, if you want to specify everything:
<pre>
vzctl set 101 --netif_add eth0,00:12:34:56:78:9A,veth101.0,00:12:34:56:78:9B --save
</pre>
==== syntax vzctl version < 3.0.14 ====
Example:
<pre>
[host-node] ifconfig eth0
...
HWaddress 00:12:34:56:78:9B
...
</pre>
<pre>
[host-node] easymac.sh -R
00:12:34:56:78:9A
</pre>
<pre>
VE-side ethernet device will have <tt>eth0</tt> name and <tt>00:12:34:56:78:9B</tt> MAC address.
=== Removing veth from a VE ===
==== syntax vzctl version >= 3.0.14 ====
<pre>
vzctl set <VEID> --netif_add netif_del <ifnamedev_name>[,<mac>,<host_ifname>,<host_mac]|all
</pre>
Here
* <ttcode>ifnamedev_name</ttcode> is the 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 ([[CT0]])* <tt>host_mac</tt> is its MAC address on the host ([[CT0VE]]).
{{Note|All parameters except ifname are optional and are automatically generated if not specifiedIf you want to remove all ethernet devices in VE, use <code>all</code>.}}
Example:
<pre>
vzctl set 101 --netif_add netif_del eth0,00:12:34:56:78:9A,veth101.0,00:12:34:56:78:9B --save
</pre>
==== syntax vzctl version < 3.0.14 ====
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.
== Common configurations with virtual ethernet devices ==
==== Add veth device to VE ====
<pre>