LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (https://www.linuxquestions.org/questions/linux-networking-3/)
-   -   Cannot change ifconfig eth0 address on RHEL 5.0. (https://www.linuxquestions.org/questions/linux-networking-3/cannot-change-ifconfig-eth0-address-on-rhel-5-0-a-662837/)

sombre1 08-14-2008 03:40 PM

Cannot change ifconfig eth0 address on RHEL 5.0.
 
All,

ifconfig shows the wrong ip address for the eth0 adapter. The /etc/sysconfig/network-scripts/ifcfg-eth0, /etc/sysconfig/networking/profiles/ifcfg-eth0 and /etc/sysconfig/networking/default/ifcfg-eth0 files all show the correct ip address, 10.1.1.111, subnet, 255.255.255.0. route will show the correct route information. ifconfig will show an address of 10.1.1.117 and that is the address we can connect to. Threre are two network adapters and it is only the eth0 that is incorrect.

Nothing appears to be DHCP and there is apparently no DHCP server in this environment. There are some ifcfg-eth0.bak files that show DHCP.

If we do a system-config-network we see the .111 address and it is set to static. We can change it there and it will be reflected in all the other files, but not ifconfig. I have tried changing it to a completely different class A address and changing it back with no luck.

I have also set the ip address by enter the following.

ifconfig eth0 down
ifconfig eth0 10.1.1.111 up

if config will show the correct address until we reboot. Then it reverts back to the 10.1.1.117 address.

There has to be some file that I am missing.

Your assistance will be greatly appreciated.

Thanks,

sombre1

MensaWater 08-14-2008 04:26 PM

Check the mac (hardware) address stored in the ifcfg-eth0 file to be sure it actually goes to what you think is eth0. Also make sure the same mac address doesn't appear in any of the other ifcfg-ethX files. I once had a co-worker copy ifcfg-eth1 to ifcfg-eth0 then edit while blithely ignoring the fact both now referred to the same physical device.

Also don't keep copies of ifcfg-ethX files in /etc/sysconfig/network-scripts - only keep the current versions there. The network startup will look at all those files. I typically keep my copies in /root.

marozsas 08-14-2008 06:42 PM

RHEL (and Fedora) has two different systems to network control and both can't be running together, so the configuration in one system overlaps the configuration on the other.
They are /etc/init.d/network and /etc/init.d/NetworkManager, check yours:

Code:

[root@oldbit ~]# chkconfig | grep -i network
NetworkManager        0:off        1:off        2:off        3:on        4:off        5:on        6:off
network                0:off        1:off        2:off        3:off        4:off        5:off        6:off
[root@oldbit ~]#


KinnowGrower 08-14-2008 09:37 PM

hi marozsas

Network & NetworkManager cant be running together?

On my system they are running together. Can you cast a more light on this topic please

Thanks

r3sistance 08-15-2008 12:43 AM

As you are using RHEL, one option would be to try using Setup. That should ensure the proper IP configuration is enforced as you are using RHEL 5.0. The command is just setup.

marozsas 08-15-2008 07:52 AM

Quote:

Originally Posted by varindersingh (Post 3248081)
hi marozsas

Network & NetworkManager cant be running together?

On my system they are running together. Can you cast a more light on this topic please

Thanks

Hi !

Yes, they are incompatible, or they overlap each other.
The /etc/init.d/network is so called the "legacy" or "tradicional" network setup using ifup. It is a kind of static setup.

Network-Manager is more flexible. You can have several profiles for the same device. For instance, at work you may have eth0 setup by dhcp with a proxy. At home you may have eth0 configured with a static address and no proxy. You, as regular user, can switch profiles with a mouse click.
In the other hand, a machine with NetworkManager has network only after networkmanager is running in your graphical environment, not before ! You need to login on your computer to get it running.
This means it is not tailored for servers running in runlevel 3.

I had a lot of trouble setting up network on my fedora 9 until I realize I can't use both at the same time ;)

This is my personal experience with fedora 9. May be others distros setup things differently.

KinnowGrower 08-15-2008 06:45 PM

Quote:

Network-Manager is more flexible. You can have several profiles for the same device. For instance, at work you may have eth0 setup by dhcp with a proxy. At home you may have eth0 configured with a static address and no proxy. You, as regular user, can switch profiles with a mouse click.
Thanks for explaining Network manager. Then how I can use this? I have to install it, or it is there by default ?
I have fedora core 9
Thanks again

marozsas 08-16-2008 03:58 PM

Hi

In F9 the current package is NetworkManager-0.7.0-0.9.4.svn3675.fc9.i386. A simple "yum install NetworkManager" will install it, if it is not installed.
Stop the tradicional network (service network stop) and start NetworkManager (service NetworkManager start).
Almost immediately you will see a new icon on Gnome top bar.
If your computer is plugged on a wired connection, it will change the icon to show it is getting a IP from DHCP.
Clicking on it with the left mouse you will get a summary of the available connections. Mine has "Wired Networks", "GSM Network" and VPN connections. After you have a couple of connections configured, it just a matter of clicking on one of them to activate.
Clicking with the right mouse button you get several controls, "Enable Network", "Connection Information", and "Edit connections". The last opens a window with the several types of connections it support.
On the "wired" I have 2 connections as I told you, one using DHCP for use at work and another one to use at home with fixed address.
I think is more easy to try and explore than explain :)

If you like it, disable the tradicional network way with "chkconfig network off" and enable NetworkManager with "chkconfig NetworkManager on".

The only thing I dislike on NetworkManager is you need to login first to activated it. I mean, you can't just turn on the computer and expect to have network access.

cheers,

r3sistance 08-16-2008 07:30 PM

From what I am to understand of Network manager, it's best with Wifi, if you stick to a single static connection then normal Network service would be better as you aren't switching between networks and thus don't need all the dynamic network detection and switching that Network manager is built for. From my understanding, anyways I myself mainly use CentOS on a web server so network manager would be completely unsuitable for me =P. I have my home machine dual boot but I keep that on a wired connection so no need again...

marozsas 08-16-2008 07:54 PM

Yes, good point. NetworkManager is only good for laptop and alike. For a desktop, a server, and any other device that always connect to just one network, the traditional way with "network" is far better than NetworkManager.

KinnowGrower 08-16-2008 09:07 PM

Hi

Its excellent.I got it.Thank you very much for your efforts.


All times are GMT -5. The time now is 09:54 PM.