Paul L. Snyder on 7 Jan 2013 13:12:51 -0800


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: [PLUG] Raising the dead: proc filesystem


On Mon, 07 Jan 2013, Sam Gleske wrote:

> On Mon, Jan 7, 2013 at 1:04 PM, David Coulson <david@davidcoulson.net>
> wrote:
> 
> > # ip ro get 8.8.8.8
> > 8.8.8.8 via 10.250.52.1 dev bond0  src 10.250.52.164
> >     cache  mtu 1500 advmss 1460 hoplimit 64
> >
> 
> I've not used ip ro get.  I'll have to read the man page to learn more
> though I tested it on my system already and generally see how it works.
> Pretty cool.

 $ ip -o ro get $(ip ro | grep default | cut -d' ' -f3) | cut -d' ' -f6
 10.188.36.22

This gets the IP address that will be used to communicate with the default
gateway.  To get the name of the interface that IP is bound to, change the
-f6 to -f3.

Paul
___________________________________________________________________________
Philadelphia Linux Users Group         --        http://www.phillylinux.org
Announcements - http://lists.phillylinux.org/mailman/listinfo/plug-announce
General Discussion  --   http://lists.phillylinux.org/mailman/listinfo/plug