OpenVZ Container cannot access internet

openvzvirtualization

I have Daedicated Server, and I want to split it on two virtual servers with two diffrent IP Adresses. I bought two exetrnal IP adresses for this server and now I have three, one Main Address, one for firts VPS and one for second VPS.

I have installed Debian 7 x64 on server and OpenVZ, set booting to OpenVZ kernel and created a container with Debian 8.0 and added only external external IP (Main Address is 8x.xxx.132.7x, I have added 8x.xxx.249.20x to container). I ran container and connected to SSH with 8x.xxx.249.20x. This works perfect.

But, when I try to execute ping google.rs in container, I get error: ping: unknown host google.rs

How to allow internet connection from container?

P.S. I'm trying to fix it from tonight (3 hours). Nothing from internet doesn't help.

Output from container when execute ifconfig:

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          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:179 errors:0 dropped:0 overruns:0 frame:0
          TX packets:158 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:19000 (18.5 KiB)  TX bytes:17609 (17.1 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:89.163.249.207  P-t-P:89.163.249.207  Bcast:89.163.249.207  Mask:255.255.255.255
          UP BROADCAST POINTOPOINT RUNNING NOARP  MTU:1500  Metric:1

Route Table:

route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
89.163.132.1    0.0.0.0         255.255.255.255 UH    0      0        0 eth0
89.163.249.221  0.0.0.0         255.255.255.255 UH    0      0        0 venet0
89.163.249.207  0.0.0.0         255.255.255.255 UH    0      0        0 venet0
89.163.132.0    0.0.0.0         255.255.255.0   U     0      0        0 eth0
0.0.0.0         89.163.132.1    0.0.0.0         UG    0      0        0 eth0

Best Answer

Problem, according to the comments:

  • DNS name resolution wasn't working correctly.

Solution:

  • Replaced /etc/resolv.conf with the one from the machine hosting the container.
Related Topic