Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

SIOCADDRT: Network is Unreachable?

0 views
Skip to first unread message

Arthur

unread,
Feb 2, 2004, 4:48:41 PM2/2/04
to
Hi all,

I'm a total idiot when it comes to stuff like this, so maybe someone
cal make it clear for me.

I am running Mandrake 9.2 with 2 NIC's in the box. Here is my output
of 'ifconfig':

eth0 Link encap:Ethernet HWaddr 00:01:03:2B:9D:88
inet addr:192.168.1.110 Bcast:192.168.1.255
Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:877227 errors:0 dropped:0 overruns:1 frame:0
TX packets:917228 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:100
RX bytes:104595011 (99.7 Mb) TX bytes:382148618 (364.4 Mb)
Interrupt:10 Base address:0xa400

eth1 Link encap:Ethernet HWaddr 00:50:04:6E:54:1A
inet addr:192.168.0.110 Bcast:192.168.0.255
Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:6682958 errors:0 dropped:0 overruns:0 frame:0
TX packets:6392868 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:100
RX bytes:4220660546 (4025.1 Mb) TX bytes:2403758195 (2292.4
Mb)
Interrupt:11 Base address:0xa800


Now, I issue any of the following ROUTE ADD commands with no errors:

1) route add default gw 192.168.0.1 eth0
2) route add default gw 192.168.0.1 eth1
3) route add default gw 192.168.1.1 eth1

However, if I issue this command:
1) route add default gw 192.168.1.1 eth1
SIOCADDRT: Network is unreachable

Why does it give me an error message? Also, why can I cross routes /
subnets without any problems?? If I issue a route statement that ties
the 0.1 subnet to eth0, why does it work??? eth0 is part of the 1.1
subnet......

Can anyone please explain these things?

Thanks,

Arthur

Cameron Kerr

unread,
Feb 2, 2004, 9:48:01 PM2/2/04
to

You should generally only have one default gateway (the one that leads
out the internet)

2 is clashing terribly with 1 as well. An appropriate route is added for
the attached subnet when the interface is brought up.

You only need to add one the gateway (how you do this at boot will vary
depending on your distribution).

--
Cameron Kerr
camero...@paradise.net.nz : http://nzgeeks.org/cameron/
Empowered by Perl!

Arthur

unread,
Feb 3, 2004, 8:10:40 AM2/3/04
to
Cameron,

I'm not quite sure I understand your post. If I have 2 NIC's in my
Mandrake 9.2 box, then shouldn't I have 2 routes?

It sounds like my assumption is correct, that I should not cross
subnets. If that is the case, then how come I can get away with #1
with no errors?

At any rate, again, if I have 2 NIC's, then should I not have 2
routes?

Arthur


Cameron Kerr <camero...@paradise.net.nz> wrote in message news:<401f...@news.maxnet.co.nz>...

Ben Measures

unread,
Feb 3, 2004, 8:31:18 AM2/3/04
to
Arthur wrote:
> Hi all,
>
> I'm a total idiot when it comes to stuff like this, so maybe someone
> cal make it clear for me.
>
> I am running Mandrake 9.2 with 2 NIC's in the box. Here is my output
> of 'ifconfig':
>
> eth0 inet addr:192.168.1.110 Bcast:192.168.1.255 Mask:255.255.255.0
>
> eth1 inet addr:192.168.0.110 Bcast:192.168.0.255 Mask:255.255.255.0

>
> Now, I issue any of the following ROUTE ADD commands with no errors:
>
> 1) route add default gw 192.168.0.1 eth0
> 2) route add default gw 192.168.0.1 eth1
> 3) route add default gw 192.168.1.1 eth1

There should only be one default (gateway) route. If your computer
wanted to send a packet to eg. 64.38.34.49 then which (default) route
should it use?

Without more information about what you want to do, I'm thinking you're
wanting something like these:

route add -net 192.168.1.0 netmask 255.255.255.255.0 gw 192.168.1.1 eth0
so that all packets to the network 192.168.1.0/255.255.255.0 is sent
from eth0, through the gateway 192.168.1.1

route add -net 192.168.0.0 netmask 255.255.255.255.0 gw 192.168.0.1 eth1
so that all packets to the network 192.168.0.0/255.255.255.0 is sent
from eth1, through the gateway 192.168.0.1

route add default gw 192.168.0.1 eth1

so that the default is to send the packets (ie. all packets to
destinations other than the above rules) from eth1, through the gateway
192.168.0.1.

I recommend you work out what you want to do and have a thorough read of
'man route'.

--
Ben M.

----------------
What are Software Patents for?
To protect the small enterprise from bigger companies.

