8

I installed Redhat 6 x86_64. I am using the Network connection screen to set a static IP address like below (I want two PC's in my house to see each other: one Redhat PC and one Mac)

192.168.0.5  
255.255.255.0  
192.168.0.1  

When I run ifconfig it displays only lo and virbr0 information. I don't know what these items are (I don't really know much about network settings).

When I try ifconfig -a it displays eth0, lo, sit0 and virbr0. The information for eth0 is as follows:

Link encap : Ethernet HWaddr 90:2B:34:74:05:30
BROADCAST MULTICAST MTU:1500 Metric:1
RX packets:192 errors:0 dropped:0 overruns:0 frame:0
TX packets:6 errors:0 dropped:0 overruns:0 frame:0
collisions:0 txqueuelen:1000
RX bytes 53811 (52.5 KiB) TX bytes:468 (468.0 b)
Interrupt:29 Base address:0xc000

Could someone help me to point out if anything wrong with my setting or how to resolve this problem?

13

You can provide static IP by editing the file /etc/sysconfig/network-scripts/ifcfg-eth0 as root user in Redhat.

It should look like this:

DEVICE=eth0
BOOTPROTO=STATIC
IPADDR=192.168.0.5
NETMASK=255.255.255.0
GATEWAY=192.168.0.1
ONBOOT=yes

After saving this file. You need to restart the network daemon using following command.

$ sudo /etc/init.d/network stop
$ sudo /etc/init.d/network start

This should provide IP address to eth0 interface also. And ifconfig command should list eth0 also.

  • thanks for your quick answer. i did the same thing before but cannot solve. i ran ifconfig eth0 192.168.0.5 netmask 255.255.255.0. and it solved my problem. i don't know what's wrong. With this setting, when i restarted by using /etc/init.d/network stop/start, then ifconfig --> again it hide the [eth0] – Phu Nguyen Oct 21 '12 at 13:43
  • Can you try booting the computer once. After that ifconfig command should show everytime eth0. You can try using sudo ifup eth0 if you don't want to reboot. – pradeepchhetri Oct 21 '12 at 14:00
  • restart help solving my problem. thank you very much – Phu Nguyen Oct 21 '12 at 14:02
  • 1
    You probably want to make sure that the network service starts on boot, so you'll want to run /sbin/chkconfig network on as root. – jsbillings Apr 23 '13 at 23:34
  • According to RHEL 6 documentation, there is no such value as BOOTPROTO=STATIC. access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/… – ChaimKut Jan 7 '15 at 15:19
1

After you configure the ip address run the following commands

service NetworkManager stop
chkconfig NetworkManager off

It will retain the provided ip even after booting.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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