Difference between revisions of "Setup an eth0 interface for OpenVZ container"
(2 intermediate revisions by the same user not shown) | |||
Line 2: | Line 2: | ||
vzctl set 101 --netif_add eth0 --save | vzctl set 101 --netif_add eth0 --save | ||
where '''101''' is a container ID. | where '''101''' is a container ID. | ||
+ | |||
+ | How to remove eth0: | ||
+ | vzctl set 101 --netif_del eth0 --save | ||
+ | |||
+ | |||
+ | == Centos: == | ||
+ | |||
Login to the container and create an eth0 config file | Login to the container and create an eth0 config file | ||
Line 13: | Line 20: | ||
− | Where '''X.X.X.X''' is | + | Where '''X.X.X.X''' is desired IP address. |
service network restart | service network restart | ||
Line 19: | Line 26: | ||
No need to reboot the VPS. | No need to reboot the VPS. | ||
− | + | ||
− | + | == Debian: == | |
+ | |||
+ | |||
+ | Login to the container and create/edit interfaces config file | ||
+ | |||
+ | nano /etc/network/interfaces.head | ||
+ | |||
+ | Add the following lines and save: | ||
+ | auto eth0 | ||
+ | iface eth0 inet static | ||
+ | address X.X.X.X | ||
+ | netmask 255.255.255.255 | ||
+ | |||
+ | Where '''X.X.X.X''' is desired IP address. | ||
+ | |||
+ | Restart network interfaces | ||
+ | |||
+ | /etc/init.d/networking restart | ||
[[Category:Admin area]] | [[Category:Admin area]] |
Latest revision as of 17:39, 22 January 2015
From the node:
vzctl set 101 --netif_add eth0 --save
where 101 is a container ID.
How to remove eth0:
vzctl set 101 --netif_del eth0 --save
Centos:
Login to the container and create an eth0 config file
nano /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0 BOOTPROTO=static ONBOOT=yes IPADDR=X.X.X.X NETMASK=255.255.255.255
Where X.X.X.X is desired IP address.
service network restart
No need to reboot the VPS.
Debian:
Login to the container and create/edit interfaces config file
nano /etc/network/interfaces.head
Add the following lines and save:
auto eth0 iface eth0 inet static address X.X.X.X netmask 255.255.255.255
Where X.X.X.X is desired IP address.
Restart network interfaces
/etc/init.d/networking restart