LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 02-05-2003, 07:11 AM   #1
phenix(flc)
LQ Newbie
 
Registered: Feb 2003
Posts: 10

Rep: Reputation: 0
Question routing problem


hello,

Here is my problem:

I have two Interfaces eth0:: IP 192.168.1.3 netmask 255.255.255.0
eth0 is useing my dsl router as gateway to the internet.
Gateway: 192.168.1.254 DNS: 192.168.1.254 .
Interface two is eth1:: IP 192.168.2.1 netmask 255.255.0.0
eth1 is the gateway for my windows machine.
Internet is working fine, and the subnet is working just fine too.

What I'm trying to do now is that eth1 uses eth0 as gateway.

I tried it with following command::
route add default gw 192.168.1.3 dev eth1

But then an error occurs -> Network is unreachable.

Which is pretty confusing because I can ping eth0 with my windows machine just as well as eth1. But to ping eth0 it has to go over eth1. So there has to be some kind of connection. What did I do wrong? Any suggestions??

Christian

Last edited by phenix(flc); 02-05-2003 at 07:13 AM.
 
Old 02-05-2003, 09:19 AM   #2
Darin
Senior Member
 
Registered: Jan 2003
Location: Portland, OR USA
Distribution: Slackware, SLAX, Gentoo, RH/Fedora
Posts: 1,024

Rep: Reputation: 45
Re: routing problem

Quote:
Originally posted by phenix(flc)
I have two Interfaces eth0:: IP 192.168.1.3 netmask 255.255.255.0
eth0 is useing my dsl router as gateway to the internet.
Gateway: 192.168.1.254 DNS: 192.168.1.254 .
Interface two is eth1:: IP 192.168.2.1 netmask 255.255.0.0
eth1 is the gateway for my windows machine.
Internet is working fine, and the subnet is working just fine too.
change that to 255.255.255.0 and it will work.
 
Old 02-05-2003, 11:34 AM   #3
phenix(flc)
LQ Newbie
 
Registered: Feb 2003
Posts: 10

Original Poster
Rep: Reputation: 0
Doesn't work

I tried that too before I changed it to 255.255.0.0 .
Somebody told me then that I have to change it because the 2 Interface have to be of different masks.
 
Old 02-05-2003, 11:41 AM   #4
phenix(flc)
LQ Newbie
 
Registered: Feb 2003
Posts: 10

Original Poster
Rep: Reputation: 0
Unhappy hmm

You were right with changing the mask to 255.255.255.0 . I jsut recognized that he didn't set up the 192.168.2.0 ip's. Now he does but the error occurs anyways.

?????????????????

Christian
 
Old 02-05-2003, 12:42 PM   #5
Darin
Senior Member
 
Registered: Jan 2003
Location: Portland, OR USA
Distribution: Slackware, SLAX, Gentoo, RH/Fedora
Posts: 1,024

Rep: Reputation: 45
What exactly still doesn't work? I picked the subnet mask up because it was simple but if that isn't the only problem then I would need more specific info.

you have:

eth0 192.168.1.3/255.255.255.0?
and eth1 192.168.2.1/255.255.255.0?
the DSL is 192.168.1.254 connected to eth0?
eth0 has default gateway 192.168.1.254?
everything connected to eth1 has gateway 192.168.2.1?
you activated routing on the linux machine? "echo 1 > /proc/sys/net/ipv4/ip_forward" will be a command in one of your startup scripts, /etc/rc.d/rc.inet2 in Slackware.

And you said, "Internet is working fine" by this you mean any machine on the network can see the internet?

Then you said, "But then an error occurs -> Network is unreachable." but never stated exactly what machine you were on and what you did that gave you this error.
 
Old 02-05-2003, 12:56 PM   #6
phenix(flc)
LQ Newbie
 
Registered: Feb 2003
Posts: 10

Original Poster
Rep: Reputation: 0
=)

No I meant my linux machine is online. My Windows machine can't even ping the router.

what do you mean with activating routing.

the error:: Network is Unreachable
occured when I was setting up eth0 as the gateway for eth1

route add default gw 192.168.1.3 dev eth1

-->SIOCADDRT: Network is Unreachable

Can you tell me more about IP forwarding??
 
Old 02-05-2003, 02:35 PM   #7
SlickWilly
Member
 
Registered: Dec 2002
Posts: 327

Rep: Reputation: 30
Oh good lord...

>Can you tell me more about IP forwarding??