What do Software Patents do?
In its current form, they protect only companies with
big legal departments as they:
a.) Patent everything no matter how general
b.) Sue everybody. Even if the patent can be argued
invalid, small companies can ill-afford the
typical $500k cost of a law-suit (not to mention
years of harassment).

Don't let them take away your right to program
whatever you like. Make a stand on Software Patents
before its too late.

Read about the ongoing battle at http://swpat.ffii.org/
----------------

Arthur

unread,
Feb 3, 2004, 5:01:55 PM2/3/04
to
Hi Ben,

Thanks for replying. Actually, since I have 2 NIC's in my Linux box,
I want to be able to use BOTH routes. It matters not which one is
chosen. I just know that since I have 2 DSL lines, I want to take
advantage of the additional bandwidth and use both lines......

Will what you posted, the route add statements, accomplish this?

Thanks,

Arthur


Ben Measures <saint_abr...@removehotmail.com> wrote in message news:<HoNTb.3620$Ue2....@news-binary.blueyonder.co.uk>...

Cameron Kerr

unread,
Feb 3, 2004, 8:31:43 PM2/3/04
to
Arthur <ame...@iwc.net> wrote:
> Hi Ben,
>
> Thanks for replying. Actually, since I have 2 NIC's in my Linux box,
> I want to be able to use BOTH routes. It matters not which one is
> chosen. I just know that since I have 2 DSL lines, I want to take
> advantage of the additional bandwidth and use both lines......
>
> Will what you posted, the route add statements, accomplish this?

Have a look at the Advanced Routing and Traffic Control HOWTO. It deals
with load-balancing multiple links.

Arthur

unread,
Feb 4, 2004, 12:01:24 AM2/4/04
to
Hi Ben,

Thanks for replying to my post my routing table and such. I took your
advice, and my routing tble now looks like this:

Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref
Use Iface
192.168.1.0 192.168.1.1 255.255.255.0 UG 0 0
0 eth0
192.168.1.0 0.0.0.0 255.255.255.0 U 0 0
0 eth0
192.168.0.0 192.168.0.1 255.255.255.0 UG 0 0
0 eth1
192.168.0.0 0.0.0.0 255.255.255.0 U 0 0
0 eth1
127.0.0.0 0.0.0.0 255.0.0.0 U 0 0
0 lo
0.0.0.0 192.168.1.1 0.0.0.0 UG 0 0
0 eth0
0.0.0.0 0.0.0.0 0.0.0.0 U 0 0
0 eth0


I have a couple of questions and I was hoping you could help.........

If I have 2 DSL lines, and 2 IP's, then shouldn't data be piped over
both of them? What decides which DSL line the data goes out over?

Also, here is something interesting: I can telnet and SSH into one of
the routes, but not the other......why is that? Shouldn't both be
open?

Thanks for all your help........I know it's a alot to ask, but I am
lost and really in need of help....

Thanks,

Arthur


Ben Measures <saint_abr...@removehotmail.com> wrote in message news:<HoNTb.3620$Ue2....@news-binary.blueyonder.co.uk>...

Arthur

unread,
Feb 4, 2004, 7:44:49 AM2/4/04
to
Hi Cameron,

One other thing I am looking for is a way to tell IF both lines are
being used. I mean, just because I can ping both routers does not
mean that Linux is piping through both lines.......so I am looking for
a way just to make sure that both lines are being used by the OS to
send data.....

Thanks,

Arthur

Cameron Kerr <camero...@paradise.net.nz> wrote in message news:<4020...@news.maxnet.co.nz>...

Ben Measures

unread,
Feb 4, 2004, 11:35:31 AM2/4/04
to
Cameron Kerr wrote:
> Arthur <ame...@iwc.net> wrote:
>
>>Hi Ben,
>>
>>Thanks for replying. Actually, since I have 2 NIC's in my Linux box,
>>I want to be able to use BOTH routes. It matters not which one is
>>chosen. I just know that since I have 2 DSL lines, I want to take
>>advantage of the additional bandwidth and use both lines......
>>
>>Will what you posted, the route add statements, accomplish this?
>
>
> Have a look at the Advanced Routing and Traffic Control HOWTO. It deals
> with load-balancing multiple links.
>

Yes, this seems to be what you be wanting to do (load-balancing).

Have look at the following link for a howto, many more links from google.
http://cvs.sourceforge.net/viewcvs.py/*checkout*/leaf/doc/howto/LRP-Load-Balancing-HOWTO.html?rev=1.2

Be warned that this is can be a complex thing to setup (efficiently).

Ben Measures

