Networking Forums

Networking Forums > Computer Networking > Linux Networking > Subnetting/Routing

Reply
Thread Tools Display Modes

Subnetting/Routing

 
 
Chris Rennert
Guest
Posts: n/a

 
      05-10-2005, 01:42 PM
Hey all,

I have an office situation where I am just about using up all my
192.168.1.0/24 addresses. I would like to start another network using
192.168.2.0/24 addresses, but also give those addresses the ability to
access computers on the 192.168.1.0/24 network. I believe a router is
teh way I want to go, and I have a linux box set up with 2 nics and I am
try to get it set up to allow that traffic through, but really I am at
a loss. Could somebody point me in the right direction of what how-tos
I should read. Or examples I could follow? Any help would be greatly
appreciated!

Thanks

Chris
 
Reply With Quote
 
 
 
 
Rainer Krienke
Guest
Posts: n/a

 
      05-10-2005, 02:06 PM
Chris Rennert wrote:

> Hey all,
>
> I have an office situation where I am just about using up all my
> 192.168.1.0/24 addresses. I would like to start another network using
> 192.168.2.0/24 addresses, but also give those addresses the ability to
> access computers on the 192.168.1.0/24 network. I believe a router is
> teh way I want to go, and I have a linux box set up with 2 nics and I am
> try to get it set up to allow that traffic through, but really I am at
> a loss. Could somebody point me in the right direction of what how-tos
> I should read. Or examples I could follow? Any help would be greatly
> appreciated!


Simply configure the two nics in your linux box and then tell it to forward
packets from one interface to the other if needed (so both networks are
connected). This is done by advising linux to do ip forwarding. By doing
this your linux box acts as a router.

To enable ip forwarding say:

echo 1 > /proc/sys/net/ipv4/ip_forward

This has to set each time you boot the machine, so put it in some
init-script or something like this.

