# Could not retrieve mirrorlist http://mirrorlist.centos.org/



## Premiumn (Jun 10, 2015)

Sorry if this is a noob question. Im trying to learn some stuff with OpenVZ.

I installed OpenVZ using this tutorial and created some VM's. The issue im having now is that when i enter a VM (vzctl enter 101) an do something like "yum update", i get the following error.


# yum update
Loaded plugins: fastestmirror
Setting up Update Process
Loading mirror speeds from cached hostfile
Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=6&arch=i386&repo=os&infra=stock error was
12: Timeout on http://mirrorlist.centos.org/?release=6&arch=i386&repo=os&infra=stock: (28, 'connect() timed out!')
Error: Cannot find a valid baseurl for repo: base


When i do a ping in that vm, i get this error:


# ping www.google.com
ping: unknown host www.google.com


In my /etc/resolv.conf, this is the contents:


nameserver 8.8.8.8
nameserver 8.8.8.8


Please note that if i exit out of the VM and run yum update, or any pings on the Master it works fine as expected. The issue lies when i log into any vm's.

I hope someone can guide me in the right direction.

Thank you in advance.


----------



## TheLinuxBug (Jun 10, 2015)

Sounds like you didn't setup IP masquerading on the master node or something of the sort.

https://openvz.org/Common_Networking_HOWTOs

This article contains some information on what settings you need to add on a per container basis if you don't have a control panel setting it up for you.

Hope this helps.

Cheers!


----------



## HalfEatenPie (Jun 10, 2015)

Yep sounds like you didn't setup your IP properly or your network's goofed.  Follow @TheLinuxBug's link and/or check ifconfig. 

Also, this won't fix your problem but your /etc/resolv.conf has the same nameserver entry twice.  either delete one of those lines or change one to 8.8.4.4 (the other Google DNS IP).


----------



## sv01 (Jun 10, 2015)

Next time test ping both IP and domain, to make sure it not DNS problem.


----------



## SpeedBus (Jun 18, 2015)

@Premiumn just curious, is this machine at Dacentec? I'm having the same issue on a test machine of mine today


----------



## Premiumn (Jun 18, 2015)

SpeedBus said:


> @Premiumn just curious, is this machine at Dacentec? I'm having the same issue on a test machine of mine today


Nope. This one is with CC.

I still haven't had time to fix this yet. I will try and look into it tonight and see if i can get this fixed.


----------



## trueman1 (Jul 3, 2015)

your vps will need it's own ip,

you can setup a nat, or a dedicated ip,

for nat, you should follow this guide: https://openvz.org/Using_NAT_for_container_with_private_IPs


----------



## Premiumn (Feb 12, 2016)

Ok guys, i know its been a long while, but i did not have a chance to mess around with this.


Im back to it now on a new server and im still having this problem. I will state again below in brief what steps i took to reproduce this from the beginning:


-Install openvz and kernel, created user 101, assigned it an IP address (using this tutorial: https://lowendbox.com/blog/tutorial-getting-started-with-openvz/)


Now the problem is, when i enter the VM 101 (vzctl enter 101), there seems to be a connection issue because firstly when i try to ping google.com, it says "ping: unknown host google.com" and when i try to run "yum update", i see the following "Loaded plugins: fastestmirror
Setting up Update Process
Determining fastest mirrors
Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=6&arch=x86_64&repo=os&infra=stock error was
14: PYCURL ERROR 6 - "Couldn't resolve host 'mirrorlist.centos.org'"
Error: Cannot find a valid baseurl for repo: base"


It seems like an easy solution, but i just cannot figure it out. 

BTW, i followed the links in the answers above and that did not work either.


Thanks


----------



## GM2015 (Feb 12, 2016)

You can't resolve hosts, that means you have no internet connectivity.


Try pinging 8.8.8.8 or 8.8.4.4. If ping doesn't work, you don't have internet at all on the vm.


Your network config  file in /etc/network/interfaces is most likely the culprit. Or you don't have dedicated IP-s for the container and/or your NAT routing via iptables is wrong/not in place.


----------



## Premiumn (Feb 12, 2016)

GM2015 said:


> You can't resolve hosts, that means you have no internet connectivity.
> 
> 
> Try pinging 8.8.8.8 or 8.8.4.4. If ping doesn't work, you don't have internet at all on the vm.
> ...



Pinging 8.8.8.8 works, but for some reason 100% packet loss



[[email protected] /]# ping 8.8.8.8
PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data.
--- 8.8.8.8 ping statistics ---
31 packets transmitted, 0 received, 100% packet loss, time 30710ms
 


I do have 4 additional dedicated IP's. Gateway and netmask are correct in /etc/sysconfig/network-scripts/ifcfg-eth0


Any suggestions?


----------



## GM2015 (Feb 12, 2016)

Premiumn said:


> Pinging 8.8.8.8 works, but for some reason 100% packet loss
> 
> 
> 
> ...



Is the container on private IP(behind NAT) or you assigned a public ip to it?


All virtualization experience I have is with proxmox and NAT VM-s on. If you're PremiumN on Lowendtalk, drop me a pm on lowendtalk. I can't reply with anything useful here.


----------



## Premiumn (Feb 13, 2016)

I have already assigned a public ip to the VM created.


----------



## Premiumn (Feb 14, 2016)

This can be closed. Mr @linuxthefish solved it https://www.lowendtalk.com/discussion/75638/openvz-network-connectivity-issues-on-the-vm-s


----------



## mpkossen (Feb 14, 2016)

Good one. I need to redo that tutorial.


----------

