Solved

CentOS 6.2: only loopback adapter appears in ifconfig

Posted on 2013-06-11
9
4,029 Views
Last Modified: 2013-06-12
Hi Experts,

I'm managing a dozen or so CentOS 6.2 VMs on Hyper-V (2008 R2) for our start-up. I'm not a Linux expert (I'm a Windows expert) but this is my bag nonetheless.

1. These VMs were on one host and networking was fine.

2. When the VMs were moved to another host, we ran into the MAC address / 70-persistent-net.rules problem. This was corrected by configuring each VM to use static MAC addresses in Hyper-V then edited 70-persistent-net.rules with the new, static MAC addresses.

3. The VMs were moved again, yet networking was dropped again despite 70-persistent-net.rules having the correct MAC address.

ifconfig looks like this:

ifconfig looks like this
I can get things working until I reboot if I:

disable lo
then

then bring up eth0
0
Comment
Question by:nathanwc
  • 3
  • 2
  • 2
  • +2
9 Comments
 
LVL 77

Expert Comment

by:arnold
ID: 39241072
ifconfig -a
lspci to see which network device you have. You may have an incompatible network interface for which centos does not have a kernel module/driver for it
modprobe -l

use system-config-network-tui

do you have /etc/sysconfig/network-scripts/ifcfg-eth0?
Are you using NetworkManager to manage your connections?
0
 
LVL 5

Accepted Solution

by:
d_nedelchev earned 500 total points
ID: 39241108
It looks like you are missing a sysconfig file (/etc/sysconfig/network).

Try re-creating it:


sudo echo NETWORKING=yes > /etc/sysconfig/network
sudo echo HOSTNAME=hostname.domain.com >> /etc/sysconfig/network


All case sensitive!

Then reboot and see if it works.
0
 
LVL 19

Expert Comment

by:jools
ID: 39241172
The file not found message is for ifcfg-eth and it should have a number, you can remove the entry from the persistent rules and reboot or edit the rules file and the ifcfg-eth0 file to make sure they reference the correct interface.
0
Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

 
LVL 5

Expert Comment

by:d_nedelchev
ID: 39241281
I beg to differ. As you can see from the screenshots the prompt is saying:

[root@localhost ~]#

and not

[root@hostname ~]#

Which means that the machine has no hostname assigned. The hostname is contained in /etc/sysconfig/network.
And since the file is missing and the machine has no hostname the network obviously cannot be brought up.

I'll just note that I've tried this on a VM before I posted the suggestion.

Regards.
0
 
LVL 77

Expert Comment

by:arnold
ID: 39241315
one can have the system named as localhost.localdomain or localhost and still bring up an external IP.
one (hostname) is not a requirement for the other (network access).
i.e. DHCP configured clients administered by NetworkManager do not have a hostname but do get an external IP when the network interface in the system is detected and loaded.
0
 
LVL 5

Expert Comment

by:d_nedelchev
ID: 39241635
I stand corrected! Yet I think that the problem is that missing file. By default it has just two lines

NETWORKING=yes
HOSTNAME=hostname.domain.com

Open in new window

Since you are absolutely right about the hostname, then I thought the problem must lie in the other option, or it's absence (NETWORKING=yes). Which by the way should be pretty obvious, right?

But yet, I've just made some tests on my VM again, and this time I've tried all possible scenarios:

With both lines.
With either of the two lines.
Even with an empty file.

and the system kept bringing up the interface every time, until I deleted the file. With the file absent, only the loopback adapter was up.


Once I "touch"-ed the file and rebooted, the system brought up the interface again.

So I must insist on my earlier suggestion for recreating the /etc/sysconfig/network.
0
 
LVL 29

Expert Comment

by:Michael Worsham
ID: 39241735
Check to make sure that the file ifcfg-eth0 also has the following line:

ONBOOT=yes

That will make sure that the ethernet device actually is given an IP address and starts on boot up.

Example ifcfg-eth0 configuration:

DEVICE=eth0
BOOTPROTO=static
DHCPCLASS=
HWADDR=00:0C:29:39:BB:B8
IPADDR=192.168.0.45
NETMASK=255.255.255.0
ONBOOT=yes
0
 
LVL 19

Expert Comment

by:jools
ID: 39242991
Actually I read it slightly wrong (serves me right for trying to look at the picture on my phone) I have to agree with d_nedelchev in #39241635.

It's the
NETWORKING=yes

Open in new window


That counts, without it the networking scripts wont run. Funny the file is missing though, normally you would just need to remove the entry from the persistent rules file and it works.
0
 
LVL 1

Author Closing Comment

by:nathanwc
ID: 39243260
Top notch - nailed it! Thank you!

And thank you to everyone else for your contributions. I'm sorry to have not checked in sooner.
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I have seen several blogs and forum entries elsewhere state that because NTFS volumes do not support linux ownership or permissions, they cannot be used for anonymous ftp upload through the vsftpd program.   IT can be done and here's how to get i…
Note: for this to work properly you need to use a Cross-Over network cable. 1. Connect both servers S1 and S2 on the second network slots respectively. Note that you can use the 1st slots but usually these would be occupied by the Service Provide…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

838 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question