lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20220725110742.34650b91@hermes.local>
Date:   Mon, 25 Jul 2022 11:07:42 -0700
From:   Stephen Hemminger <stephen@...workplumber.org>
To:     "Kai Hendry" <hendry@....fi>
Cc:     netdev@...r.kernel.org
Subject: Re: Find IP address of active interface

On Mon, 25 Jul 2022 08:48:15 +0800
"Kai Hendry" <hendry@....fi> wrote:

> Is there an easier way than:
> 
> ip route get 8.8.8.8 2>/dev/null|grep -Eo 'src [0-9.]+'|grep -Eo '[0-9.]+'
> 
> To figure out the active, Internet routing interface?
> 
> Thank you,

Alternate:

$ ip -j route get 8.8.8.8 | \
  python3 -c 'import json,sys;obj=json.load(sys.stdin);print(obj[0]["dev"]);'
enp2s0

But both options won't do what you want if there is ECMP routes.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