For a long time I've used ipconfig
in Windows, and ifconfig
in Unix to find out my local IPv4, for different purposes.
There are times when your screen is small, or you have an extensive amount of network adapters connected to your computer, making this list really extensive. I know you can pipe it into less
, in order to avoid scrolling, and filter with grep
, but that's rather cumbersome.
I was wondering if there was an easier way to find the basic information your DHCP provides you (gateway, IPv4, and subnet mask), without having to squint your eyes in order to find the numbers you are looking for, and without having to look up a command in your notes or Google.
journalctl | grep -Ei 'probing address'
. I didn't have to squint my eyes, but I did have to make some effort to find this. Please read this, then edit your question. – Seamus Mar 04 '19 at 08:12ifconfig
request. Usually, all your NIC are listed, including those who are not in use right now. In most cases, you're looking for one IPv4 for your host, and one IPv4 for your gateway. I posted a solution myself with a better solution thanifconfig
. – mazunki Mar 04 '19 at 10:02journalctl | grep -Ei "dhcp"
, and many lines showed up, including DHCPACK, DHCPREQUEST, DHCPOFFER. I believe the question itself is very clearly explained, as looking for your own IPv4 and gateway is something we have all done when connecting to a new or dynamic network. – mazunki Mar 04 '19 at 10:06ip route
as here -- changedev
tosrc
in the grep part (or get rid of grep entirely). – Mar 04 '19 at 10:08route
actually provided me with the details I was looking for. The link helped a lot, @mosvy . I did know about the command, but never thought about using it for this purpose. – mazunki Mar 04 '19 at 10:13route actually provided me with the details I was looking for
, yet you've selected another answer as the solution. Your business though... Wrt your Q to me: I usedhcpcd
on my system, so your results may vary. All I did was query the log w/ adhcpcd
grep filter, and found an entry that had both my IP address and subnet in CIDR notation. But again, that didn't meet your requirement: "find the numbers you are looking for, and without having to look up a command". You seem to have what you need now, so I'll butt out. – Seamus Mar 04 '19 at 11:48