Networking Forums

Networking Forums > Computer Networking > Linux Networking > local routing between two network cards?

Reply
Thread Tools Display Modes

local routing between two network cards?

 
 
Pete
Guest
Posts: n/a

 
      02-14-2005, 04:39 AM


I have a goal that I feel should not be too hard, but I've been unable
to find a clue as to how to do it.

I have a linux (RedHat 7.1) box with two wthernet cards, each of which
connects to one other satellite (non-linux, non M$) machine. (Local LAN
only -- no internet connection.) Each machine converses happily with
linux, but they can't see each other, because there is no routing
between the cards.

What I'd like is some simple router scheme that passes packets arriving
at one card destined for the machine on the other card to be passed to
that card. However, I've never been able to track down how to do this.

Anyone able to point me in the right direction?

Thanks.
-- Pete --

--
================================================== ==========================
The address in the header is a Spam Bucket -- don't bother replying to it...
(If you do need to email, replace the account name with my true name.)
================================================== ==========================
 
Reply With Quote
 
 
 
 
Allen McIntosh
Guest
Posts: n/a

 
      02-14-2005, 12:43 PM
> Each machine converses happily with
> linux, but they can't see each other, because there is no routing
> between the cards.
>
> What I'd like is some simple router scheme that passes packets arriving
> at one card destined for the machine on the other card to be passed to
> that card. However, I've never been able to track down how to do this.


I'm surprised you couldn't find this in one of the networking howto's.

On the Linux box, you need to turn on IP forwarding. Google for
ip_forward if you don't know how.

The other machines need to list the Linux box as a gateway.
 
Reply With Quote
 
Moe Trin
Guest
Posts: n/a

 
      02-14-2005, 07:45 PM
In article <cupdif$uc$(E-Mail Removed)>, Pete wrote:

>I have a goal that I feel should not be too hard, but I've been unable
>to find a clue as to how to do it.


Your description of the problem isn't quite clear. Have you had a look
at the "Linux Network Administrator's Guide"? It should be available on
your system, or get it from http://tldp.org/guides.html.

>I have a linux (RedHat 7.1) box with two wthernet cards, each of which
>connects to one other satellite (non-linux, non M$) machine. (Local LAN
>only -- no internet connection.) Each machine converses happily with
>linux, but they can't see each other, because there is no routing
>between the cards.


Make sure these are different networks (or you'll have to get into
Bridging, and proxy-arp, and all kind of nasty sounding things), and that
they each know to send the packets to the local address of the Linux box as
a gateway to the network that the "other" computer is on. Then, tell the
Linux box to act as a router, by setting the variable FORWARD_IPV4 in
/etc/sysconfig/network to either 'true' or 'yes'.

>What I'd like is some simple router scheme that passes packets arriving
>at one card destined for the machine on the other card to be passed to
>that card. However, I've never been able to track down how to do this.


Very common question, answered many time. Had you also looked at all of
the HOWTOs on the system? 7.1 is unsupported and ancient, but the HOWTOs
should tell you all you need to know.

Old guy

 
Reply With Quote
 
Pete
Guest
Posts: n/a

 
      02-14-2005, 08:24 PM
In article <(E-Mail Removed)>,
Moe Trin <no.mail.accepted.sorry> wrote:
>In article <cupdif$uc$(E-Mail Removed)>, Pete wrote:
>
>Your description of the problem isn't quite clear. Have you had a look
>at the "Linux Network Administrator's Guide"? It should be available on
>your system, or get it from http://tldp.org/guides.html.

Hadn't seen that one -- I'll grab it now...
>
>>I have a linux (RedHat 7.1) box with two wthernet cards, each of which
>>connects to one other satellite (non-linux, non M$) machine. (Local LAN
>>only -- no internet connection.) Each machine converses happily with
>>linux, but they can't see each other, because there is no routing
>>between the cards.

>
>Make sure these are different networks (or you'll have to get into
>Bridging, and proxy-arp, and all kind of nasty sounding things), and that

Ahh -- well this could be a problem! All the machines have 192.168.1...
addresses. I have /etc/sysconfig/static-routes set up to direct the
linux box packets the right way.
>they each know to send the packets to the local address of the Linux box as
>a gateway to the network that the "other" computer is on. Then, tell the
>Linux box to act as a router, by setting the variable FORWARD_IPV4 in
>/etc/sysconfig/network to either 'true' or 'yes'.

This I have done, but it's having no effect.

In more detail, /etc/sysconfig/network is:

NETWORKING=yes
HOSTNAME=Lys
FORWARD_IPV4=yes

