您的位置:首页 > 运维架构 > Linux

Why the default eth0 interface is down by default on CentOS?

2013-04-02 17:46 411 查看
I am already a little bit familiar with Linux distros like Debian or Ubuntu (yeah, very similar) but I wanted to try Red Hat based - CentOS 6.2 . I have installed it on my Windows 7 host in virtualBox and tried to
play with it a little.

I have same across a small problem, namely : the default
eth0
interface is down by default. I use the option with NAT ( the virtual machine is 'behind' the host ). Even if I bring the interface up with

ifconfig eth0 up
it does not work right away. I get this after bringing the interface up:

What should be done more to configure the network on CentOS machine?


P.S. Sorry for screenshot but I do not know how to get the text out of the VirtualBox.

linux

networking
centos
shareimprove
this question
edited
Apr 17 '12 at 19:43



pbm

5,5901728

asked
Apr 17 '12 at 18:51



Patryk

693310

1
There is no
eth1
on your screenshot... Btw, try to run DHCP on your interface:
dhclient eth0
. – pbm
Apr
17 '12 at 18:58
@pbm 1) I changed
eth1
to
eth0
in the description. 2)
dhclient eth0
worked :) thanks. How can I make it default - run like this after reboot ? – Patryk
Apr
17 '12 at 19:18
I'm not sure, but check out this blog post:

blog.malaya-digital.org/… – pbm
Apr
17 '12 at 19:49
1
If you find exact solution post it as answer... – pbm
Apr
17 '12 at 19:50

2 Answers

activeoldestvotes

up vote
8
down vote
accepted
Edit
/etc/sysconfig/network-scripts/ifcfg-eth0
. Change the
ONBOOT
line's value to
yes
.

In your future installs, pay more attention. You blew past an option in the network configuration section that let you tell it to bring the interface up on boot. This on-boot option is off by default in EL6 now,
whereas in previous versions, it was on by default.

As to why this is, I'd guess security reasons. It gives you a chance to tighten things down a bit from the default setup before bringing up the network interface for the first time.

shareimprove
this answer
edited
Dec 23 '12 at 2:52

answered
Apr 17 '12 at 20:58



Warren Young

17.4k24264

up vote
2
down vote
You didn't mention what version of CentOS you are using. If I'm not mistaken, 6.x uses NetworkManager by default.

I rarely install X windows on my servers, so NetworkManager is just a pain for me. I disable it and enable the standard 'network' service.

chkconfig NetworkManager off

chkconfig network on

service NetworkManager stop

service network start

To enable DHCP on the interface, run
system-config-network
, edit the appropriate device, save, and restart the network service. Alternately, you can edit
/etc/sysconfig/network-scripts/ifcfg-eth0
and add

ONBOOT=yes


BOOTPROTO=dhcp


Save changes and restart the network service.

From:http://unix.stackexchange.com/questions/36705/why-the-default-eth0-interface-is-down-by-default-on-centos
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