Networking Forums

Networking Forums > Computer Networking > Linux Networking > Simple Route Question

Reply
Thread Tools Display Modes

Simple Route Question

 
 
Hal Vaughan
Guest
Posts: n/a

 
      07-27-2007, 11:53 PM
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.

I used:

route add -host 192.168.1.1 eth0

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

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?

Thanks!

Hal
 
Reply With Quote
 
 
 
 
Mike
Guest
Posts: n/a

 
      07-28-2007, 12:53 AM
On Jul 27, 4:53 pm, Hal Vaughan <h...@thresholddigital.com> 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.
>
> I used:
>
> route add -host 192.168.1.1 eth0
>
> 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
>
> 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?
>
> Thanks!
>
> Hal


I don't quite understand what you're trying to do?

Are you trying to add a default gateway?

route add default gw 192.168.1.1 (optionally you COULD add: route
add default gw 192.168.1.1 dev eth0 )


 
Reply With Quote
 
Floyd L. Davidson
Guest
Posts: n/a

 
      07-28-2007, 01:09 AM
Hal Vaughan <(E-Mail Removed)> 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) (E-Mail Removed)
 
Reply With Quote
 
Hal Vaughan
Guest
Posts: n/a

 
      07-28-2007, 07:52 AM
Floyd L. Davidson wrote:

> Hal Vaughan <(E-Mail Removed)> 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.)


Yes, it is. I didn't want to go into that level of detail, but I guess
that's what most people are working with on something like this.

>>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.


I see. So what's on the Linux box is right, it's the router with the
problem.

> 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.


Yes. I originally had a new WRT54GS and that was worse. I didn't know the
default IP address and used the setup disk on my one Windows system and it
hosed the networking settings. I had to change all the settings back to
get the computer to work on my network again.

> 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).


The WAN can access the HTTP server, but not until it's configured to do
that. I was able to change over to do it eventually, but I've flashed the
firmware now and I'm having a similar problem again, but I'm getting help
in configuring the firewall on the OpenWRT site.

> 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


I ended up just having to pull plugs on my Ethernet switch and taking the
only system with a cable long enough to connect to another router, which
was my Windows system.

....
>>What am I doing wrong?

>
> You're doing nothing wrong... you just need to continue
> with a few more of the right things!


Thanks for the help! Once I understood the issue and that it was on the
router's end, I pulled the cable out and hooked up my Windows system, as I
said. It solved that problem and was a big help!

Hal

 
Reply With Quote
 
 
 
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Simple question about lpd Ty Roberts Linux Networking 2 07-11-2008 03:00 PM
Simple Question Marco Roberto Gonçalves Junior Wireless Networks 0 07-10-2006 07:10 PM
NLB Question (simple) Sean Deegan Windows Networking 1 01-25-2005 10:21 PM
simple question Ricky Windows Networking 1 06-10-2004 10:34 PM
Route Question Dan Bent Linux Networking 4 01-30-2004 10:30 PM



1 2 3 4 5 6 7 8 9 10 11