LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Ifconfig (https://www.linuxquestions.org/questions/linux-newbie-8/ifconfig-889335/)

linux in malawi 07-01-2011 03:03 AM

Ifconfig
 
Hie
when i type 'ifconfig eth0 192.168.25.1 255.255.255.0' the outcome is 'SIOCSIFADDR : invalid argument', but when i check the ip address using /sbin/ifconfig i see the ip address is updated to 192.168.25.1 and is up. When i restart the linux box,the /sbin/ifconfig is reset to 192.168.100.1 .what should i do so that the linux box /sbin/ifconfig should not change when am rebooting.
Thank you for your helping answer in advance.

Wim Sturkenboom 07-01-2011 03:36 AM

Code:

cd /etc
grep -r 192.168.100.1 *

I'm also not that familiar with networking so this is what I would use to find the file that contains the ip address that is used at boot. Replace the IP address that is defined in those files by the new one.

csravi88 07-01-2011 04:04 AM

which distro you are using? i was using "setup" command in centos. then select networking option.

michaelk 07-01-2011 04:08 AM

The correct syntax would be:
ifconfig eth0 192.168.25.1 netmask 255.255.255.0

You do not mention which distribution but both Fedora,Redhat and Ubuntu have networking configuration utilities that will configure network adapters and save the static IP address settings.

16pide 07-01-2011 04:26 AM

this is set in this text file: /etc/sysconfig/network-scripts/ifcfg-eth0 if you use good old networking.
if you use NetworkManager, then it's a different story

linux in malawi 07-01-2011 06:11 AM

For knowledge and future use i want to know how /etc/sysconfig/network-scripts/ifcfg-eth0 should be like.

linux in malawi 07-01-2011 06:33 AM

Am using redhat 9

paparts 07-01-2011 07:06 AM

ifconfig eth0 192.168.25.1 netmask 255.255.255.0

Noway2 07-01-2011 07:32 AM

Are you really using "Red Hat 9"? Quoting from wikipedia: Red Hat Linux 9, the final release, hit its official end-of-life on 2004-04-30 If you really are using a re revision this old, you are both setting yourself up for serious security issues and focusing on learning deprecated techniques. If you want the "red hat" experience without paying for RHEL, go with either Fedora or CentOS.

Here is a link to the CentOS documentation, chapter 14 provides information on configuring the network. BTW, CentOS is the free version Red Hat and may be a little bit behind, but should achieve your goals.

michaelk 07-01-2011 07:32 AM

FYI Redhat 9 is extremely obsolete and Fedora 13 is no longer being supported. ifcfg-eth0 is a network configuration file for Redhat base distributions. Here is an example:
Quote:

# File: ifcfg-eth0
DEVICE=eth0
IPADDR=192.168.25.1
NETMASK=255.255.255.0
BOOTPROTO=static
ONBOOT=yes
#
# The following settings are optional
#
BROADCAST=192.168.2.255
NETWORK=192.168.2.0
system-config-network is a RH9 GUI tool for configuring your network adapter.

linux in malawi 07-03-2011 11:53 PM

I changed this values in /etc/sysconfig/network-scripts/ifcfg-eth0 file 'BOOTPROTO=static' from 'BOOTPROTO=dhcp' and i added my ip address and netmask.
IPADDR=192.168.25.1
NETMASK=255.255.255.0


All times are GMT -5. The time now is 08:16 PM.