Difference between revisions of "Virtual network device"
(→Example) |
(Fixed headings (do *not* ever use single =), added module loading info) |
||
Line 3: | Line 3: | ||
Venet device is created automatically on [[VE]] start. Vzctl scripts set up an appropriate IP address and other settings on venet inside a VE. | Venet device is created automatically on [[VE]] start. Vzctl scripts set up an appropriate IP address and other settings on venet inside a VE. | ||
− | = | + | == Usage == |
− | == Adding IP address to a VE == | + | == Kernel module == |
+ | First of all, check that <code>venetdev</code> module is loaded: | ||
+ | <pre> | ||
+ | # lsmod | grep vznetdev | ||
+ | </pre> | ||
+ | |||
+ | If it is not, load the module: | ||
+ | <pre> | ||
+ | # modprobe vznetdev | ||
+ | </pre> | ||
+ | |||
+ | You might want to check /etc/init.d/vz script to make sure the module gets loaded during startup. | ||
+ | |||
+ | === Adding IP address to a VE === | ||
<pre> | <pre> | ||
vzctl set <VEID> --ipadd <IP1>[,<IP2>,...] [--save] | vzctl set <VEID> --ipadd <IP1>[,<IP2>,...] [--save] | ||
Line 12: | Line 25: | ||
{{Note|This option is incremental, so IP addresses are added to already existing ones.}} | {{Note|This option is incremental, so IP addresses are added to already existing ones.}} | ||
− | === Example === | + | ==== Example ==== |
<pre> | <pre> | ||
vzctl set 101 --ipadd 10.0.0.1 --save | vzctl set 101 --ipadd 10.0.0.1 --save | ||
Line 18: | Line 31: | ||
After executing this command IP address 10.0.0.1 will be added to VE 101 and IP configuration will be saved to a VE configuration file. | After executing this command IP address 10.0.0.1 will be added to VE 101 and IP configuration will be saved to a VE configuration file. | ||
− | == Removing IP address from a VE == | + | === Removing IP address from a VE === |
<pre> | <pre> | ||
vzctl set <VEID> --ipdel <IP1>[,<IP2>,...] [--save] | vzctl set <VEID> --ipdel <IP1>[,<IP2>,...] [--save] | ||
Line 24: | Line 37: | ||
</pre> | </pre> | ||
− | === Example === | + | ==== Example ==== |
<pre> | <pre> | ||
vzctl set 101 --ipdel 10.0.0.1 | vzctl set 101 --ipdel 10.0.0.1 |
Revision as of 09:46, 6 July 2006
Vitual network device (venet
) is the default network device for a VE. This network device looks like a peer-to-peer connection between VE and the host system. It does packet switching based on IP header. This is a default network device for VE (an alternative is veth device).
Venet device is created automatically on VE start. Vzctl scripts set up an appropriate IP address and other settings on venet inside a VE.
Contents
Usage
Kernel module
First of all, check that venetdev
module is loaded:
# lsmod | grep vznetdev
If it is not, load the module:
# modprobe vznetdev
You might want to check /etc/init.d/vz script to make sure the module gets loaded during startup.
Adding IP address to a VE
vzctl set <VEID> --ipadd <IP1>[,<IP2>,...] [--save]
Note: This option is incremental, so IP addresses are added to already existing ones. |
Example
vzctl set 101 --ipadd 10.0.0.1 --save
After executing this command IP address 10.0.0.1 will be added to VE 101 and IP configuration will be saved to a VE configuration file.
Removing IP address from a VE
vzctl set <VEID> --ipdel <IP1>[,<IP2>,...] [--save] vzctl set <VEID> --ipdel all [--save]
Example
vzctl set 101 --ipdel 10.0.0.1
After executing this command IP address 10.0.0.1 will be removed from VE 101, but IP configuration will not be changed in VE config file. And after VE reboot IP address 10.0.0.1 will be assigned to this VE again.