[comp.sys.sun] How do I subnet a class B network

jmorris@mwunix.mitre.org (John R. Morris) (09/02/90)

Hi; I am fairly new to Unix and Suns and the "Net" so please bear with me.
I have a couple questions about subnetting.

I have some 4/110s and one 4/280 which were on a class B network.  The
4/280 now has two ethernet interfaces and I want to make it a router,
isolating all of my machines from the class B network.  I can't seem to do
it correctly and Sun-support is not very fast/helpful answering questions.
So I found out that this net has thousands of sun-gurus...

Anyway,
-------|                        |---------
       |                        |
       |     ----------         |
rest         |        |               my
 of    ------|sun4/280|----------   little
world        |        |             corner
  B    |     ----------         |     C
       |                        |
-------|                        |---------

On the 4/280 (running Sun OS 4.1) can I do the following:?
	ie0 (rest of world, Class B)
		inet 128.29.22.1 netmask 255.255.0.0 broadcast 128.29.255.255
	ie1 (my little corner, Class C?)
		inet 128.29.22.7 netmask 255.255.255.0 broadcast 128.29.22.255

If not, why?  Should I change the IP address on the class B side to
128.29.23.1  I'm told I should change the netmask to 255.255.255.0 on both
sides but I don't know why.  Then, what should my routing look like?  Why
is the following wrong?

Routing tables
Destination          Gateway              Flags    Refcnt Use  Interface
127.0.0.1            127.0.0.1            UH       1      26         lo0
default              Outside gateway      UG       lots   lots       ie1
129.83.0.0           128.29.22.1          U        0      100        ie1
128.29.22.0          128.29.22.7          U        27     19396      ie0
128.29.0.0           128.29.22.1          U        0      2          ie1

Any response besides comments on my compentency would be very appreciated.
	Thanks in advance
						John Morris
PS.  I'm  jmorris@mwunix.mitre.org (if I need to add that).

jms@tardis.tymnet.com (Joe Smith) (10/08/90)

In article <1990Sep4.232423.17162@rice.edu> jmorris@mwunix.mitre.org (John R. Morris) writes:
>I have some 4/110s and one 4/280 which were on a class B network.  The
>4/280 now has two ethernet interfaces and I want to make it a router,
>isolating all of my machines from the class B network.  I can't seem to do
>it correctly and Sun-support is not very fast/helpful answering questions.
>-------|                        |---------
>       |     ----------         |
>rest         |        |               my
> of    ------|sun4/280|----------   little
>world        |        |             corner
>  B    |     ----------         |     C
>-------|                        |---------
>
>On the 4/280 (running Sun OS 4.1) can I do the following:?
>	ie0 (rest of world, Class B)
>		inet 128.29.22.1 netmask 255.255.0.0 broadcast 128.29.255.255
>	ie1 (my little corner, Class C?)
>		inet 128.29.22.7 netmask 255.255.255.0 broadcast 128.29.22.255
>If not, why?  Should I change the IP address on the class B side to
>128.29.23.1  I'm told I should change the netmask to 255.255.255.0 on both
>sides but I don't know why.  

Purpose of netmask:  When a packet is destined for an IP address and the
local host has multiple IP interfaces, the netmask is used to determine
which interface to send the packet to.  

  foreach interface do
    network1 = destination_address AND interface_netmask
    network2 = interface_address AND interface_netmask
    if ( network1 equals network2 ) then
      send packet though this interface
      break out of loop
    endif
  endfor
  no match, go consult the routing tables.

With ie0 having a netmask of 255.255.0.0, then all addresses in the form
of 128.29.*.* will match, and nothing nothing will go out ie1.  Simply
setting setting ie1's host address to 128.29.23.1 won't help; that address
still matches 128.29.*.*.  

You will have to set the netmask on both interfaces to 255.255.255.0.
This will make addresses in the form 128.28.22.* go to ie0, addresses in
the form 128.28.23.* go to ie1, and all other addresses will be compared
against the routing tables.  This last part includes addresses valid on
your class B network (such as 128.28.19.*) as well as addresses outside
your network (such as 128.83.*.*).

The route daemon does its thing automatically when it detects more than
one IP interface; you don't have to do anything other than set the network
address and netmask up properly.

Joe Smith (408)922-6220 | SMTP: jms@tardis.tymnet.com or jms@gemini.tymnet.com
BT Tymnet Tech Services | UUCP: ...!{ames,pyramid}!oliveb!tymix!tardis!jms
PO Box 49019, MS-C41    | BIX: smithjoe | 12 PDP-10s still running! "POPJ P,"
San Jose, CA 95161-9019 | humorous dislaimer: "My Amiga speaks for me."

boyter@uunet.uu.net (Maj Brian Boyter) (10/08/90)

jmorris@mwunix.mitre.org (John R. Morris) writes:
>I have some 4/110s and one 4/280 which were on a class B network.  The
>4/280 now has two ethernet interfaces and I want to make it a router,

>On the 4/280 (running Sun OS 4.1) can I do the following:?
>	ie0 (rest of world, Class B)
>		inet 128.29.22.1 netmask 255.255.0.0 broadcast 128.29.255.255
>	ie1 (my little corner, Class C?)
>		inet 128.29.22.7 netmask 255.255.255.0 broadcast 128.29.22.255


John, I was holding up on answering your query, waiting for someone who is
a true guru to come to the rescue...   But I haven't seen an answer posted
by anyone else...  Anyway, here's my idea of what a "normal" Class-B
network would look like:

            |
       -----------
       | gateway | (e.g. gateway to nsfnet)
       -----------
            |128.29.22.1
            |                     backbone
 _____________________________________________________
     |                    |                   |
     |subnet#1            |subnet#2           |subnet#3
     |                    |                   |
     |                    |                   |
     |128.29.22.2         |128.29.22.3        |128.29.22.4
 --------             --------            --------
 |router|             |router|            |router|
 --------             --------            --------
     |128.29.23.1         |128.29.24.1        |128.29.25.1
     |                    |                   |
     | ------             | ------            | ------
     |-|host|             |-|host|            |-|host|
     | ------             | ------            | ------
     | 128.29.23.2        | 128.29.24.2       | 128.29.25.2
     |                    |                   |

I would use a netmask of 255.255.255.0 on both sides of the routers...  If
the routers are running routed, or some other routing algorithm, then the
routers will learn the routes to the other subnets...    If not, you can
manually install routes to the other subnets using route(8).  I would put
the these manual routes in the rc.local...  For example, if the gateway
didn't talk the right routing protocol to the router, you could just put:
route add default 128.29.22.1 2 in the rc.local to provide that missing
route....

 I hope this helps,
 Brian

   Maj. Brian A Boyter

   boyter@fstc-chville.army.mil                      ||