16

I am trying to perform a fresh CentOS 6.3 installation then run various yum commands such as yum install httpd.

The installation runs fine, however I cannot run any network based commands like yum

I am aware the default installation has networking disabled. I have amended the /etc/sysconfig/network-scripts/ifcfg-eth0 file in accordance with this guide, but keep receiving the error

Could not retrieve mirrorlist http://mirrorlist.centos.org?release=6arch=i1386&repo=os error was

14: PYCURL ERROR 6 - "Couldn't resolve host 'mirrorlist.centos.org'"

Error: Cannot find a valid baseurl for repo: base

I have since amended the /etc/resolv.conf file to include Google's nameserver 8.8.8.8 but this hasn't changed anything.

I have amended /etc/sysconfig/network changing the hostname from localhost.localdomain to local.igoo.net (a made up but fully qualified domain?).

I did have it working yesterday then tried to install WHM/cPanel which went fine. I then decided I didn't need WHM/cPanel so fresh insatlled CentOS and now cannot recreate the steps I took to get networking working. When I run /etc/init.d/network restart the error message:

Bringing up interface eth0:

Determining IP information for eth0... failed; no link present. Check cable?

(The cable is not unplugged)

I'm not sure what to try next! Can anyone suggest what I've missed out?

5
  • 2
    Try manually configuring the interface and then do a ping. Assuming your network is 10.0.0.0: ifconfig eth0 10.0.0.100 up then ping 10.0.0.something
    – Tim
    Commented Jul 25, 2012 at 13:17
  • 1
    Show your /etc/sysconfig/network and ifcfg-eth0 file contents. Also, are you sure you want DHCP? CentOS boxes are usually servers, and so usually need static addresses. The "Determining IP information..." bit in your question indicates it's trying DHCP. Commented Jul 25, 2012 at 15:09
  • 1
    By the way, you do know you could have enabled networking during your second install? Networking is indeed disabled by default in EL6, but it is possible to completely configure it during installation, including setting it to start on boot. Commented Jul 25, 2012 at 15:11
  • 1
    @Warren Young Thanks I shall look into it, would certainly be handy.
    – Larry B
    Commented Jul 26, 2012 at 15:24
  • @RodgersandHammertime could you show us the following? contents of ifcfg-eth0 and resolv.conf, also an ifconfig -a could be helpful. Thanks.
    – tripledes
    Commented Aug 5, 2012 at 11:33

10 Answers 10

13

I had the same error messages after installing CentOS 6.3 Minimal guest using VirtualBox on my Windows XP host (laptop). I was unable to do yum updates, both via the micro USB cable and wirelessly using my Huawei Mobile Mifi

However, I got both networking and updates to work with a minor change only to /etc/sysconfig/network-scripts/ifcfg-eth0 and /etc/init.d/network restart

DEVICE="eth0"
BOOTPROTO="dhcp"
HWADDR="My hardware address"
NM_CONTROLLED="yes"
ONBOOT="yes"
TYPE="Ethernet"

Interesting observation:

NM_CONTROLLED="yes"

From what I was reading, the preferred setting for servers is no. However, yes works well for laptops wirelessly.

7

The NM_Controlled option would be Network Manager controlled and that would mean that you would control interfaces through network manager vs the ifup, ifdown methods.

The option to include Bridged vs Nat in the virtalbox option will assign a separate ip address to your vm in the same ip network as your physical machine, while the nat option would translate the ip of your vm in your virtual network (inside the virtualbox) into the ip address of your physical machines. It's the same approach as NAT in a home lan connecting to the internet through one router.

DNS resolution is important to be setup if your connection is not using DHCP for the configuration of the network interface. If using DHCP then that is taken care of (or it should be) by the DHCP Server. In a home lan that would be your internet router, in an enterprise network it would be your designated DHCP server, when setting up a vm inside VirtualBox however you may need to set it up inside VirtualBox.

Don't forget you may need to configure a proxy if you don't have direct access to the internet, if you want yum to work.

I hope that helps, I am having other problems setting up CentOS myself after a minimal install on a physical server in an enterprise environment.

5

The very first time you create a VM in Parallels it uses eth0. If, however, you template or clone it, then the ethernet interface it is allocated changes (to eth1, eth2...). If you are using virtualisation this may be the issue.

# ifconfig -a

...should show you what interface is there but not enabled.

