ECS Home Automation and Security Archives
  learn more | view messages for this month | NetBloc® | terms of use | search

Google
 


  subject (prev) or (next) | time (prev) or (next) | author (prev) or (next) | view more subjects

Subject:
From:
Date:
Re: [ecs] linux question re ifconfig
Ingo Pakleppa
Mon, 28 Feb 2005 11:38:13 -0800

It's actually several files. You are right; this is one of them. Another 
one is /etc/sysconfig/networking/devices/ifcfg-ethx. It may just say 
"BOOTPROTO=dhcp" which indicates that the IP address gets assigned 
dynamically by DHCP. This is actually the most common situation. In that 
case, you can try and look at /var/lib/dhcp/dhclient-eth0.leases; this 
is a cached version of what the dhcp actually keeps in memory.

My strong recommendation is not to touch any of these files directly, 
since quite a few things need to remain in sync. Always use the tools 
provided by RedHat to modify them.

Even for just retrieving the IP address, your best bet is to capture the 
output of ifconfig. In bash, you could do something like this:

/sbin/ifconfig | grep -C2 eth0 | grep "inet addr" | sed 
"s/.*\([0-9]*\.[0-9]*\.[0-9]*\.[0-9]*\).*/\1/"

I haven't tried this regular expression yet, so it may need some tweaking.

Joseph LaFerla wrote:
> Mark
> 
> I think the directory is (in Redhat) /etc/sysconfig/network-scripts.  The
> fle is called ifcfg-ethx where x is the number of the device, i.e. eth0,
> eth1 etc.
> 
> There is also a file in /etc/sysconfig called network which has your gateway
> information and the device that routes through the gateway.
> 
> Joe
> 
> 
> -----Original Message-----
> From: Mark Gilmore [mailto:mark1@markgilmore.net] 
> Sent: February 28, 2005 7:55 AM
> To: ecs@netbloc.com
> Subject: [ecs] linux question re ifconfig
> 
> anyone happen to know what file(s) are updated when you re-assign eth0 to a 
> diff IP ?:
>          ifconfig eth0 192.168.0.3
> thanks
> 
> Mark Gilmore
> http://OmnipotenceSoftware.com 
> 
> 


  subject (prev) or (next) | time (prev) or (next) | author (prev) or (next) | view more subjects




Services provided by [NetBloc]®! NetBloc Solutions Inc.
Terms of use. Indexing software (c) 1999 Lin-De, Inc
.