and /etc/sysconfig/sysctl.conf is:

# Enables packet forwarding
net.ipv4.ip_forward = 1
net.ipv4.ip_always_defrag = 1
# Enables source route verification
net.ipv4.conf.all.rp_filter = 1
# Disables the magic-sysrq key
kernel.sysrq = 0

/etc/sysconfig/static-routes has:
eth0 host 192.168.1.2
eth1 host 192.168.1.1

(And both satellite machines have the linux one (192.168.1.3) set up
as gateway.)
>
>>What I'd like is some simple router scheme that passes packets arriving
>>at one card destined for the machine on the other card to be passed to
>>that card. However, I've never been able to track down how to do this.

>
>Very common question, answered many time. Had you also looked at all of
>the HOWTOs on the system? 7.1 is unsupported and ancient, but the HOWTOs
>should tell you all you need to know.

Hmm -- no, I haven't really found the answers I need, despite quite a
bit of delving! [Yes, I know 7.1 is old, but my philosophy is that
advantages of updating seldom outweigh the pain! (And some of the HOWTOs
are even older... (:-/)]

I may just break down and rewire with a small hub. [As background,
I acquired the hardware that I've installed the Linux on with two
network cards already in place, so it seemed easier just to use
crossover cables to connect. Works fine for most things, except
when I want to talk satellite to satellite.]

-- Pete --

--
================================================== ==========================
The address in the header is a Spam Bucket -- don't bother replying to it...
(If you do need to email, replace the account name with my true name.)
================================================== ==========================
 
Reply With Quote
 
Tauno Voipio
Guest
Posts: n/a

 
      02-14-2005, 09:02 PM
Pete wrote:
>
> /etc/sysconfig/static-routes has:
> eth0 host 192.168.1.2
> eth1 host 192.168.1.1
>


You have both cards in the same network (192.168.1.0/24, I guess).
It will destroy setting up proper routing in the host with two
network cards.

Please change the cards to different networks.

You have to set the dual-homed computer as the gateway
for the network behind it. Please do not confuse with
default gateway - it points always to the nearest host
toward the Internet.

An example:

Computer A:

eth0 IP 192.168.2.2, mask 255.255.255.0, connected to B eth1
default gateway 192.168.2.1

Computer B:

eth0 IP 192.168.1.2, mask 255.255.255.0, connected to C eth0
eth1 IP 192.168.2.1, mask 255.255.255.0, connected to A eth0
default gateway 192.168.1.1
IP forwarding enabled

Computer C:

eth0 IP 192.168.1.1, mask 255.255.255.0, connected to B eth0
ppp0 IP 1.2.3.4, peer 1.2.3.5, connected to ISP
route to 192.168.2.0 mask 255.255.255.0 gateway 192.168.1.2
default gateway 1.2.3.5
This computer needs NAT forwarding for the Internet, as the
internal addresses (192.168.x.y) are not publicly routable

The ISP addresses are just guesses - they will come from the ISP.

HTH

--

Tauno Voipio
tauno voipio (at) iki fi

 
Reply With Quote
 
Rick Jones
Guest
Posts: n/a

 
      02-14-2005, 09:50 PM
Pete <(E-Mail Removed)> wrote:
> In article <(E-Mail Removed)>,


>>they each know to send the packets to the local address of the Linux box as
>>a gateway to the network that the "other" computer is on. Then, tell the
>>Linux box to act as a router, by setting the variable FORWARD_IPV4 in
>>/etc/sysconfig/network to either 'true' or 'yes'.

> This I have done, but it's having no effect.


> In more detail, /etc/sysconfig/network is:


> NETWORKING=yes
> HOSTNAME=Lys
> FORWARD_IPV4=yes


> and /etc/sysconfig/sysctl.conf is:


> # Enables packet forwarding
> net.ipv4.ip_forward = 1
> net.ipv4.ip_always_defrag = 1
> # Enables source route verification
> net.ipv4.conf.all.rp_filter = 1
> # Disables the magic-sysrq key
> kernel.sysrq = 0
>
> /etc/sysconfig/static-routes has:
> eth0 host 192.168.1.2
> eth1 host 192.168.1.1


> (And both satellite machines have the linux one (192.168.1.3) set up
> as gateway.)


And what do you have configured on the windows systems?

rick jones
--
firebug n, the idiot who tosses a lit cigarette out his car window
these opinions are mine, all mine; HP might not want them anyway...
feel free to post, OR email to raj in cup.hp.com but NOT BOTH...
 
Reply With Quote
 
Allen McIntosh
Guest
Posts: n/a

 
      02-14-2005, 10:46 PM
Rick Jones wrote:
> Pete <(E-Mail Removed)> wrote:
>>/etc/sysconfig/static-routes has:
>>eth0 host 192.168.1.2
>>eth1 host 192.168.1.1

Unnecessary. This should be evident from the NIC addresses.
>>(And both satellite machines have the linux one (192.168.1.3) set up
>>as gateway.)

Another problem. Both NIC's can't have the same address. As another
poster pointed out, each NIC should be on a different network. The
easiest way to do this is use 192.168.1.0 for one and 192.168.2.0 for
the other.
 
Reply With Quote
 
Rick Jones
Guest
Posts: n/a

 
      02-14-2005, 11:25 PM
Allen McIntosh <(E-Mail Removed)> wrote:
> Another problem. Both NIC's can't have the same address. As
> another poster pointed out, each NIC should be on a different
> network. The easiest way to do this is use 192.168.1.0 for one and
> 192.168.2.0 for the other.


What ever did we do in the old days of pt-pt networks in the same IP
(sub)nets?-)

