Open main menu

OpenVZ Virtuozzo Containers Wiki β

Changes

Virtual Ethernet device

2,173 bytes added, 12:57, 8 June 2006
Common configurations with virtual ethernet devices
== Common configurations with virtual ethernet devices ==
Module <tt>vzethdev</tt> must be loaded to operate with veth devices.
 
=== Simple configuration with virtual ethernet device ===
1. Start VE
<pre>
[host-node] vzctl start 101
</pre>
2. Add veth device to VE
<pre>
[host-node] vzctl set 101 --veth_add veth101.0,00:12:34:56:78:9A,eth0,00:12:34:56:78:9B --save
</pre>
3. Configure devices in VE0
<pre>
[host-node] ifconfig veth101.0 up
[host-node] echo 1 > /proc/sys/net/ipv4/conf/veth101.0/forwarding
[host-node] echo 1 > /proc/sys/net/ipv4/conf/veth101.0/proxy_arp
[host-node] echo 1 > /proc/sys/net/ipv4/conf/eth0/forwarding
[host-node] echo 1 > /proc/sys/net/ipv4/conf/eth0/proxy_arp
</pre>
4. Configure device in VE
<pre>
[host-node] vzctl enter 101
[ve-101] ifconfig eth0 up
[ve-101] ip addr add 192.168.0.101 dev eth0
[ve-101] ip ro add default dev eth0
</pre>
5. Add route in VE0
<pre>
[host-node] ip ro add 192.168.0.101 dev veth101.0
</pre>
=== Virtual ethernet device can be used with IPv6 ===
You'll need 1. Start VE<pre>[host-node] vzctl start 101</pre>2. Add veth device to setup IPv6 address on ethernet device inside a VE<pre>[host-node] vzctl set 101 --veth_add veth101.0, add default route inside a 00:12:34:56:78:9A,eth0,00:12:34:56:78:9B --save</pre>3. Configure devices in VE0<pre>[host-node] ifconfig veth101.0 up[host-node] echo 1 > /proc/sys/net/ipv6/conf/veth101.0/forwarding[host-node] echo 1 > /proc/sys/net/ipv6/conf/eth0/forwarding[host-node] echo 1 > /proc/sys/net/ipv6/conf/all/forwarding</pre>4. Configure device in VEand add route to this address via <pre>[host-side veth node] vzctl enter 101[ve-101] ifconfig eth0 up</pre>5. Start router advertisement daemon (radvd) for IPv6 in VE0Here is simple example of radv.conf<pre>interface veth101.0{ AdvSendAdvert on; MinRtrAdvInterval 3; MaxRtrAdvInterval 10; AdvHomeAgentFlag off;  prefix 3ffe:2400:0:0::/64 { AdvOnLink on; AdvAutonomous on; AdvRouterAddr off; };}; interface eth0{ AdvSendAdvert on; MinRtrAdvInterval 3; MaxRtrAdvInterval 10; AdvHomeAgentFlag off;  prefix 3ffe:0302:0011:0002::/64 { AdvOnLink on; AdvAutonomous on; AdvRouterAddr off; };};</pre>6. Add IPv6 addresses to devices in VE0<pre>[host system-node] ip a add dev veth101.0 3ffe:2400::212:34ff:fe56:789a/64[host-node] ip a add dev eth0 3ffe:0302:0011:0002:211:22ff:fe33:4455/64</pre>
=== Virtual ethernet devices can be joined in one bridge ===
Anonymous user