LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Configuring IP to network card (https://www.linuxquestions.org/questions/linux-newbie-8/configuring-ip-to-network-card-175931/)

Rig24 04-29-2004 09:29 AM

Configuring IP to network card
 
I am trying to assign a static IP address to a network card using the following command:
ifconfig eth0 10.4.12.21

After the command it works fine untill the system is rebooted and then I neet to issue the command again. How do you make the IP address stick?

Demonbane 04-29-2004 09:33 AM

Most distros should have scripts configured to bring up network interfaces on start up.

Mathieu 04-29-2004 10:49 AM

Which distribution are you using ?

If your distro. has the sysconfig directory, you can edit the /etc/sysconfig/network/ifcfg-eth0 file.

On RedHat / Mandrake, it would look like this:
Code:

DEVICE=eth0
BOOTPROTO=none
IPADDR=10.4.12.21
NETMASK=255.0.0.0
BROADCAST=10.4.12.255
NETWORK=10.4.12.0
onBOOT=yes

On SuSE, like this:
Code:

BOOTPROTO='static'
BROADCAST='10.4.12.255'
IPADDR='10.4.12.21'
NETMASK='255.0.0.0'
NETWORK='10.4.12.0'
STARTMODE='onboot'

Check your distribution's documentation to get more info.

Rig24 04-29-2004 11:02 AM

I am running RedHat 7.3. I found the ifcfg-eth0 in the /etc/sysconfig/network-scripts/ directory. This is what is in it:

DEVICE='eth1'
ONBOOT='no'
BOOTPROTO='none'
TYPE='Ethernet'
USERCTR='no'
NETWORK=10.4.0.0
BROADCAST=10.4.0.255

Should I change the NETWORK and BROADCAST lines and nothing else?


All times are GMT -5. The time now is 03:08 AM.