LINK="#3366FF" VLINK="#A000A0">

"The Linux Gazette...making Linux just a little more fun!"


(?) The Answer Guy (!)


By James T. Dennis, tag@lists.linuxgazette.net
LinuxCare, http://www.linuxcare.com/


(?) Subnetting

From Berlin Tokugawa on Sun, 30 Jan 2000

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.

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.

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.

Berlin Tokugawa

(!) You should really draw an ASCII diagram of your network and include the IP addresses (even a fake set of consistent IP addresses) when you ask a question like this.
	+-----------------------+
	|     The Internet      |
	+-------+---------------+
                | (A)
            +---+----------+
            | Your Office  +-----------+
            +--------------+ (B)       |  +-----------+
                                       +--+  Home     |
                                      (C) +-----------+
The routers here are:
A your office's end of your link from your ISP,
B your offices end of the link between your office and your home,
C your home's end of the link to your office
So there are five routing tables you care about.
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).
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).
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
(I'm not sure but I think there's a way around that in some TCP stacks but this should work).
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:
route add -net 123.45.67.84 netmask 255.255.255.248 eth0
(A) and (B) also each a route that look similar. In (B)'s case it looks like:
route add -net 123.45.67.84 netmask 255.255.255.248 gw 10.1.1.2
... (B) is listing (C) as the gateway to the upper subnet. (C) lists ppp0 as its default route.
Finally there's (A) which lists (B) as its gateway to the upper subnet and the ISPs address as its default route.
The only tricky part is that all of the machines on the office subnet should also know about the subnet route to (B).
This is simplified slightly if (B) is actually not a separate router, but merely an extra interface on (A).
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!


Copyright © 2000, James T. Dennis
Published in The Linux Gazette Issue 51 March 2000
HTML transformation by Heather Stern of Tuxtops, Inc., http://www.tuxtops.com/


[ Answer Guy Current Index ] [ Index of Past Answers ] greetings 1 2 3 5
5 6 7 8 9
10 11 12 13 14 15 16 17
18 19 20 21 22


[ Table Of Contents ] [ Front Page ] [ Previous Section ] [ Linux Gazette FAQ ] [ Next Section ]