|
|
|
|
|
|
| Author |
Message |
Moe Trin *nix forums Guru
Joined: 20 Feb 2005
Posts: 972
|
Posted: Tue Feb 15, 2005 10:42 pm Post subject:
Re: local routing between two network cards?
|
|
|
In article <ikbQd.53$jk6.36@news.cpqcorp.net>, Rick Jones wrote:
| Quote: | Allen McIntosh <nospam@mouse-potato.com> wrote:
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?-)
|
We used 'host' routes - because that takes precedence over a network
route, just as a narrow network mask takes precedence over a wider
mask.
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
192.168.1.0 0.0.0.0 255.255.255.0 U 0 0 4198 eth0
192.168.2.0 192.168.1.254 255.255.254.0 UG 0 0 160 eth0
192.168.0.0 192.168.1.253 255.255.0.0 UG 0 0 8 eth0
127.0.0.0 0.0.0.0 255.0.0.0 U 0 0 20 lo
0.0.0.0 192.168.1.11 0.0.0.0 UG 0 0 5 eth0
Here - there is no confusion - 192.168.1.x is local. 192.168.2.x and .3.x
are reachable through 192.168.1.254. The rest of 192.168.x.x is reachable
through 192.168.1.253 and everything else goes to 192.168.1.11. A packet
going to 192.168.3.12 would not be sent to 192.168.1.253 any more than it
would be sent to 192.168.1.11 - there is a more definitive route using
192.168.1.254. (And yes, that is actually a munged version of a real
working routing table.)
Old guy |
|
| Back to top |
|
 |
Moe Trin *nix forums Guru
Joined: 20 Feb 2005
Posts: 972
|
Posted: Tue Feb 15, 2005 10:49 pm Post subject:
Re: local routing between two network cards?
|
|
|
In article <87hdkeyvde.fld@barrow.com>, Floyd L. Davidson wrote:
| Quote: | It is impossible to get away from putting the two NIC's on
*different* subnets.
|
Actually, host routes work just fine. Or, you could investigate
Bridging. Not like it hasn't been done for a number of years.
| Quote: | Of course it is not required that
subnetting be done at 8 bit boundaries (e.g. the last number in
a dotted quad IP address). But you'll find that figuring out
the masking for other boundaries is not fun.
|
For those who are binary/hexadecimal math challenged, there is always
1878 Variable Length Subnet Table For IPv4. T. Pummill, B. Manning.
December 1995. (Format: TXT=19414 bytes) (Obsoletes RFC1860) (Status:
INFORMATIONAL)
Find RFC1878 at your favorite rfc editor mirror site, such as
http://www.ietf.org/rfc/rfc0000.txt
http://www.faqs.org/rfcs/rfc0000.html
http://www.rfc-editor.org/rfc/rfc0000.txt
http://www.ccd.bnl.gov/network/general/rfc0000.html
http://www.cis.ohio-state.edu/htbin/rfc/rfc0000.html
Replace the four zeros with the four digit document number desired.
Now that I think about it, some distributions also have
[compton ~]$ whatis ipcalc
ipcalc (1) - perform simple manipulation of IP addresses
[compton ~]$
which I believe started out as a script by Eric Troan of Red Hat back
around RH5 or so.
Old guy |
|
| Back to top |
|
 |
Floyd L. Davidson *nix forums Guru
Joined: 08 Mar 2005
Posts: 405
|
Posted: Wed Feb 16, 2005 12:17 am Post subject:
Re: local routing between two network cards?
|
|
|
ibuprofin@painkiller.example.tld (Moe Trin) wrote:
| Quote: | In article <ikbQd.53$jk6.36@news.cpqcorp.net>, Rick Jones wrote:
Allen McIntosh <nospam@mouse-potato.com> wrote:
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?-)
We used 'host' routes - because that takes precedence over a network
route, just as a narrow network mask takes precedence over a wider
mask.
|
A "host" route *is* a network route... with a subnet mask of
255.255.255.255, making it a subnet with exactly one member.
In fact, you can add a "host" route with a "route add -net ..."
command. Here are two commands that create an identical route,
and that route can be deleted using either of the matching
"route del ..." commands:
route add -host 192.168.1.11 eth0
route add -net 192.168.1.11 netmask 255.255.255.255 eth0
Both create,
Destination Gateway Genmask Flags Metric Ref Use Iface
192.168.1.11 0.0.0.0 255.255.255.255 UH 0 0 0 eth0
Deleting that route can be done with either of,
route del -host 192.168.1.11 eth0
route del -net 192.168.1.11 netmask 255.255.255.255 eth0
Hence, a "host" route is just special case network route.
The route selected will be the entry with the most restricted
netmask. I assume that the route table is parsed from top to
bottom, and that new entries are placed as appropriate. Regardless
the display from /sbin/route is a top to bottom prioritized list
of routes.
Hence a network mask of 255.255.255.255 causes that route to be
placed towards the beginning of the list compared to a route
with a mask of 255.255.255.0. That is why the default, with a
netmask of 0.0.0.0 is always last. (Routes with the same
network mask are ordered by the destinations IP address, then by
interface, then by metric, but that doesn't affect this
discussion.)
| Quote: | Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
192.168.1.0 0.0.0.0 255.255.255.0 U 0 0 4198 eth0
192.168.2.0 192.168.1.254 255.255.254.0 UG 0 0 160 eth0
192.168.0.0 192.168.1.253 255.255.0.0 UG 0 0 8 eth0
127.0.0.0 0.0.0.0 255.0.0.0 U 0 0 20 lo
0.0.0.0 192.168.1.11 0.0.0.0 UG 0 0 5 eth0
Here - there is no confusion - 192.168.1.x is local. 192.168.2.x and .3.x
are reachable through 192.168.1.254. The rest of 192.168.x.x is reachable
through 192.168.1.253 and everything else goes to 192.168.1.11. A packet
going to 192.168.3.12 would not be sent to 192.168.1.253 any more than it
would be sent to 192.168.1.11 - there is a more definitive route using
192.168.1.254. (And yes, that is actually a munged version of a real
working routing table.)
|
A very good example to demonstrate the order of routes, by the
netmask. (And to show off some creative network management too!)
--
Floyd L. Davidson <http://web.newsguy.com/floyd_davidson>
Ukpeagvik (Barrow, Alaska) floyd@barrow.com |
|
| Back to top |
|
 |
