netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* A robust correct way to display local ip addresses of the device Gautieji x
@ 2020-03-30 16:49 Vaidas BoQsc
  2020-03-31 13:08 ` Matthias May
  0 siblings, 1 reply; 2+ messages in thread
From: Vaidas BoQsc @ 2020-03-30 16:49 UTC (permalink / raw)
  To: netdev

Are there any ways to output only the local ipv4 (inet) addresses of
the device using ip command?

I tired this way and both UNKNOWN, Down are not filtered away. Is my
usage of syntax incorrect?

 ip --brief address show up
lo               UNKNOWN        127.0.0.1/8 ::1/128
enp7s0           DOWN
wlp8s0           UP             192.168.0.103/24 fe80::22c:79e4:a646:a7b/64

  Even so, if enp7s0 and lo were filtered, I would still want an
output of simply 192.168.0.103 from ip command which can't be provided
without piping into other tools?

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: A robust correct way to display local ip addresses of the device Gautieji x
  2020-03-30 16:49 A robust correct way to display local ip addresses of the device Gautieji x Vaidas BoQsc
@ 2020-03-31 13:08 ` Matthias May
  0 siblings, 0 replies; 2+ messages in thread
From: Matthias May @ 2020-03-31 13:08 UTC (permalink / raw)
  To: Vaidas BoQsc, netdev

On 30/03/2020 18:49, Vaidas BoQsc wrote:
> Are there any ways to output only the local ipv4 (inet) addresses of
> the device using ip command?
> 
> I tired this way and both UNKNOWN, Down are not filtered away. Is my
> usage of syntax incorrect?
> 
>  ip --brief address show up
> lo               UNKNOWN        127.0.0.1/8 ::1/128
> enp7s0           DOWN
> wlp8s0           UP             192.168.0.103/24 fe80::22c:79e4:a646:a7b/64
> 
>   Even so, if enp7s0 and lo were filtered, I would still want an
> output of simply 192.168.0.103 from ip command which can't be provided
> without piping into other tools?
> 

Hi

Is enp7s0 actually down, or does it just not plugged in?

Example:
ip -br l show wlan0
wlan0            DOWN           b6:91:7e:4e:94:01
<NO-CARRIER,BROADCAST,MULTICAST,UP>

wlan0 is UP, but has NO-CARRIER, resulting in a state of DOWN.


To filter out ipv6 results, simply only request ipv4:

ip -4 -br a show up

BR
Matthias

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-03-31 13:15 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-30 16:49 A robust correct way to display local ip addresses of the device Gautieji x Vaidas BoQsc
2020-03-31 13:08 ` Matthias May

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).