unread,
Feb 4, 2004, 2:30:10 PM2/4/04
to
Arthur wrote:
> Hi Ben,
>
> Thanks for replying to my post my routing table and such. I took your
> advice, and my routing tble now looks like this:
>
> Kernel IP routing table
> Destination Gateway Genmask Flags Metric Ref Use Iface
> 192.168.1.0 192.168.1.1 255.255.255.0 UG 0 0 0 eth0
> 192.168.1.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
> 192.168.0.0 192.168.0.1 255.255.255.0 UG 0 0 0 eth1
> 192.168.0.0 0.0.0.0 255.255.255.0 U 0 0 0 eth1
> 127.0.0.0 0.0.0.0 255.0.0.0 U 0 0 0 lo
> 0.0.0.0 192.168.1.1 0.0.0.0 UG 0 0 0 eth0
> 0.0.0.0 0.0.0.0 0.0.0.0 U 0 0 0 eth0

This isn't quite right.


> 192.168.1.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0

> 192.168.0.0 0.0.0.0 255.255.255.0 U 0 0 0 eth1

> 0.0.0.0 0.0.0.0 0.0.0.0 U 0 0 0 eth0

are extraneous (probably original entries by DHCP). These shouldn't make
any difference but should be removed anyways for neatness.

Make sure 192.168.0.1 and 192.168.1.1 really are your gateway addresses.
I just put down the most common setup but it might be different for your
networks (you might not even have gateways from the looks of things).

> I have a couple of questions and I was hoping you could help.........
>
> If I have 2 DSL lines, and 2 IP's, then shouldn't data be piped over
> both of them? What decides which DSL line the data goes out over?

Just adding routes won't do what you want to do there. You want to do
"load-balancing" - see my other post.

> Also, here is something interesting: I can telnet and SSH into one of
> the routes, but not the other......why is that? Shouldn't both be
> open?

If you are trying from the internet, then it is probably (almost
definitely in the case of SSH) because network traffic is going out on a
different route to the return. (Packets always leave your computer
through eth0, the 192.168.1.x network.)

> Thanks for all your help........I know it's a alot to ask, but I am
> lost and really in need of help....

Only glad to help, you seem to be genuinely and thoroughly searching for
a solution here. Make sure you read my other post in this thread.

Arthur

unread,
Feb 4, 2004, 10:58:08 PM2/4/04
to
Hey Ben,

You've been quite helpful, but one of your comments mystifys me.

> If you are trying from the internet, then it is probably (almost
> definitely in the case of SSH) because network traffic is going out on a
> different route to the return. (Packets always leave your computer
> through eth0, the 192.168.1.x network.)

If packets are leaving on the 1.x network, then would that mean that
I'm not using both DSL lines? I would think that I should be able to
connect to either. And, once I establish a connection on one or the
other, that is where my traffic for my connection will be.......

SSH is just a process running. I do not think that if only listens on
one network......

Thanks,

Arthur

Ben Measures <saint_abr...@removehotmail.com> wrote in message news:<6LbUb.167$%i5...@news-binary.blueyonder.co.uk>...

Ben Measures

unread,
Feb 5, 2004, 12:20:20 AM2/5/04
to
Arthur wrote:
> Hey Ben,
>
> You've been quite helpful, but one of your comments mystifys me.
>
>
>>If you are trying from the internet, then it is probably (almost
>>definitely in the case of SSH) because network traffic is going out on a
>>different route to the return. (Packets always leave your computer
>>through eth0, the 192.168.1.x network.)
>
>
> If packets are leaving on the 1.x network, then would that mean that
> I'm not using both DSL lines? I would think that I should be able to
> connect to either. And, once I establish a connection on one or the
> other, that is where my traffic for my connection will be.......

Not necessarily...

> SSH is just a process running. I do not think that if only listens on
> one network......

Its not. It's listening on *both* networks but is transmitting with just
the *one* (the default route). Here's what I reckon is happening:

Call 192.168.0.x 192.168.1.x network A and network B respectively. Call
the DSLs connected to network A and network B, DSL1 and DSL2 resp.

I said that ssh probably requires (for security reasons) the routes for
incomimg traffic and outgoing traffic to be the same. I also said that
all packets leave your computer from network B.

So suppose you ssh via DSL2 on network B. The client computer (on the
internet) sends packets via DSL2 through network B to the server. The
server then sends its response out through eth0 (default route), through
network A, out DSL2 to the client on the internet.

Now suppose you ssh via DSL1 on network A. The client computer (on the
internet) sends packets via DSL1 through network A to the server. The
server then sends its response out through eth0 (default route), through
network A, out DSL2 to the client on the internet. The client spots that
the connection was sent to DSL1 but was recieved from DSL2 and so
doesn't trust it, resulting in a 'broken' connection.

Of course, I might be totally wrong here. If anybody knows better,
please put me straight.

0 new messages