can I pick anyone's brains?
from_busybox_maillist at dexdyne.com
Wed Jan 26 17:07:00 UTC 2011
I want to make my box present different details on a web-site, depending
on whether the user is on either of my 'local' networks or not.
I have eth0 onto our office LAN, and eth1 as a debug port. Of course
other people may do it differently. In the field someone might just plug
in a laptop to eth0 or eth1.
from time to time PPP and vpn routings may appear - the remote access is
usually over the vpn, but it could be different.
If they are local, then the hotlink on the page to ftp into my box is
If they are on another continent then a hotlink to ftp:10.212.1.5 isn't a
useful thing to offer them....
I know the IP address through which the pages are being served. So, as
people have said, I can decode and parse out the route table, and do
matches against it, in the same way the kernel does. But it's a
kernel has all the code up and running.
If I could say "resolve 10.198.7.9" and get back "eth0 local" then could
know what options to offer the punter.
In article <4D4048AB.2000105 at gmx.de>, ralda at gmx.de (Harald Becker) wrote:
> *From:* Harald Becker <ralda at gmx.de>
> *To:* from_busybox_maillist at dexdyne.com
> *CC:* busybox at busybox.net
> *Date:* Wed, 26 Jan 2011 17:15:39 +0100
> 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
> 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
> table output and select an appropriate routing entry. That way an
> script could be used to build a command with your requirements ...
> I don't know any standard command for your purpose.
More information about the busybox