Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

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?enter image description here

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

share|improve this question
2  
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
add comment

3 Answers

up vote 13 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.

share|improve this answer
add comment

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.

share|improve this answer
add comment

If you don't have a DHCP server in your network, you must set a static IP address. Please consider the following example:

vim /etc/sysconfig/network-scripts/ifcfg-eth0

BOOTPROTO=none
DEVICE=eth0
IPADDR=192.168.1.10 # your IP address
NETMASK=255.255.255.0 # your netmask
NETWORK=192.168.1.0 
ONBOOT=yes

Add GATEWAY to your /etc/sysconfig/network file:

NETWORKING=yes
NETWORKING_IPV6=yes
HOSTNAME=hostname.domainname
GATEWAY=192.168.1.1 # your gateway

Issue the following command to start network on boot:

chkconfig network on

Restart your network service:

service network restart

Take a look at your network interfaces

ifconfig
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.