Difference between revisions of "Talk:Virtual Ethernet device"

From OpenVZ Virtuozzo Containers Wiki
Jump to: navigation, search
(Multiple persistent Veth interfaces)
 
(23 intermediate revisions by 11 users not shown)
Line 6: Line 6:
 
</pre>
 
</pre>
  
being run on the host node, VE0.  I don't think this can be correct, because eth0 exists in VE 101, not VE0.
+
being run on the host node, VE0.  I don't think this can be correct, because eth0 exists in VE 101, not VE0. {{unsigned|Andrex|01:11, 15 July 2006}}
-- {{unsigned|Andrex}}
 
 
 
  
 
: This is correct, because we need to enable forwarding on both network interfaces in VE0 (host-node eth0 and veth101.0) to allow the network packets on one network interface (host-node eth0) to be forwarded to another network interface (veth101.0). The same thing with proxy ARP, we need to enable it on host-node eth0 and veth101.0 network interfaces. --[[User:Major|Major]] 08:42, 17 July 2006 (EDT)
 
: This is correct, because we need to enable forwarding on both network interfaces in VE0 (host-node eth0 and veth101.0) to allow the network packets on one network interface (host-node eth0) to be forwarded to another network interface (veth101.0). The same thing with proxy ARP, we need to enable it on host-node eth0 and veth101.0 network interfaces. --[[User:Major|Major]] 08:42, 17 July 2006 (EDT)
 
  
 
==Multiple persistent Veth interfaces==
 
==Multiple persistent Veth interfaces==
 
The script for making a persistent bridge get added to a particular host-bridge on startup VPS/VE, doesn't seem to account for having multiple bridges. I have a bridge to a private lan for administrative functions and a bridge to the public network for inbound connections for services. How might one ensure that the vethVEID.x's are hooked up to the bridges on the host every time the VE is started? --[[User:Btrotter|Btrotter]] 05:34, 17 March 2008 (EDT)
 
The script for making a persistent bridge get added to a particular host-bridge on startup VPS/VE, doesn't seem to account for having multiple bridges. I have a bridge to a private lan for administrative functions and a bridge to the public network for inbound connections for services. How might one ensure that the vethVEID.x's are hooked up to the bridges on the host every time the VE is started? --[[User:Btrotter|Btrotter]] 05:34, 17 March 2008 (EDT)
  
