260 lines
9.7 KiB
HTML
260 lines
9.7 KiB
HTML
<!--startcut ======================================================= -->
|
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
|
|
<html>
|
|
<head>
|
|
<META NAME="generator" CONTENT="lgazmail v1.3C.e">
|
|
<TITLE>The Answer Guy 51: Subnetting</TITLE>
|
|
</HEAD><BODY BGCOLOR="#FFFFFF" TEXT="#000000"
|
|
LINK="#3366FF" VLINK="#A000A0">
|
|
<!-- ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -->
|
|
<H4>"The Linux Gazette...<I>making Linux just a little more fun!</I>"</H4>
|
|
<P> <hr> <P>
|
|
<!-- ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -->
|
|
<center>
|
|
<H1><A NAME="answer">
|
|
<img src="../../gx/dennis/qbubble.gif" alt="(?)"
|
|
border="0" align="middle">
|
|
<font color="#B03060">The Answer Guy</font>
|
|
<img src="../../gx/dennis/bbubble.gif" alt="(!)"
|
|
border="0" align="middle">
|
|
</A></H1>
|
|
<BR>
|
|
<H4>By James T. Dennis,
|
|
<a href="mailto:linux-questions-only@ssc.com">linux-questions-only@ssc.com</a><BR>
|
|
LinuxCare,
|
|
<A HREF="http://www.linuxcare.com/">http://www.linuxcare.com/</A>
|
|
</H4>
|
|
</center>
|
|
|
|
<p><hr><p>
|
|
<!-- endcut ======================================================= -->
|
|
<!-- begin 5 -->
|
|
<H3 align="left"><img src="../../gx/dennis/qbubble.gif"
|
|
height="50" width="60" alt="(?) " border="0"
|
|
>Subnetting</H3>
|
|
|
|
|
|
<p><strong>From Berlin Tokugawa on Sun, 30 Jan 2000
|
|
</strong></p>
|
|
<!-- ::
|
|
Subnetting
|
|
~~~~~~~~~~
|
|
:: -->
|
|
<P><STRONG>
|
|
I have a LAN in our office connected to the Internet using a
|
|
subnet (240) for 16 IP numbers. Our office actually use only 4
|
|
computers to assign IP numbers from the said IP pool. One of
|
|
those computer in our office LAN is a Linux box configured as a
|
|
PPP server so I could dial-in from home (and get a static IP
|
|
number from the office IP pool assigned to the ppp interface) and
|
|
connect my small home LAN using a subnet of 248. I used eight(8)
|
|
IP numbers at home (using those unused, contiguous IP numbers from
|
|
the office IP pool) but I'm having problems.
|
|
</STRONG></P>
|
|
<P><STRONG>
|
|
The other computers at home (not the dial-out computer) can not
|
|
ping the dial-out computer when I'm PPP-connected to the office
|
|
LAN. Unconnected via PPP to the office LAN, all my home computers
|
|
can ping each other. All the other computers at home have the
|
|
home dial-out computer as their gateway to the outside world,
|
|
while the office computers have their gateway set to our office
|
|
router connected via leased-line to an ISP. I am wondering if the
|
|
cause of the problem is the re-use of the IP numbers at home that
|
|
are already subnetted in the office --regardless of their
|
|
assignment or non-assignment to working computers.
|
|
</STRONG></P>
|
|
<P><STRONG>
|
|
BTW, I do not want to use private IP addresses, IP aliasing,
|
|
firewalling, etc., as there is a need for my home computers at
|
|
home to be referenced by the outside world via valid IP numbers
|
|
directly. Any thoughts on this problem is greatly
|
|
appreciated. Thanks.
|
|
</STRONG></P>
|
|
<P><STRONG>
|
|
Berlin Tokugawa
|
|
</STRONG></P>
|
|
<BLOCKQUOTE><IMG SRC="../../gx/dennis/bbub.gif" ALT="(!)"
|
|
HEIGHT="28" WIDTH="50" BORDER="0"
|
|
>
|
|
You should really draw an ASCII diagram of
|
|
your network and include the IP addresses (even
|
|
a fake set of <EM>consistent</EM> IP addresses) when you
|
|
ask a question like this.
|
|
</BLOCKQUOTE>
|
|
|
|
<blockquote><pre> +-----------------------+
|
|
| The Internet |
|
|
+-------+---------------+
|
|
| (A)
|
|
+---+----------+
|
|
| Your Office +-----------+
|
|
+--------------+ (B) | +-----------+
|
|
+--+ Home |
|
|
(C) +-----------+
|
|
</pre></blockquote>
|
|
<BLOCKQUOTE>
|
|
The routers here are:
|
|
</BLOCKQUOTE>
|
|
<BLOCKQUOTE>
|
|
A your office's end of your link from your ISP,
|
|
<br>B your offices end of the link between your
|
|
office and your home,
|
|
<br>C your home's end of the link to your office
|
|
</BLOCKQUOTE>
|
|
<BLOCKQUOTE>
|
|
So there are five routing tables you care about.
|
|
</BLOCKQUOTE>
|
|
<BLOCKQUOTE>
|
|
Let's assume that they've given you 123.45.67.176
|
|
through 123.45.67.192 (a.k.a. the 123.45.67.176/240
|
|
network).
|
|
</BLOCKQUOTE>
|
|
<BLOCKQUOTE>
|
|
Let's presume that you and your ISP have followed common
|
|
conventions and assigned the first usable IP address
|
|
in your block to your router (A). That means that
|
|
(A) is 123.45.67.177. Therefore it would make sense
|
|
for the office to use the lower subnet (from 177 to 182)
|
|
Thus that subnet will have a netmask of 255.255.255.248
|
|
and a broadcast address of 123.45.67.183 (add 7 to
|
|
176) Remember, you only get six usable addresses out
|
|
of that mask since one is reserved for the network
|
|
(the "zero offset from your base) and the last address
|
|
(your base net address with a trailing sequence of
|
|
binary 1's).
|
|
</BLOCKQUOTE>
|
|
<BLOCKQUOTE>
|
|
So you pick an IP address for (B): lets call that
|
|
123.45.67.182 (the last usable address in your
|
|
lower subnet). You'll also need an address for (C)
|
|
123.45.67.185 (the first usable address in the
|
|
upper subnet). Actually all of these routers
|
|
will have multiple interfaces. The PPP (exterior)
|
|
interface to your ISP at (A) will usually have one
|
|
of the ISP's addresses. You can actually use any
|
|
RFC1918 address for your PPP link from (B) to (C)
|
|
since only B and C will use those addresses in
|
|
their routing tables. Let's call those PPP
|
|
endpoints 10.1.1.1 and 10.1.1.2
|
|
</BLOCKQUOTE>
|
|
<BLOCKQUOTE>
|
|
(I'm not sure but I think there's a way around
|
|
that in some TCP stacks but this should work).
|
|
</BLOCKQUOTE>
|
|
<BLOCKQUOTE>
|
|
Now the home system have to have a default route that
|
|
points to (C). (C) has a default route that points
|
|
to (B), and a network route that point to eth0
|
|
(the home network). That network route corresponds
|
|
to our upper subnet so it looks like:
|
|
</BLOCKQUOTE>
|
|
<BLOCKQUOTE><BLOCKQUOTE><CODE>
|
|
route add -net 123.45.67.84 netmask 255.255.255.248 eth0
|
|
</CODE></BLOCKQUOTE></BLOCKQUOTE>
|
|
<BLOCKQUOTE>
|
|
(A) and (B) also each a route that look similar. In
|
|
(B)'s case it looks like:
|
|
</BLOCKQUOTE>
|
|
<BLOCKQUOTE><BLOCKQUOTE><CODE>
|
|
route add -net 123.45.67.84 netmask 255.255.255.248 gw 10.1.1.2
|
|
</CODE></BLOCKQUOTE></BLOCKQUOTE>
|
|
<BLOCKQUOTE>
|
|
... (B) is listing (C) as the gateway to the upper
|
|
subnet. (C) lists ppp0 as its default route.
|
|
</BLOCKQUOTE>
|
|
<BLOCKQUOTE>
|
|
Finally there's (A) which lists (B) as its gateway
|
|
to the upper subnet and the ISPs address as its
|
|
default route.
|
|
</BLOCKQUOTE>
|
|
<BLOCKQUOTE>
|
|
The only tricky part is that all of the machines on
|
|
the office subnet should also know about the
|
|
subnet route to (B).
|
|
</BLOCKQUOTE>
|
|
<BLOCKQUOTE>
|
|
This is simplified slightly if (B) is actually
|
|
not a separate router, but merely an extra interface
|
|
on (A).
|
|
</BLOCKQUOTE>
|
|
<BLOCKQUOTE>
|
|
Of course there are many ways to do all of this.
|
|
When asking questions about routing --- draw a picture
|
|
and then go to each network and router (connecting point)
|
|
and ask what the routing tables must look like
|
|
from that location!
|
|
</BLOCKQUOTE>
|
|
|
|
<!-- sig -->
|
|
|
|
|
|
<!-- end 5 -->
|
|
<!--startcut ======================================================= -->
|
|
<P> <hr> <P>
|
|
<H5 align="center"><a href="http://www.linuxgazette.com/copying.html"
|
|
>Copyright ©</a> 2000, James T. Dennis
|
|
<BR>Published in <I>The Linux Gazette</I> Issue 51 March 2000</H5>
|
|
<H6 ALIGN="center">HTML transformation by
|
|
<A HREF="mailto:star@tuxtops.com">Heather Stern</a> of
|
|
Tuxtops, Inc.,
|
|
<A HREF="http://www.tuxtops.com/">http://www.tuxtops.com/</A>
|
|
</H6>
|
|
<P> <hr> <P>
|
|
<!-- begin tagnav ::::::::::::::::::::::::::::::::::::::::::::::::::-->
|
|
<TABLE WIDTH="95%"><TR VALIGN="center" ALIGN="center">
|
|
<TD colspan="2" rowspan="2"><A
|
|
HREF="../lg_answer51.html"
|
|
><IMG SRC="../../gx/dennis/answernew.gif"
|
|
ALT="[ Answer Guy Current Index ]"></A>
|
|
<TD colspan="2" rowspan="2"><A
|
|
HREF="../../tag/kb.html"
|
|
><IMG SRC="../../gx/dennis/answertoc.gif"
|
|
ALT="[ Index of Past Answers ]"></A></td>
|
|
<TD WIDTH="11%"><A HREF="../lg_answer51.html#greeting"><img
|
|
src="../../gx/dennis/smily.gif" alt="greetings" border="0"></A></TD>
|
|
<TD WIDTH="11%"><A HREF="1.html">1</A></TD>
|
|
<TD WIDTH="11%"><A HREF="2.html">2</A></TD>
|
|
<TD WIDTH="11%"><A HREF="3.html">3</A></TD>
|
|
<TD WIDTH="11%"><A HREF="4.html">5</A></TD>
|
|
</TR><TR VALIGN="center" ALIGN="center">
|
|
<TD WIDTH="11%"><A HREF="5.html">5</A></TD>
|
|
<TD WIDTH="11%"><A HREF="6.html">6</A></TD>
|
|
<TD WIDTH="11%"><A HREF="7.html">7</A></TD>
|
|
<TD WIDTH="11%"><A HREF="8.html">8</A></TD>
|
|
<TD WIDTH="11%"><A HREF="9.html">9</A></TD>
|
|
</TR><TR VALIGN="center" ALIGN="center">
|
|
<TD WIDTH="10%"><A HREF="10.html">10</A></TD>
|
|
<TD WIDTH="10%"><A HREF="11.html">11</A></TD>
|
|
<TD WIDTH="10%"><A HREF="12.html">12</A></TD>
|
|
<TD WIDTH="10%"><A HREF="13.html">13</A></TD>
|
|
<TD WIDTH="11%"><A HREF="14.html">14</A></TD>
|
|
<TD WIDTH="11%"><A HREF="15.html">15</A></TD>
|
|
<TD WIDTH="11%"><A HREF="16.html">16</A></TD>
|
|
<TD WIDTH="11%"><A HREF="17.html">17</A></TD>
|
|
</TR><TR VALIGN="center" ALIGN="center">
|
|
<TD WIDTH="10%"><A HREF="18.html">18</A></TD>
|
|
<TD WIDTH="10%"><A HREF="19.html">19</A></TD>
|
|
<TD WIDTH="10%"><A HREF="20.html">20</A></TD>
|
|
<TD WIDTH="10%"><A HREF="21.html">21</A></TD>
|
|
<TD WIDTH="11%"><A HREF="22.html">22</A></TD>
|
|
</TR></TABLE>
|
|
</TR><TR VALIGN="center" ALIGN="center">
|
|
<!-- end tagnav ::::::::::::::::::::::::::::::::::::::::::::::::::::-->
|
|
<P> <hr> <P>
|
|
<!-- begin lgnav ::::::::::::::::::::::::::::::::::::::::::::::::::: -->
|
|
<A HREF="../index.html"
|
|
><IMG SRC="../../gx/indexnew.gif" ALT="[ Table Of Contents ]"></A>
|
|
<A HREF="../../index.html"
|
|
><IMG SRC="../../gx/homenew.gif" ALT="[ Front Page ]"></A>
|
|
<A HREF="../lg_bytes51.html"
|
|
><IMG SRC="../../gx/back2.gif" ALT="[ Previous Section ]"></A>
|
|
<A HREF="../../faq/index.html"
|
|
><IMG SRC="../../gx/dennis/faq.gif"
|
|
ALT="[ Linux Gazette FAQ ]"></A>
|
|
<A HREF="../lg_tips51.html"
|
|
><IMG SRC="../../gx/fwd.gif" ALT="[ Next Section ]"></A>
|
|
<!-- end lgnav ::::::::::::::::::::::::::::::::::::::::::::::::::::: -->
|
|
<!-- ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -->
|
|
</BODY></HTML>
|
|
<!--endcut ========================================================= -->
|