1834593 Members
4050 Online
110069 Solutions
New Discussion

static ip address

 
Tarek_1
Frequent Advisor

static ip address

Hi,
i have a linux box RH 8.0 that was configured as dhcp client. Now I have been assiged a static ip and i want to configure it, but i'm getting some trouble.
What i did till now is:
- modified /etc/hosts
new ip psycho.idi.it localhost
127.0.0.1 localhost
- modified /etc/sysconfig/network:
NETWORKING=yes
HOSTNAME=psycho.idi.it
DOMAINNAME=idi.it
GATEWAY=ip gateway
The resolv.conf was generated by /sbin/dhclient-script. I modified it with the new settings.
I was looking at /etc/netmasks to configure Subnetmask but it seems not existing. I don't know if linux uses some other file.
Then i issued ifconfig eth0 ipaddress netmask netmaskaddr
and rebooted the ws.
But when it get up it didn't have my new ip but one assigned by dhcp. Also /etc/resolv.conf had been overwritten. I'm looking at some service that disables dhcp but without success.
Can someone help me?
Thanks
4 REPLIES 4
Tony Contratto
Respected Contributor

Re: static ip address

Hi,

I have not used RH 8.0, but the following was valid on RH 7.x.

There is one more file you need to edit. /etc/sysconfig/network-scripts/ifcfg-eth0

Should look something like the following:

DEVICE=eth0
BOOTPROTO=static
IPADDR=192.168.0.2
NETMASK=255.255.255.0
NETWORK=192.168.0.0
BROADCAST=192.168.0.255
ONBOOT=yes


BTW, there is a ifcfg-eth[n] file for each network adapter in the system. So if you have more than one nic you would have a ifcfg-eth0, ifcfg-eth1, etc.

--
Tony
got root?
I_M
Honored Contributor

Re: static ip address

Hi

You need to modify /etc/sysconfig/network-scripts/ifcfg-eth0.

This file is used when system startup the network. My advice is, you should create this file by some application such as linuxconf, redhat-config-network, webmin....
Because, script read the lines in the file. If you put "ONBOOT=yes"
it may work. But if you put "ONBOOT=Yes" or "ONBOOT=y", I don't know.
If you want to know the rule,see /usr/share/doc/initscripts-ver/sysconfig.txt before you start to edit.

Good luck
Jerome Henry
Honored Contributor

Re: static ip address

The easiest way is... run neat (in a console) your use your network deveice configuration tool (under gnome, you'll get it through system tools). It'll do the same as advised to you before, but through a straght forward and graphical interface.
Good luck.
You can lean only on what resists you...
John Meissner
Esteemed Contributor

Re: static ip address

I have to go with gerome -
why edit half a dozen files when you just have to go into a GUI and change a few small things. I know ... i know... GUI you say? yes... i said it. I do a lot of command line work... but i'm lazy and if there's an easier way... i'll take it
All paths lead to destiny