If it is, indeed, eth0, then the advice from others here (like Anthony and Warren) is good.

If your disabled interface is eth1 (or eth2...) then you need to duplicate a profile in /etc/sysconfig/network-scripts/ and edit its DEVICE and HWADDR settings to match the actual interface and MAC address of your VM.

More details on my blog if this is actually the case. Good luck!

3

I had the same problem with installing CentOS 6.3 using VirtualBox running on Linux Mint 13. I changed the network settings on VirtualBox from "NAT" to "Bridged Adapter" and this solved the problem.

3

I had the same problem on CentOS 6 on VirtualBox with 1 network adapter enabled. After default install it had only local loopback adapter 127.0.0.1 Though I could start bridged networking manually by entering command

dhclient -v eth1

it didn't start networking automatically on boot. The solution for me was to tweak network configuration as follow:

$ cd /etc/sysconfig/network-scripts; 
$ cp ifcfg-eth0 ifcfg-eth1
$ vi ifcfg-eth1

and modify the following lines:

DEVICE="eth1"                 # set device name to ether
ONBOOT="yes"
HWADDR="08:00:27:20:9D:71"    # must match to VirtualBox "MAC address" value

rest of the lines in ifcfg-eth1 remain as in original ifcfg-eth0 file:

BOOTPROTO="dhcp" 
NM_CONTROLLED="yes"
TYPE="Ethernet" 
UUID="7830e5b9-785b-4650-b1ce-caf9f9c257f5"

Now save ifcfg-eth1 and restart network service

$ /etc/init.d/network restart

Check $ ifconfig

eth1      Link encap:Ethernet  HWaddr 08:00:27:20:9D:71  
      inet addr:192.168.0.20  Bcast:192.168.0.255  Mask:255.255.255.0
      inet6 addr: fe80::a00:27ff:fe20:9d71/64 Scope:Link
      UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
      RX packets:958 errors:0 dropped:0 overruns:0 frame:0
      TX packets:452 errors:0 dropped:0 overruns:0 carrier:0
      collisions:0 txqueuelen:1000 
      RX bytes:106251 (103.7 KiB)  TX bytes:74948 (73.1 KiB)
      Interrupt:10 Base address:0xd020 

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:16436  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)
2

It's most likely because the MAC address has changed on your network card.

If you cloned / duplicated a virtual machine and it created a new mac address try setting it the same as the original machine. Copy and paste the old MAC address in network settings > advanced and restart the VM.

(I just had the same error on a CentOS 6.3 VM I cloned with Virtual Box).

1
  • 1
    Probably changing the network settings on the VM to bridged would have been sufficient. Common setting on VirtualBox anyway. Ensure you check the answers given especially for older posts, and improve them if you can. Welcome to U&L.
    – vgoff
    Commented Nov 18, 2012 at 6:03
0

Check your /etc/resolv.conf file. YUM will check only the first nameserver, if it is the local DNS resolver then it will give you the error "Couldn't resolve host... "

Put this in your resolv.conf nameservers as shown below:

nameserver 8.8.8.8
nameserver 8.8.4.4

(These are Google's public DNS servers.)

1
  • 1
    No -1, but I'm tempted to, whenever someone suggests these without a HUGE disclaimer. Methinks Google collects already enough data about people, DNS is just another piece in the puzzle. Commented Feb 15, 2013 at 19:46
0

Got here by googling 'how to start network on centos 6.3'?

Start with the guide referenced in the question. In summary, CentOS does not turn the networking layer on by default, but it is easily configured.

Still have problems? If CentOS is running in a VM on Hyper-V 2012, the network interface may have changed name. Problem and fix identified here.

0

If you are under a domain and you got your own DHCP, DNS, AD just give that IP in the first list of the nameserver:

nameserver xx.xx.xx.xx

Save it and then execute:

service network restart
ifup eth0

This will work.

0

This is similar to Daniel's answer but, I used the following command:

service network restart
ifup e\*

This automatically boots up the named adapter (enp0s3 in my case, since ifup eth0 didn't work)

Edit: updated with escaped string

1
  • Note that you should probably escape the asterisk (ifup e\*). Without escaping it, your shell may glob files in the current working directory that begin with e, if any are present. Your command would be executed as something like ifup employee1.txt employee2.txt ...
    – drs
    Commented Oct 14, 2014 at 21:02

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .