
Advanced Tasks
68
Moving Network Adapter to Virtual
Private Server
By default, all the VPSs on a Node are connected among themselves and with the Node by
means of a virtual network adapter called
venet0
. Still, there is a possibility for a VPS to
directly access a physical network adapter (for example,
eth1
). In this case the adapter
becomes inaccessible to the Hardware Node itself. This is done with the help of the
vzctl
command:
# vzctl set 101 --netdev_add eth1 --save
Add network device: eth1
Saved parameters for VPS 101
Mind that the network device added to a VPS in such a way has the following limitations:
This network device will be accessible only to the VPS whereto it has been moved, but not
to the Hardware Node (VPS 0) and not to all the other VPSs on the Node.
If such a device is removed from the VPS (by means of the
vzctl set
--netdev_del
command) and added to another VPS instead, all the network settings of
this device are purged. To work around this problem, you should store all the device settings
in the
ifcfg-
dev
file and have this file available in the
/etc/sysconfig/network-
scripts
directory inside all the VPSs that may have access to this device (including VPS
0). After the device has been added to a VPS, it will be enough to issue the
ifup
dev
command inside the VPS to read the settings from the file mentioned above. Mind though
that this will still not restore advanced network configuration settings, such as packet
filtering rules.
The physical device inside a VPS has no security restrictions typical for the
venet
virtual
device. Inside the VPS it will be possible to assign any IP address to this device and use it,
to sniff network traffic in the promiscuous mode, and so on.