rick jones
--
Wisdom Teeth are impacted, people are affected by the effects of events.
these opinions are mine, all mine; HP might not want them anyway...
feel free to post, OR email to raj in cup.hp.com but NOT BOTH...
 
Reply With Quote
 
Pete
Guest
Posts: n/a

 
      02-15-2005, 12:45 AM
In article <yW9Qd.35$(E-Mail Removed)>,
Rick Jones <(E-Mail Removed)> wrote:
>
>And what do you have configured on the windows systems?


As I briefly hinted in my original post, I wouldn't allow anything
Microsoft related *near* my machines... (:-))

They're actually -- ahem -- BeOS...

I did make a mistake in my last posting, though. The two NIC cards
of course have to have different IPs -- 192.168.1.3 and .4 actually.
The gateway addresses in the satellites are set appropriately.

-- Pete --

--
================================================== ==========================
The address in the header is a Spam Bucket -- don't bother replying to it...
(If you do need to email, replace the account name with my true name.)
================================================== ==========================
 
Reply With Quote
 
Pete
Guest
Posts: n/a

 
      02-15-2005, 01:00 AM
In article <2OaQd.21680$(E-Mail Removed)>,
Allen McIntosh <(E-Mail Removed)> wrote:
>Rick Jones wrote:
>> Pete <(E-Mail Removed)> wrote:
>>>/etc/sysconfig/static-routes has:
>>>eth0 host 192.168.1.2
>>>eth1 host 192.168.1.1

>Unnecessary. This should be evident from the NIC addresses.

It is necessary the way I have things set up (as I discovered through
lengthy adventures when I first put things together). If I don't
have that, it picks one card to send response packets out and always
ignores the other. (In other words pings etc from one machine work
fine; from the other they get lost.)
>>>(And both satellite machines have the linux one (192.168.1.3) set up
>>>as gateway.)

>Another problem. Both NIC's can't have the same address. As another
>poster pointed out, each NIC should be on a different network. The
>easiest way to do this is use 192.168.1.0 for one and 192.168.2.0 for
>the other.

Yes -- my bad. They actually *do* have different addresses -- but on
the same subnet: 192.168.1.3 and .4. The gateway setting in one of the
satellites was wrong -- corrected it... makes no difference.
Neither did setting PROMISC in the interfaces, which I'd neglected to
do before.

One reason all the machines are on the same net is that this system
evolved when the linux box was added. Originally two machines were
simply connected with a crossover. I want the ability to go back to that
setup if I need to, but I guess changing one machine's subnet won't
hurt that (?) I'll experiment.

(A 'gateway' isn't special as regards to IP is it? It doesn't *have*
to be 0 or 1?)
-- Pete --





--
================================================== ==========================
The address in the header is a Spam Bucket -- don't bother replying to it...
(If you do need to email, replace the account name with my true name.)
================================================== ==========================
 
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
local routing Igor Nemilentsev Linux Networking 5 10-05-2010 11:57 AM
Routing between 2 local subnets with W2K server? Wrighty Windows Networking 6 09-04-2007 02:57 PM
Routing problem with two network cards Pete Melbourne Wireless Internet 2 03-20-2005 03:49 AM
routing VPN traffic into local net speakeasy Windows Networking 5 10-01-2004 01:43 AM
3 Network cards in one PC, Routing Problem Christian Hennrich Linux Networking 2 11-12-2003 06:19 PM



1 2 3 4 5 6 7 8 9 10 11