• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 5033
  • Last Modified:

CentOS 6.2: only loopback adapter appears in ifconfig

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
nathanwc
Asked:
nathanwc
  • 3
  • 2
  • 2
  • +2
1 Solution
 
arnoldCommented:
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
 
d_nedelchevCommented:
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
 
joolsCommented:
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
What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

 
d_nedelchevCommented:
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
 
arnoldCommented:
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
 
d_nedelchevCommented:
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
 
Michael WorshamInfrastructure / Solutions ArchitectCommented:
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
 
joolsCommented:
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
 
nathanwcAuthor Commented:
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

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

  • 3
  • 2
  • 2
  • +2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now