can I pick anyone's brains?
from_busybox_maillist at dexdyne.com
Wed Jan 26 17:07:00 UTC 2011
As it happens I already have loads of bash script to extract the
addresses, masks and gateways from the output of ifconfig, route and
resolv.conf - I have to put things back tidily at the end of a gprs
session, and on dhcp fail, for instance.
what I don't have is the code to say "is this address in that addr/mask
It's not a huge task. I'd just rather use anything ready-built that is
In article <1296059075.24329.64.camel at monolith.infinux.org>,
christopher.barry at rackwareinc.com (Christopher Barry) wrote:
> *From:* Christopher Barry <christopher.barry at rackwareinc.com>
> *To:* BusyBox <busybox at 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
> 169.254.0.0/16 dev wlan0 scope link metric 1000
> default via 172.16.1.1 dev wlan0 proto static
> busybox mailing list
> busybox at busybox.net
More information about the busybox