Floyd L. Davidson *nix forums Guru
Joined: 08 Mar 2005
Posts: 405
|
Posted: Wed Feb 16, 2005 12:25 am Post subject:
Re: local routing between two network cards?
|
|
|
ibuprofin@painkiller.example.tld (Moe Trin) wrote:
| Quote: | In article <87hdkeyvde.fld@barrow.com>, Floyd L. Davidson wrote:
It is impossible to get away from putting the two NIC's on
*different* subnets.
Actually, host routes work just fine. Or, you could investigate
Bridging. Not like it hasn't been done for a number of years.
|
Sure a host route works fine, and that is exactly what I said! :-)
A "host" route is just a subnet with only one member, so each NIC
would indeed be a different subnet.
--
Floyd L. Davidson <http://web.newsguy.com/floyd_davidson>
Ukpeagvik (Barrow, Alaska) floyd@barrow.com |
|
| Back to top |
|
 |
Pete *nix forums addict
Joined: 19 Feb 2005
Posts: 93
|
Posted: Wed Feb 16, 2005 1:46 am Post subject:
Re: local routing between two network cards?
|
|
|
In article <cus3i4$3ph$1@jwgibbs.CChem.Berkeley.EDU>,
Pete <neverland@jwgibbs.cchem.berkeley.edu> wrote:
[some fairly mournful stuff...]
In the end, I persevered, and at last got everything working.
Basically it was a matter of separating the nets, as people suggested,
but there was at least one more snare in my way.
Every time I'd try to prescribe the necessary gateway on my main BeOS
machine (normally done by GUI panel), I'd lose telnet access from there
to the linux box! With some digging, I found that the gateway was being
set as the default route, and this somehow set it off in the wrong direction.
I fixed it by bypassing the GUI amd fixing up the /etc/...conf files used,
to add a specific route to the remote box.
However, I have no idea why a default route failed. Maybe somebody can
enlighten me?
Here's the output of the (BeOS) route command after setting that
gateway (on machine 192.168.1.1):
0.0.0.0 mask 0.0.0.0 gateway :192.168.1.3 dev /dev/net/ec9xx/0 flags RTF_UP RTF_GATEWAY RTF_DEFAULT
127.0.0.0 mask 255.0.0.0 dev loop0 flags RTF_UP
127.0.0.1 mask 255.255.255.255 dev loop0 flags RTF_UP RTF_HOST RTF_LOCAL
192.168.1.0 mask 255.255.255.0 dev /dev/net/ec9xx/0 flags RTF_UP
192.168.1.1 mask 255.255.255.255 dev /dev/net/ec9xx/0 flags RTF_UP RTF_HOST RTF_LOCAL
Running tcpdump on linux under those conditions, a telnet from the
above box ('Vanamonde') to linux would give:
13:31:22.071491 < Vanamonde.1028 > 0.0.0.0.domain: 16160+ PTR? 3.1.168.192.in-addr.arpa. (42) (ttl 254, id 77)
13:31:27.321491 < Vanamonde.1028 > 0.0.0.0.domain: 16160+ PTR? 3.1.168.192.in-addr.arpa. (42) (ttl 254, id 7
.... etc. but nothing else.
as opposed to going into the normal telnet conversation.
Is it looking for a nameserver or something? I naturally haven't filled
in any 'domain' because this is a private net with no outside connection.
But I don't really know what it wants.
Answers aren't so urgent now -- I'm happy that I've got things working --
but knowledge is knowledge...
And in any case many thanks for everbody's detailed responses (the slightly
tangential ones are informative too ( ).
-- 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.)
============================================================================ |
|
| Back to top |
|
 |
Google
|
|
| Back to top |
|
 |
|
|
The time now is Fri Jan 09, 2009 8:38 am | All times are GMT
|
|
Online Advertising | Xbox Mod Chips | Image Hosting | Mobile Phone | Advertising
|
|
Copyright © 2004-2005 DeniX Solutions SRL
|
|
|
|
Other DeniX Solutions sites:
Unix/Linux blog |
electronics forum |
medicine forum |
science forum |
|
|
Privacy Policy
|
Powered by phpBB © 2001, 2005 phpBB Group
|
|