Linux - GeneralThis Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I just installed Slackware 8.0. I selected DHCP for my netconfig option dealy. It works, i can use lynx to browse around. Is there a way though that i can figure out what IP i've managed to pull down and use?
If you are using dhcpcd then a file called /etc/dhcpc/dhcpcd-eth?.info should be created with all the information that was received from the dhcp server. The question mark will be replaced with the number of the interface which is receiving it's ip address with dhcp.
I usually use the following command in my scripts to get my ip:
export `grep IPADDR /etc/dhcpc/dhcpcd-eth?.info`
The ip will then be stored in the variable IPADDR.
Ofcourse that will only work if you have one interface that receives it's ip through dhcp. But you can always replace the ? with the appropriate number.
I am tried that in my .profile running ksh and it doesn't seem to
work. I put that entry in the .profile and then ran it -
it spit out all the shell variables and has that line in the
output.
grep IPADDR /etc/dhcpc/dhcpcd-eth?.info
On the command line it works fine.
What am I doing wrong or not doing.
Thanks.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.