Re: Simple Route Question
- From: floyd@xxxxxxxxxx (Floyd L. Davidson)
- Date: Fri, 27 Jul 2007 17:09:35 -0800
Hal Vaughan <hal@xxxxxxxxxxxxxxxxxxxx> wrote:
I've worked on Linux and done some work with networking, but that's been
just basic setup stuff. For now, I have a net on 172.16.xxx.xxx and I will
need to be able to connect to a Linksys router I'm working with for a while
that I'll be putting OpenWRT on. While doing this, I need to address the
router in its default 192.168.1.1 address from my workstation.
Okay, I'm assuming this is a Linksys WRT54G wireless
router, probably a Version 2??? (The following
discussion applies to any WRT54G.)
I used:
route add -host 192.168.1.1 eth0
Okay, that looks good!
then typed "route" and got this:
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use
Iface
192.168.1.1 * 255.255.255.255 UH 0 0 0 eth0
172.16.7.0 * 255.255.255.0 U 0 0 0 eth0
link-local * 255.255.0.0 U 1000 0 0 eth0
default loc.fw.lan 0.0.0.0 UG 0 0 0 eth0
Yep, you now have a route from this host *to* the
router, via eth0.
But alas, the router's route table does not provide a
way to get back, via the LAN ports, to a host with an
address in the 172.16.x.x range.
This is a (somewhat obnoxious) result of the router
being designed (and the documentation written) to work
with home users of Windows. I.e., it defaults to what
will work on the simplest Windows system, and they don't
tell you what that is.
The router defaults to 192.168.1.1, *and* has its DHCP
server enabled... with a route table that knows about
the IP addresses which the DHCP server can assign, and
nothing else. There is no default to the LAN ports
(there might be to the WAN port, I don't remember... but
it would be worthless too because it cannot access the
HTTP server).
So, there are two possible tricks you can use to access
the router. One is to use DHCP to get an Ethernet
interface configured to match the router. You can do
that with a laptop, using the only Ethernet port or
using a spare on a desktop that has two or more, or
whatever.
dhcpcd -d eth0
Will configure eth0 via DHCP. You just want to be sure
that the *only* DHCP server on that LAN segment is that
particular router
The other way is to give a static IP address in the right
range to an Ethernet interface. This can work on a
LAN segment that does have a DHCP server on it.
And (with either static route or with a DHCP server) you
don't actually need a spare unused interface!
ifconfig eth0:1 192.168.1.100
will add the IP address 192.168.1.100 to eth0,
regardless of what has already been assigned to it (as
long as it wasn't to eth0:1). To disable it after you
are done,
ifconfig eth0:1 192.168.1.100 down
Just be advised that I don't remember exactly what the
range of IP addresses that are being routed actually
are! I'm sure that it is in the 192.168.1.x subnet, and
it seems like it is a range of 100 addresses, but it
might be 50. That makes the above 192.168.1.100 a good
guess at a place to start, but it is only a guess.
When I try to reach the router by the web interface, there's no response and
lynx is "Unable to connect to remote host." I've tried adding "dev"
before "eth0" when I set up the route, but it doesn't work.
I've been looking for a routing tutorial, but all the ones I find use
iproute or iproute2 and the man page for route gives examples for adding
nets, but no specific examples of adding hosts, so while I'm using what the
few references I can find seem to say to do, I figure I've got to be doing
something wrong and I can't find a good resource on the net to tell me what
I need to change.
What am I doing wrong?
You're doing nothing wrong... you just need to continue
with a few more of the right things!
--
Floyd L. Davidson <http://www.apaflo.com/floyd_davidson>
Ukpeagvik (Barrow, Alaska) floyd@xxxxxxxxxx
.
- Follow-Ups:
- Re: Simple Route Question
- From: Hal Vaughan
- Re: Simple Route Question
- References:
- Simple Route Question
- From: Hal Vaughan
- Simple Route Question
- Prev by Date: Re: Simple Route Question
- Next by Date: Re: ip tables vpn pptp and ip gre47
- Previous by thread: Re: Simple Route Question
- Next by thread: Re: Simple Route Question
- Index(es):
Relevant Pages
|