Setting current IP address in configuration file

Posted on 2003-02-24
Medium Priority
Last Modified: 2010-03-18

As a relative newbie to Linux I need some advice.

My computer gets a dynamically IP address when starting up (from my provider, using DHCP). Now I need to specify this IP address in a configuration file used by one of my server daemons.

The line in question in my config file reads:
client_ip = ""

Is there an easy way to change this line so it contains my dynamically assigned IP? Specifying a DNS name is not possible, I really need to use the numerical IP.

Can anybody help me?

Thank You!
Question by:rjud
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions

Accepted Solution

majorwoo earned 200 total points
ID: 8013073
just set
EXTIF="eth0" or "ppp0" or whatever your external interface is

client_ip="`/sbin/ifconfig $EXTIF | grep 'inet addr' | awk '{print $2}' | sed -e 's/.*://'`"

should do it for you

Author Comment

ID: 8017501
This works great (and it looks pretty cool too).

Thanks a lot!

Featured Post

Create the perfect environment for any meeting

You might have a modern environment with all sorts of high-tech equipment, but what makes it worthwhile is how you seamlessly bring together the presentation with audio, video and lighting. The ATEN Control System provides integrated control and system automation.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I have seen several blogs and forum entries elsewhere state that because NTFS volumes do not support linux ownership or permissions, they cannot be used for anonymous ftp upload through the vsftpd program.   IT can be done and here's how to get i…
Note: for this to work properly you need to use a Cross-Over network cable. 1. Connect both servers S1 and S2 on the second network slots respectively. Note that you can use the 1st slots but usually these would be occupied by the Service Provide…
If you're a developer or IT admin, you’re probably tasked with managing multiple websites, servers, applications, and levels of security on a daily basis. While this can be extremely time consuming, it can also be frustrating when systems aren't wor…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question