[prev in list] [next in list] [prev in thread] [next in thread]
List: busybox
Subject: Re: can I pick anyone's brains?
From: "David Collier" <from_busybox_maillist () dexdyne ! com>
Date: 2011-01-27 8:56:00
Message-ID: memo.20110127085631.5476T () postmaster+dexdyne ! com ! cix ! co ! uk
[Download RAW message or body]
In article <1296059075.24329.64.camel@monolith.infinux.org>,
christopher.barry@rackwareinc.com (Christopher Barry) wrote:
> *From:* Christopher Barry <christopher.barry@rackwareinc.com>
> *To:* BusyBox <busybox@busybox.net>
> *Date:* Wed, 26 Jan 2011 11:24:35 -0500
>
> On Wed, 2011-01-26 at 17:15 +0100, Harald Becker wrote:
> > Hallo David!
> >
> > Here we are again ... :-)
> > > If I have an IP address... 10.12.15.7 or something, is there a
> > simple
> > > command I can issue from a script which will examine all the
> > routing
> > > tables for me and return
> > >
> > > "eth0" "local"
> > > or
> > > "eth1" "gateway"
> > > or
> > > "tun0" "gateway"
> > >
> > > or something similar?
> > Can you please tell a bit more, what you want to achieve? The
> > routing is
> > normally done by the kernel, so not required to be done in user
> > space
> > programs or shell scripts.
> >
> > There is one command, that allows to dump the routing table, that
> > is the
> > command "route". With an awk script it would be possible to
> > filter the
> > table output and select an appropriate routing entry. That way an
> > awk
> > script could be used to build a command with your requirements
> > ... else
> > I don't know any standard command for your purpose.
> >
> > --
> > Harald
>
> I like 'ip r'. parse it however you like.
>
> outputs like below:
> # ip r
> 172.16.1.0/28 dev wlan0 proto kernel scope link src 172.16.1.2
> metric 2
> 192.168.68.0/24 dev vmnet8 proto kernel scope link src
> 192.168.68.1 192.168.112.0/24 dev eth1 proto kernel scope link
> src 192.168.112.10 192.168.111.0/24 dev eth0 proto kernel scope
> link src 192.168.111.10 192.168.122.0/24 dev virbr0 proto kernel
> scope link src
> 192.168.122.1
> 169.254.0.0/16 dev wlan0 scope link metric 1000
> default via 172.16.1.1 dev wlan0 proto static
Sorry Chris
I couldn't see the wood for the trees there at first - you are quite
right - in the form ip get <address> it does exactly what I need.
TVM
David
_______________________________________________
busybox mailing list
busybox@busybox.net
http://lists.busybox.net/mailman/listinfo/busybox
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic