router + linux firewall = subnet ?

router + linux firewall = subnet ?

Post by <j.. » Sat, 19 Jul 1997 04:00:00



Hello everyone,

I'm trying to set up the system below:

        | Router | --------- (out) {Linux FireWall} (in)  ------- {Internal
Machines}
I have a valid class C address for the setup, with the router being  C.1; I
don't need masquarading since all I need the linux box to do is packet
filtering.

What I would like to do is assign C.2 and C.3 to the (out) and (in),
respectively, of the linux box - and the rest of the addresses C.4 - C.254
to the Internal Machines. I've read all the faqs, how-tos, etc but it's not
clear to me that it's possible since:

1. If I configure eth0\(out)\C.2\255.255.255.0\C mask\  and then
eth1\(in)\C.3\255.255.255.0\C mask\ the routing will be completely messed
up. Both interfaces will point to the same Class C net!

It seems as though the only ways to do it would be to:

1. Subnet the Class C into 2 subclasses with 0-128 in front of linux and
128-255 behind linux. The problem is that you either loose 128 classes or
you use them but don't protect them with the linux box.

2. Use a non-routable net behind the linux box and then use  masquarading
with ipautofw  to forward any ports from the outside in. But this
overcomplicates the setup needlessly.

3. The last option (and I don't know if it even works) is to change the IPs
and net of the router and (out) interface of Linux to a nonroutable one
(ie, 192.168.0.1, router,  and 192.168.0.2, linux). Then play with the
routing tables on the linux box to add a default route, for outbound
traffic, for eth1 (inside if) to 192.168.0.2 (that of eth1)  and then a
default route of 192.168.0.1 for eth0. For its part the router .... and
here it gets complicated really quick.

I have a feeling that I'm overcomplicating things and that the solution is
right in front of me. Does anyone have any thoughts ? Has anyone
implemented fixed, routable class C packet filtering going through a router
?

Any help or thoughts are greatly appreciated.

Thanks!

 
 
 

router + linux firewall = subnet ?

Post by James Youngma » Wed, 23 Jul 1997 04:00:00



> I'm trying to set up the system below:

>    | Router | --------- (out) {Linux FireWall} (in)  ------- {Internal
> Machines}
> I have a valid class C address for the setup, with the router being  C.1; I
> don't need masquarading since all I need the linux box to do is packet
> filtering.

> What I would like to do is assign C.2 and C.3 to the (out) and (in),
> respectively, of the linux box - and the rest of the addresses C.4 - C.254
> to the Internal Machines. I've read all the faqs, how-tos, etc but it's not
> clear to me that it's possible since:

<snip>

No, if you want the firewall to route between two subnets, the two
subnets have to be different, that is, (out) and (in) must be on
different subnets.

 
 
 

router + linux firewall = subnet ?

Post by Brian McCaule » Wed, 30 Jul 1997 04:00:00



>    | Router | --------- (out) {Linux FireWall} (in)  ------- {Internal
> Machines}
> I have a valid class C address for the setup, with the router being  C.1; I
> don't need masquarading since all I need the linux box to do is packet
> filtering.

> What I would like to do is assign C.2 and C.3 to the (out) and (in),
> respectively, of the linux box - and the rest of the addresses C.4 - C.254
> to the Internal Machines.

If you don't care about loosing broadcasts:

ifconfig eth0 C.2 netmask 255.255.255.255
route add -host C.1 dev eth0
ifconfig eth1 C.3 netmask 255.255.255.0
route add -net C.0 # Omit on 2.1.x kernels.

arp -Ds C.1 eth1 pub
arp -Ds C.0 eth0 netmask 255.255.255.0 pub

Note: on 2.1.x the two proxy ARP commands can combine into one:

arp -s C.0 00:00:00:00:00:00 netmask 255.255.255.0 pub

Note: this is one of the few cases where eth0 and eth1 can safely have
the same IP addres, i.e. both could be C.2 without a clash.

--

 .  _\\__[oo       from       | Phones: +44 121 471 3789 (home)

.  l___\\    /~~) /~~[  /   [ | PGP-fp: D7 03 2A 4B D8 3A 05 37...
 # ll  l\\  ~~~~ ~   ~ ~    ~ | http://wcl-l.bham.ac.uk/~bam/