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
[Solved] dhcpcd info file
[Solved] dhcpcd info file
Last edited by banshee22 on 12 Jan 2012, 09:26, edited 1 time in total.
Re: dhcpcd info file
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
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
Re: dhcpcd info file
Code: Select all
ifconfig eth0 | grep 'inet addr:' | cut -d: -f2 | awk '{ print $1}'
NjVFQzY2Rg==
- brokenman
- Site Admin
- Posts: 6105
- Joined: 27 Dec 2010, 03:50
- Distribution: Porteus v4 all desktops
- Location: Brazil
Re: dhcpcd info file
What information are you looking for exactly?Is there a way to read dhcpcd result in a file? Something like dhcpcd-<interface>.info
cat /etc/dhcpcd.conf
How do i become super user?
Wear your underpants on the outside and put on a cape.
Wear your underpants on the outside and put on a cape.
Re: dhcpcd info file
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?
anybody knows if there is a way to read dhcpcd-<interface>.lease file?
Re: dhcpcd info file
type in console: route -n
- brokenman
- Site Admin
- Posts: 6105
- Joined: 27 Dec 2010, 03:50
- Distribution: Porteus v4 all desktops
- Location: Brazil
Re: dhcpcd info file
For me this would be:
sed gets the third line down. awk gets the second field with 'space' delimiter.
Code: Select all
route -n|sed -n 3p|awk '{print$2}'
How do i become super user?
Wear your underpants on the outside and put on a cape.
Wear your underpants on the outside and put on a cape.