This has nothing to do with IP Forwarding.. that's something else entirely.

Please understand that routing is something that happens between *NETWORKS*.

Your machine (linux box) knows how to reach various networks attatched to it. When it *doesn't* know how to reach a network it forwards the request on to its 'default' gateway, and hopes that *IT* knows and will tell it how to get there.

Your machine can only have 1 default gateway. It's where stuff goes when it doesn't know where else to put it.

What you did was to turn your default gateway from pointing out onto the internet (and to your isp) and back internally. You're effectively saying 'My internal network knows how to get *everywhere*. If you don't know how to get to www.yahoo.com then send it to this interface (eth1) and what's on the other end of that interface will know what to do with it.'

Which it quite clearly *doesn't*.

Your machine was set up correctly.
What you *SHOULD* see though, is a line like this :

192.168.2.0 * 255.255.255.0 U 0 0 0 eth1

And what this means is that your machine knows that any traffic destined for your private subnet of 192.168.2.xxx should be sent to your internal ethernet card of eth1. (it won't send it across eth0 out onto the internet and back).

Your *default* should stay pointing out to the internet, because at the other end of that cable is a router who *does* know the correct route to www.yahoo.com



Slick.
 
Old 02-05-2003, 04:47 PM   #8
Darin
Senior Member
 
Registered: Jan 2003
Location: Portland, OR USA
Distribution: Slackware, SLAX, Gentoo, RH/Fedora
Posts: 1,024

Rep: Reputation: 45
Cool

Quote:
Originally posted by SlickWilly
Oh good lord...
Give the guy a break, you wouldn't like it if someone patronized you when you were wrong...
Quote:
>Can you tell me more about IP forwarding??

This has nothing to do with IP Forwarding.. that's something else entirely.
Nothing? Really?
Quote:
Please understand that routing is something that happens between *NETWORKS*.
You mean like the 192.168.1.0 network and the 192.168.2.0 network?
Quote:
your machine (linux box) knows how to reach various networks attatched to it. When it *doesn't* know how to reach a network it forwards the request on to its 'default' gateway, and hopes that *IT* knows and will tell it how to get there.

Your machine can only have 1 default gateway. It's where stuff goes when it doesn't know where else to put it.
Actually, that is correct, I'm almost impressed slick.
Quote:
What you did was to turn your default gateway from pointing out onto the internet (and to your isp) and back internally. You're effectively saying 'My internal network knows how to get *everywhere*. If you don't know how to get to www.yahoo.com then send it to this interface (eth1) and what's on the other end of that interface will know what to do with it.'
Well, actually what you tried to do was tell linux that it could use eth1 to reach 192.168.1.3 but that IP address is actually reached on the other network, eth0.
Quote:
Which it quite clearly *doesn't*.
Really? so the fact that he can get to the internet from the linux box means nothing?

Quote:
Your machine was set up correctly.
What you *SHOULD* see though, is a line like this :
192.168.2.0 * 255.255.255.0 U 0 0 0 eth1

And what this means is that your machine knows that any traffic destined for your private subnet of 192.168.2.xxx should be sent to your internal ethernet card of eth1. (it won't send it across eth0 out onto the internet and back).

Your *default* should stay pointing out to the internet, because at the other end of that cable is a router who *does* know the correct route to www.yahoo.com


Slick.
Your linux machine already knows how to "route" data to the appropriate interface; It knows how to reach all the clients on eth1, 192.168.2.0 net AND anything on eth0, 192.168.1.0 including the DSL to the internet as the default gateway. Hmm, now all you need to do is tell the linux network stack to IP forward all the data from eth1 to eth0 and back so clients on the 192.168.2.0 network can go through the linux box (and the DSL) to get to the internet.

So, as I said earlier, you should turn on packet forwarding in Linux, there is probably some network menu in Redhat that has a checkbox to turn this on, maybe some Redhat expert could point out where this is? If you can't find it, one way to make it work is to look for a file /etc/rc.d/rc.local and add this line at the bottom of it:
Code:
echo 1 > /proc/sys/net/ipv4/ip_forward
This tells linux to forward the traffic on one network card to the other network card, making it so clients on one can see the internet on the other.
 
Old 02-05-2003, 06:11 PM   #9
phenix(flc)
LQ Newbie
 
Registered: Feb 2003
Posts: 10

Original Poster
Rep: Reputation: 0
Talking BIG THANKS !!!

thank you for the help. you really know how to make thinks easy to understand. *smile* i read trough lots of books but never found an answer.

Big Thanks

Christian
 
Old 02-06-2003, 06:56 AM   #10
phenix(flc)
LQ Newbie
 
Registered: Feb 2003
Posts: 10

Original Poster
Rep: Reputation: 0
Hey... It's me again.
It still ain't working.

????

And when I want to shut down it stopps at this line::

stopping NSF Datasystem: ....... RCP:evice is still in work... unable to unmount. or something like this.

Christian
 
Old 02-06-2003, 09:38 AM   #11
Darin
Senior Member
 
Registered: Jan 2003
Location: Portland, OR USA
Distribution: Slackware, SLAX, Gentoo, RH/Fedora
Posts: 1,024

Rep: Reputation: 45
Double check these and post the answers:
eth0 192.168.1.3/255.255.255.0?
eth1 192.168.2.1/255.255.255.0?
the DSL is 192.168.1.254 connected to eth0?
eth0 has default gateway 192.168.1.254?
everything connected to eth1 has gateway 192.168.2.1?
routing is turned on?
what part of it doesn't work? have to be a lot mor descriptive than "it still ain't working" here
it hangs stopping NFS? what all did you change since it did shut down?
 
Old 02-06-2003, 10:03 AM   #12
phenix(flc)
LQ Newbie
 
Registered: Feb 2003
Posts: 10

Original Poster
Rep: Reputation: 0
Everything is correct.

All I changed is I activated IP forwarding.
I added the line you told me and then I opened /etc/sysconfig/network and put ipforward on yes.

And what is not working is that I can't ping 192.168.1.254 from my Windows machine (192.168.2.2). So I don't have internet. But I can ping 192.168.2.1 and 192.168.1.3

Could it be that the dns has something to do with that.

I set my windows machine on gateway 192.168.2.1 dns 192.168.2.1 alternative dns 192.168.1.254
 
Old 02-06-2003, 12:35 PM   #13
SlickWilly
Member
 
Registered: Dec 2002
Posts: 327

Rep: Reputation: 30
Quote:
Originally posted by Darin
Give the guy a break, you wouldn't like it if someone patronized you when you were wrong...
My bad.. I shall immediately ritually disembowel myself on this handy fig newton I have at my desk.

But um.. may I first point out that I still think his problem is this :

route add default gw 192.168.1.3 dev eth1

Which I read as :

route (default) [internet side network] to dev [internal facing network card]

Anything destined for internet is going to be routed internally. His traffic is going to bounce off the inside of his internet facing network card.

I leave you in the massively capable hands of Darian. He has way more posts than I, and knows the difference between IP Forwarding and Port Forwarding *cough cough*.

Slick.
 
Old 02-06-2003, 01:58 PM   #14
Darin
Senior Member
 
Registered: Jan 2003
Location: Portland, OR USA
Distribution: Slackware, SLAX, Gentoo, RH/Fedora
Posts: 1,024

Rep: Reputation: 45
yum fig newtons!

oops, you probably don't have IP masquerading...
tutorials here:
http://ipmasq.cjb.net/
http://iptables-tutorial.frozentux.n...-tutorial.html
or you can try this app which automates the process:
http://firestarter.sourceforge.net/

(ok, so you could make it a regular router by telling the DSL to get to the 192.168.2.0/24 net via 192.168.1.3 if you wanted to do it that way.)
 
Old 02-07-2003, 09:19 AM   #15
phenix(flc)
LQ Newbie
 
Registered: Feb 2003
Posts: 10

Original Poster
Rep: Reputation: 0
hey...

nothing worked. I activated and set up ip masquerading and it didn't work. When I started the rc.firewall-2.4 everything it was supposed to do failed.
Kernel version and everything is correct so I don't know what is wrong.

After that I tried firestarter... I couldn't even install it. The signiture was wrong and there were a couple package conflicts.

I don't know what to do. Thats almost impossible that none of it is working.

Last edited by phenix(flc); 02-07-2003 at 09:20 AM.
 
  


Reply



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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
routing problem DRagonRage Debian 8 09-21-2005 03:29 PM
routing problem DRagonRage Linux - Networking 1 09-21-2005 01:02 PM
Routing problem Infernal211283 Linux - Networking 3 02-28-2005 02:59 AM
Another Routing problem Bambi Linux - Networking 2 06-03-2004 03:13 PM
routing problem nowonmai Linux - Networking 2 10-09-2003 07:59 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 07:49 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration