[Solved] dhcpcd info file

Non release banter
Post Reply
User avatar
banshee22
White ninja
White ninja
Posts: 18
Joined: 08 Sep 2011, 08:46
Location: France

[Solved] dhcpcd info file

Post#1 by banshee22 » 06 Jan 2012, 14:21

Hi all,

Is there a way to read dhcpcd result in a file? Something like dhcpcd-<interface>.info where we can read IP, GATEWAY and other informations returned by dhcp server? I found a dhcpcd.eth0.lease file but I'm unable to read it.

Thanks,

Banshee
Last edited by banshee22 on 12 Jan 2012, 09:26, edited 1 time in total.

beny
Full of knowledge
Full of knowledge
Posts: 723
Joined: 02 Jan 2011, 11:33
Location: italy

Re: dhcpcd info file

Post#2 by beny » 06 Jan 2012, 17:28

ifconfig and route:
bash-4.1# dhcpcd --help
usage: dhcpcd [-dgknpqwxyADEGHJKLOTV] [-c script] [-f file] [-e var=val]
[-h hostname] [-i classID ] [-l leasetime] [-m metric] [-o option]
[-r ipaddr] [-s ipaddr] [-t timeout] [-u userclass]
[-F none|ptr|both] [-I clientID] [-C hookscript] [-Q option]
[-X ipaddr] <interface>
all command into the console ,have fun

User avatar
Hamza
Warlord
Warlord
Posts: 1847
Joined: 28 Dec 2010, 07:41
Distribution: Porteus
Location: France

Re: dhcpcd info file

Post#3 by Hamza » 06 Jan 2012, 18:52

Code: Select all

ifconfig eth0 | grep 'inet addr:' | cut -d: -f2 | awk '{ print $1}'
Enjoy!
NjVFQzY2Rg==

User avatar
brokenman
Site Admin
Site Admin
Posts: 5455
Joined: 27 Dec 2010, 03:50
Distribution: Porteus v3.2rcX all desktops
Location: Brazil
Contact:

Re: dhcpcd info file

Post#4 by brokenman » 08 Jan 2012, 21:30

Is there a way to read dhcpcd result in a file? Something like dhcpcd-<interface>.info
What information are you looking for exactly?

cat /etc/dhcpcd.conf
How do i become super user?
Wear your underpants on the outside and put on a cape.

User avatar
banshee22
White ninja
White ninja
Posts: 18
Joined: 08 Sep 2011, 08:46
Location: France

Re: dhcpcd info file

Post#5 by banshee22 » 09 Jan 2012, 09:12

I'm looking for allocated IP address (Hamza gave me a way to find it through ifconfig and awk command), but I can't find gateway address ?

anybody knows if there is a way to read dhcpcd-<interface>.lease file?

beny
Full of knowledge
Full of knowledge
Posts: 723
Joined: 02 Jan 2011, 11:33
Location: italy

Re: dhcpcd info file

Post#6 by beny » 09 Jan 2012, 10:40

type in console: route -n

User avatar
brokenman
Site Admin
Site Admin
Posts: 5455
Joined: 27 Dec 2010, 03:50
Distribution: Porteus v3.2rcX all desktops
Location: Brazil
Contact:

Re: dhcpcd info file

Post#7 by brokenman » 09 Jan 2012, 12:20

For me this would be:

Code: Select all

route -n|sed -n 3p|awk '{print$2}'
sed gets the third line down. awk gets the second field with 'space' delimiter.
How do i become super user?
Wear your underpants on the outside and put on a cape.

Post Reply