: Please take a look on articles [http://wiki.openvz.org/Using_private_IPs_for_Hardware_Nodes Using private IPs for Hardware Nodes] and [http://vireso.blogspot.com/2008/02/2-veth-with-2-brindges-on-openvz-at.html Bridged Networks for OpenVZ]. There you will find scripts which will help you to manage 2 bridges, and you can simply extend this script to use more then 2 bridges. --[[User:Major|Major]] 15:59, 27 March 2008 (MSK)
+
: Please take a look at [[Using private IPs for Hardware Nodes]] and http://sysadmin-ivanov.blogspot.com/2008/02/2-veth-with-2-bridges-on-openvz-at.html. There you will find scripts which will help you to manage 2 bridges, and you can simply extend this script to use more then 2 bridges. --[[User:Major|Major]] 15:59, 27 March 2008 (MSK)
 +
 
 +
==Making a bridged veth-device persistent==
 +
 
 +
Is this also obsolete, like the section I just deleted? [[User:Mrjcleaver|Mrjcleaver]] 13:35, 31 May 2008 (EDT)
 +
 
 +
Please leave this in for now! I just needed it today for setup on a Debian HN.<br>
 +
Also I noted that a crucial word/reference at the end of the following sentence is missing: "4. Of course, the CT's operating system will need to have ." Could someone with wiki-knowledge please restore this (if it was ever known)?
 +
[[User:Laboa|Laboa]] 22:50, 12. Oct 2008 (CEST)
 +
 
 +
==Configure devices in CT0==
 +
These devices under /proc didn't exist for me, but I left them in case they are still needed, even with the new vzctl. [[User:Mrjcleaver|Mrjcleaver]] 13:59, 31 May 2008 (EDT)
 +
: These files did not exist because you executed a copy/paste, which is incorrect. You should replace 'veth101.0' with veth###.# where ###.# is your relevant VEID (for scripts this should do: 'veth${VEID}.0') according to your VE IDs, and for each VE ID you use veth. -- {{unsigned|79.107.116.50|21:29, 25 November 2009}}
 +
 
 +
== Creating veth without OpenVZ ==
 +
 
 +
How to create veth devices pair without of OpenVZ?
 +
I want something like
 +
<pre>modprobe veth
 +
ifconfig veth0 192.168.0.1
 +
ifconfig veth1 192.168.0.2</pre>
 +
 
 +
Answer: Enable CONFIG_VETH in your kernel, load the veth module and create a new pair with the 'ip' command from the [http://www.linuxfoundation.org/collaborate/workgroups/networking/iproute2 iproute2 package].
 +
<pre>modprobe veth
 +
ip link add name veth0 type veth peer name veth1
 +
ifconfig veth0 192.168.0.1
 +
ifconfig veth1 192.168.0.2</pre>
 +
 
 +
You may also want to check out this [ftp://robur.slu.se/pub/Linux/bifrost/seminars/workshop-2010-01-27/jens/Namespaces.pdf presentation on namespaces in Linux].
 +
 
 +
== Using iproute toolset or net-tools toolset ==
 +
 
 +
Hello,
 +
 
 +
I propose to substitute all usage of
 +
 
 +
  ifconfig <device> 0
 +
 
 +
with
 +
 
 +
  ip link set <device> up
 +
 
 +
 
 +
Since iproute seems to be a requirement, I think its a good idea to drop support for ifconfig.

Latest revision as of 22:14, 7 December 2011

Under Common Configurations -> Simple configuration -> Configure devices in VE0, the example shows

[host-node]# echo 1 > /proc/sys/net/ipv4/conf/eth0/forwarding
[host-node]# echo 1 > /proc/sys/net/ipv4/conf/eth0/proxy_arp

being run on the host node, VE0. I don't think this can be correct, because eth0 exists in VE 101, not VE0. —The preceding unsigned comment was added by Andrex (talkcontribs) 01:11, 15 July 2006.

This is correct, because we need to enable forwarding on both network interfaces in VE0 (host-node eth0 and veth101.0) to allow the network packets on one network interface (host-node eth0) to be forwarded to another network interface (veth101.0). The same thing with proxy ARP, we need to enable it on host-node eth0 and veth101.0 network interfaces. --Major 08:42, 17 July 2006 (EDT)

Multiple persistent Veth interfaces[edit]

The script for making a persistent bridge get added to a particular host-bridge on startup VPS/VE, doesn't seem to account for having multiple bridges. I have a bridge to a private lan for administrative functions and a bridge to the public network for inbound connections for services. How might one ensure that the vethVEID.x's are hooked up to the bridges on the host every time the VE is started? --Btrotter 05:34, 17 March 2008 (EDT)

Please take a look at Using private IPs for Hardware Nodes and http://sysadmin-ivanov.blogspot.com/2008/02/2-veth-with-2-bridges-on-openvz-at.html. There you will find scripts which will help you to manage 2 bridges, and you can simply extend this script to use more then 2 bridges. --Major 15:59, 27 March 2008 (MSK)

Making a bridged veth-device persistent[edit]

Is this also obsolete, like the section I just deleted? Mrjcleaver 13:35, 31 May 2008 (EDT)

Please leave this in for now! I just needed it today for setup on a Debian HN.
Also I noted that a crucial word/reference at the end of the following sentence is missing: "4. Of course, the CT's operating system will need to have ." Could someone with wiki-knowledge please restore this (if it was ever known)? Laboa 22:50, 12. Oct 2008 (CEST)

Configure devices in CT0[edit]

These devices under /proc didn't exist for me, but I left them in case they are still needed, even with the new vzctl. Mrjcleaver 13:59, 31 May 2008 (EDT)

These files did not exist because you executed a copy/paste, which is incorrect. You should replace 'veth101.0' with veth###.# where ###.# is your relevant VEID (for scripts this should do: 'veth${VEID}.0') according to your VE IDs, and for each VE ID you use veth. -- —The preceding unsigned comment was added by 79.107.116.50 (talkcontribs) 21:29, 25 November 2009.

Creating veth without OpenVZ[edit]

How to create veth devices pair without of OpenVZ? I want something like

modprobe veth
ifconfig veth0 192.168.0.1
ifconfig veth1 192.168.0.2

Answer: Enable CONFIG_VETH in your kernel, load the veth module and create a new pair with the 'ip' command from the iproute2 package.

modprobe veth
ip link add name veth0 type veth peer name veth1
ifconfig veth0 192.168.0.1
ifconfig veth1 192.168.0.2

You may also want to check out this presentation on namespaces in Linux.

Using iproute toolset or net-tools toolset[edit]

Hello,

I propose to substitute all usage of

  ifconfig <device> 0

with

  ip link set <device> up


Since iproute seems to be a requirement, I think its a good idea to drop support for ifconfig.