Info about this can be found in several Networking howtows and
in /usr/src/linux/Documentation/networking/*

Have a nice day
Rainer
 
Reply With Quote
 
Chris Rennert
Guest
Posts: n/a

 
      05-10-2005, 03:26 PM
Rainer Krienke wrote:
> Chris Rennert wrote:
>
>
>>Hey all,
>>
>>I have an office situation where I am just about using up all my
>>192.168.1.0/24 addresses. I would like to start another network using
>>192.168.2.0/24 addresses, but also give those addresses the ability to
>>access computers on the 192.168.1.0/24 network. I believe a router is
>>teh way I want to go, and I have a linux box set up with 2 nics and I am
>> try to get it set up to allow that traffic through, but really I am at
>>a loss. Could somebody point me in the right direction of what how-tos
>>I should read. Or examples I could follow? Any help would be greatly
>>appreciated!

>
>
> Simply configure the two nics in your linux box and then tell it to forward
> packets from one interface to the other if needed (so both networks are
> connected). This is done by advising linux to do ip forwarding. By doing
> this your linux box acts as a router.
>
> To enable ip forwarding say:
>
> echo 1 > /proc/sys/net/ipv4/ip_forward
>
> This has to set each time you boot the machine, so put it in some
> init-script or something like this.
>
> Info about this can be found in several Networking howtows and
> in /usr/src/linux/Documentation/networking/*
>
> Have a nice day
> Rainer

Ok, from a PC on the 192.168.0.0/24 network I can ping 192.168.1.1 and
192.168.0.1 with are the 2 nics on the Router. From a PC on the
192.168.1.0/24 network I can ping 192.168.1.1 , but not 192.168.0.1.
From the router I can ping every box on either network, and get to the
internet (192.168.1.200 is my gateway to the Inet). I have enabled IP
forwarding, and restarted and added the /proc/net/sys/ipv4/ip_forwarding
to my rc.local file.

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 0 eth1
192.168.0.0 192.168.1.1 255.255.255.0 UG 0 0 0 eth1
192.168.0.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
127.0.0.0 0.0.0.0 255.0.0.0 U 0 0 0 lo
0.0.0.0 192.168.1.200


Thanks again for your help, I am not sure what to do next, I am also
going through the doc you pointed me to.

thanks

Chris
 
Reply With Quote
 
Raqueeb Hassan
Guest
Posts: n/a

 
      05-10-2005, 03:44 PM
> have an office situation where I am just about using up all my
>192.168.1.0/24 addresses. I would like to start another network using


>192.168.2.0/24 addresses, but also give those addresses the ability to


> access computers on the 192.168.1.0/24 network.


<snip>

Just install a router (linux box) and add two nics and assign ip
addresses from both the networks.

.... and you might like to add this command on that router machine
when accessing 192.168.2.0/24 from 192.168.1.0/24 network.

#route add -net 192.168.2.0 netmask 255.255.255.0 gw 192.168.1.1

or using iproute2

#ip route add 192.168.2.0/24 via 192.168.1.1.

Well, I wouldn't miss reading little more at http://linux-ip.net/html/.

HTH

--

Raqueeb Hassan
Bangladesh

 
Reply With Quote
 
Benway
Guest
Posts: n/a

 
      05-10-2005, 04:03 PM
On Tue, 10 May 2005 08:42:07 -0500, Chris Rennert
<(E-Mail Removed)> wrote:

>Hey all,
>
>I have an office situation where I am just about using up all my
>192.168.1.0/24 addresses. I would like to start another network using
>192.168.2.0/24 addresses, but also give those addresses the ability to
>access computers on the 192.168.1.0/24 network. I believe a router is
>teh way I want to go, and I have a linux box set up with 2 nics and I am
> try to get it set up to allow that traffic through, but really I am at
>a loss. Could somebody point me in the right direction of what how-tos
>I should read. Or examples I could follow? Any help would be greatly
>appreciated!
>
>Thanks
>
>Chris


If you don't mind changing a few NIC configs you can do it with a
netmask change.

E.G. If you take an NIC with 192.168.1.1/255.255.255.0 and change the
netmask to 255.255.254.0 it will be able to access 192.168.0 and
192.168.1 with no router.


--
Benway
Remove the SPAM
 
Reply With Quote
 
Floyd L. Davidson
Guest
Posts: n/a

 
      05-10-2005, 08:18 PM
Chris Rennert <(E-Mail Removed)> wrote:
>Ok, from a PC on the 192.168.0.0/24 network I can ping
>192.168.1.1 and 192.168.0.1 with are the 2 nics on the Router.
>From a PC on the 192.168.1.0/24 network I can ping 192.168.1.1 ,
>but not 192.168.0.1. From the router I can ping every box on
>either network, and get to the internet (192.168.1.200 is my
>gateway to the Inet). I have enabled IP forwarding, and
>restarted and added the /proc/net/sys/ipv4/ip_forwarding to my
>rc.local file.


You'll also need to have the right routing on each and
every box.

>Destination Gateway Genmask Flags Metric Ref
>Use Iface
>192.168.1.0 0.0.0.0 255.255.255.0 U 0 0 0 eth1
>192.168.0.0 192.168.1.1 255.255.255.0 UG 0 0 0 eth1
>192.168.0.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
>127.0.0.0 0.0.0.0 255.0.0.0 U 0 0 0 lo
>0.0.0.0 192.168.1.200


You didn't say which box this is, but I assume it is the Linux
router, and if so it explains why it isn't working.

Assuming the router's eth0 NIC is assigned 192.168.0.1 and the
eth1 NIC is assigned 192.168.1.1, here's what the router's table
needs to look like:

192.168.0.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
192.168.1.0 0.0.0.0 255.255.255.0 U 0 0 0 eth1
127.0.0.0 0.0.0.0 255.0.0.0 U 0 0 0 lo
0.0.0.0 192.168.1.200

1) Every IP address in the 192.168.0.n range goes to eth0.
2) Every IP address in the 192.168.1.n range goes to eth1.
3) Every IP address in the 127.n.n.n range goes to lo.
4) All other IP addresses are sent to 192.168.1.200 on eth1.

Every box on the physical network that eth0 is connected to must
have an IP address in the 192.168.0.n range, and every box on
the physical network that eth1 is connected to must have an IP
address in the 192.168.1.n range.

Each box on the 192.168.0.n subnet must have routing which looks
like this (assuming the NIC on each box is eth0, though it could
be otherwise),

192.168.0.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
192.168.1.0 192.168.0.1 255.255.255.0 U 0 0 0 eth0
127.0.0.0 0.0.0.0 255.0.0.0 U 0 0 0 lo
0.0.0.0 192.168.1.200

For a box with this routing, any packets sent to an address in
the range 192.168.0.n will cause an attempt to match a MAC address
on the Ethernet to the destination IP address. If there is no
match, an error is reported. If there is a match, the packet is
put on the wire with the MAC address that matched.

And packets sent to an address in the range of 192.168.1.n will
cause the MAC address association to be made with 192.168.0.1
rather than the destination IP address. Since there is a route
to 192.168.0.1 (the router) the MAC address for the router will
be matched and the packets put on the Ethernet addressed to the
router.

All IP addresses which are not matched in the route table will
be matched to the MAC address of the host assigned the
192.168.1.200 IP address.

Each box on the 192.168.1.n subnet must have routing which looks
like this,

192.168.0.0 192.168.1.1 255.255.255.0 U 0 0 0 eth0
192.168.1.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
127.0.0.0 0.0.0.0 255.0.0.0 U 0 0 0 lo
0.0.0.0 192.168.1.200

This is essentially the same as the above, of course, with the
two physical networks swapped.

The above means that IP addresses in the subnet range for each
of the two subnets is sent directly to the addressed host on
the physical net, while any IP address in the other subnet range
will be sent to the router's interface on the physical net (with
the expectation that it will be forwarded onto the other physical
network).

You can also do odd things, such as use addresses that are not
in the appropriate ranges... but if you do there will have to be
a route table entry to match on *every* machine. Hence if you
put 192.168.0.201 on the router's eth1 physical network, a host
route (which is a network route with a netmask of
255.255.255.255) will be necessary to allow the router to find
it. The router would need an entry like this:

192.168.0.201 0.0.0.0 255.255.255.255 ... eth1

And every host on the 192.168.0.n physical net would need an
entry like this,

192.168.0.201 192.168.0.1 255.255.255.255 ... eth0

While every host on the 192.168.1.n physical net would need an
entry like this,

192.168.0.201 0.0.0.0 255.255.255.255 ... eth0


Another couple odd comments seem in order. You mentioned the
reason you split the physical network was a lack of IP
addresses. You could just more easily add more addresses to the
physical network and then you don't need forwarding.

Where each host has a route table entry that looks like this,

192.168.0.0 0.0.0.0 255.255.255.0 ... eth0

add another one like this:

192.168.1.0 0.0.0.0 255.255.255.0 ... eth0

And you can now have 500+ IP addresses on the same physical
network. Of course actually having that many hosts might also
serious congestion, so it isn't recommended unless you have an
unusual situation. My point is that the *number* of IP
addresses is not a reason to split a network. The amount of
traffic, or a need to isolate some hosts from others, would be
valid reasons.

If you actually have few machines, but are assigning IP
addresses in blocks (which might not all actually be used at any
given time), you can, for example, access the entire 192.168.n.n
range by using a netmask of 255.255.0.0 for route table entries.
There is a lot of flexibility available... and even more if you
go to the 10.n.n.n address range.

--
Floyd L. Davidson <http://web.newsguy.com/floyd_davidson>
Ukpeagvik (Barrow, Alaska) (E-Mail Removed)
 
Reply With Quote
 
Wolf
Guest
Posts: n/a

 
      05-10-2005, 11:21 PM
"Chris Rennert" <(E-Mail Removed)> wrote in message
news:4280b968$0$45812$(E-Mail Removed). ..
> Hey all,
>
> I have an office situation where I am just about using up all my
> 192.168.1.0/24 addresses. I would like to start another network using
> 192.168.2.0/24 addresses, but also give those addresses the ability to
> access computers on the 192.168.1.0/24 network. I believe a router is
> teh way I want to go, and I have a linux box set up with 2 nics and I am
> try to get it set up to allow that traffic through, but really I am at
> a loss. Could somebody point me in the right direction of what how-tos
> I should read. Or examples I could follow? Any help would be greatly
> appreciated!


The right solution is to move to an RFC 1918 Class B.

What you can try doing is reconfiguring the network to 192.168.0.0/22. You
waste
some space (subnetting does that) but think of it as room to grow without
having to
make more changes.

network 192.168.0.0
bcast 192.168.3.255
netmask 255.255.252.0

--
Wolf
----------------------------------------------------------------
Please post all responses to UseNet. All email cheerfully and automagically
routed to Dave Null


 
Reply With Quote
 
James Knott
Guest
Posts: n/a

 
      05-11-2005, 01:05 PM
Chris Rennert wrote:

> Hey all,
>
> I have an office situation where I am just about using up all my
> 192.168.1.0/24 addresses. I would like to start another network using
> 192.168.2.0/24 addresses, but also give those addresses the ability to
> access computers on the 192.168.1.0/24 network. I believe a router is
> teh way I want to go, and I have a linux box set up with 2 nics and I am
> try to get it set up to allow that traffic through, but really I am at
> a loss. Could somebody point me in the right direction of what how-tos
> I should read. Or examples I could follow? Any help would be greatly
> appreciated!


If all the computers are on the same network, just change the subnet mask
from /24 to /23, which will allow both 192.168.1.x and 192.168.2.x on the
same lan segment.

 
Reply With Quote
 
James Knott
Guest
Posts: n/a

 
      05-11-2005, 01:09 PM
Wolf wrote:

> The right solution is to move to an RFC 1918 Class B.
>


The right solution, is to learn what a subnet mask is for. Currently it's
255.255.255.0. Change it to 255.255.254.0 and all computers will be able
to access the range from 192.168.0.0 to 192.168.1.255.

 
Reply With Quote
 
James Knott
Guest
Posts: n/a

 
      05-11-2005, 01:10 PM
James Knott wrote:

> If all the computers are on the same network, just change the subnet mask
> from /24 to /23, which will allow both 192.168.1.x and 192.168.2.x on the
> same lan segment.


Correction.

That should be 192.168.0.x and 192.168.1.x
 
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
re-subnetting Jeff Windows Networking 1 04-11-2006 02:42 PM
Subnetting Test Windows Networking 2 11-19-2004 02:29 PM
VPN Subnetting =?Utf-8?B?Rm93YXJk?= Windows Networking 6 07-30-2004 12:45 AM
IP Routing & Subnetting Neil Windows Networking 5 05-12-2004 03:01 PM
Subnetting AC Linux Networking 0 07-17-2003 10:48 PM



1 2 3 4 5 6 7 8 9 10 11