OpenVZ Forum


Home » General » Support » Add an private IP address into a CT
Add an private IP address into a CT [message #52423] Tue, 07 June 2016 12:27 Go to next message
ekx27 is currently offline  ekx27
Messages: 2
Registered: June 2016
Junior Member
Hi,

I recently bought a OpenVZ Container from a hosting company and I would like to add a private IP address.

Here is the default config I had :

Quote:

#ifconfig
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
UP LOOPBACK RUNNING MTU:65536 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)

venet0 Link encap:UNSPEC HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
inet addr:127.0.0.2 P-t-P:127.0.0.2 Bcast:0.0.0.0 Mask:255.255.255.255
UP BROADCAST POINTOPOINT RUNNING NOARP MTU:1500 Metric:1
RX packets:34 errors:0 dropped:0 overruns:0 frame:0
TX packets:35 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:4401 (4.2 KiB) TX bytes:5688 (5.5 KiB)

venet0:0 Link encap:UNSPEC HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
inet addr:xxx.xxx.xxx.xxx P-t-P:xxx.xxx.xxx.xxx Bcast:xxx.xxx.xxx.xxx Mask:255.255.255.255
UP BROADCAST POINTOPOINT RUNNING NOARP MTU:1500 Metric:1


This works, I can ping everything :

Quote:

#ping 8.8.8.8
PING 8.8.8.8 (8.8.8.Cool 56(84) bytes of data.
64 bytes from 8.8.8.8: icmp_req=1 ttl=50 time=5.74 ms
64 bytes from 8.8.8.8: icmp_req=2 ttl=50 time=5.78 ms


If I add into the /etc/network/interface.tail the following :

Quote:

auto venet0:1
iface venet0:1 inet static
address 172.16.70.1
netmask 255.255.255.255


ifconfig result :

Quote:
~# ifconfig
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
UP LOOPBACK RUNNING MTU:65536 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)

venet0 Link encap:UNSPEC HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
inet addr:127.0.0.2 P-t-P:127.0.0.2 Bcast:0.0.0.0 Mask:255.255.255.255
UP BROADCAST POINTOPOINT RUNNING NOARP MTU:1500 Metric:1
RX packets:23 errors:0 dropped:0 overruns:0 frame:0
TX packets:24 errors:0 dropped:20 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:3352 (3.2 KiB) TX bytes:5067 (4.9 KiB)

venet0:0 Link encap:UNSPEC HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
inet addr:xxx.xxx.xxx.xxx P-t-P:xxx.xxx.xxx.xxx Bcast:xxx.xxx.xxx.xxx Mask:255.255.255.255
UP BROADCAST POINTOPOINT RUNNING NOARP MTU:1500 Metric:1

venet0:1 Link encap:UNSPEC HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
inet addr:172.16.70.1 P-t-P:172.16.70.1 Bcast:172.16.70.1 Mask:255.255.255.255
UP BROADCAST POINTOPOINT RUNNING NOARP MTU:1500 Metric:1


Then, nothing ping into the Internet...

Here is the routing table :

Quote:

#route
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
default * 0.0.0.0 U 0 0 0 venet0


Am I doing something wrong?
Re: Add an private IP address into a CT [message #52462 is a reply to message #52423] Tue, 12 July 2016 17:01 Go to previous messageGo to next message
dowdle is currently offline  dowdle
Messages: 261
Registered: December 2005
Location: Bozeman, Montana
Senior Member
OpenVZ Legacy provides two types of network interfaces, venet (the default) and veth. For info on how they differ see:

https://openvz.org/Differences_between_venet_and_veth

Unless you have a need for layer 2 (MAC) services and paid more for it, it is likely you have a venet device... and such devices are controlled and managed by the system administrator of the host node. Even if you got it configured correctly in your container's configuration, it would be reset upon container restart. That's just how venet devices work. It is also possible, if you manually alter the container network config enough to confuse the IP address injection code in vzctl, you could completely break your networking... so manually editing your network configuration is not recommended.

The proper solution to your issue requires you contacting the support services for your hosting provider and telling them what you want... and them assisting you.


--
TYL, Scott Dowdle
Belgrade, Montana, USA
Re: Add an private IP address into a CT [message #52467 is a reply to message #52462] Tue, 12 July 2016 21:19 Go to previous message
ekx27 is currently offline  ekx27
Messages: 2
Registered: June 2016
Junior Member
Thank you for your reply and the explanation, I will see what I can do with the system admin Smile
Previous Topic: Ubuntu 16.04 kernel versions
Next Topic: I need to refresh ARP frequently.
Goto Forum:
  


Current Time: Mon Nov 18 02:54:55 GMT 2024

Total time taken to generate the page: 0.02905 seconds