Could any one tell me how to assign IP to a linux box.

Hi All,

Could any one please help me how to assign IP to a linux box permanently.

IP should not be changed even after Rebooting the machine.:b::b::b:

Depends on the flavour of Linux you are using:
RedHat/CentOS: modify the file /etc/sysconfig/network-scripts/ifcfg-eth0
Debian: modify the file /etc/network/interfaces

1 Like

That worked up to RedHat 6.0. The next version of RedHat that I used is 6.4. On 6.4 it is now /etc/sysconfig/network-scripts/ifcfg-em1. I do not know which release between 6.0 and 6.4 started this.

After you make the change to your network file you can do:

service network restart

to set the new IP address without an immediate reboot. Or just reboot if you want.

RHEL 6.3 which we have is still using ifcfg-ent0

Robin

FWIW, In RHEL 6.5 here, it is still ifconfig /etc/sysconfig/network-scripts/ifcfg-eth[0-9] , so maybe some installs have different names of the network devices ( ifconfig | awk '{print $1}' RS= ) depending on the types of NIC's installed..

1 Like

According to the documentation, Appendix A "Consistend Network Device Naming" eth[0123...] are replaced by em[0123...] with RedHat Linux Enterprise 6.x.
Maybe the updates are responsible for the different naming schemes: "Upgrades from Red Hat Enterprise Linux 6.0 to Red Hat Enterprise Linux 6.1 are unaffected, and the old eth[0123�] naming convention will continue to be used."

1 Like

It also says this:

https://access.redhat.com/site/documentation/en-US/Red\_Hat\_Enterprise\_Linux/6/html/Deployment\_Guide/appe-Consistent\_Network\_Device_Naming.html

1 Like

I had to sign in as a ReHat customer to see that page. All it was is a link to here.

We are migrating to an all Dell environment. The only systems I have installed 6.4 on are PowerEdge servers and Optiplex workstations.

work for me

  1. service NetworkManager stop
  2. chkconfig NetworkManager off
  3. service network start
  4. chkconfig network on
  5. edit
    vi /etc/sysconfig/network-scripts/ifcfg-??? put here your interface

DEVICE=??your interface
BOOTPROTO=static
IPADDR=x.x.x.x
NETMASK=255.255.255.0
GETEWAY=x.x.x.x
ONBOOT=yes

and save

  1. i also added dns in /etc/resolv.conf
    nameserver x.x.x.x
    nameserver x.x.x.x

  2. service network restart