🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: alt.os.linux.suse
Article #226

Re: iptables/routing and DMZ's

#226
From: Cedric Blancher
Date: Fri, 12 Oct 2001 07:44
75 lines
4026 bytes
Dans sa prose, alex (ntnewsNOSPAM@hrz3.hrz.tu-darmstadt.de) nous ecrivait :
> i get from my isp 16 addresses this can only be done by a subnet
> 255.255.255.240 (210.2.5.16-31) - i think so!? if i am wrong - please
> correct me... and please tell my why (newbie :-((( ). this is the situation
> i'm in - and i need to workaround - how ever!

16 address is not much I agree, and it would be too bad to waste them in
massive subnetting...

> can i change the subnetmask without telling this my isp? realy i haven't

Yeah sure ! As long as your subnets does not use addresses that haven't been
given to you, you can.

> anytime worked with calculating ip subnets... and haven't deep tcpip
> knowledge :-((( one of my greatest problems...

Check Freshmeat for ip subnet calculators.
Just a tip : you need N addresses in your subnet, mask is 255.255.255.(256-N).
N must be 2^x (I do not know how to say that in english :/).
You need 4 : 255.255.255.252
You nedd 16 : 255.255.255.240
You need 30 : not possible, 30 <> 2^x. Must use 32 = 2^5 : 255.255.255.224
See what I am trying to mean ?

> am i right and will this be working if i will change this to
> eth0 = 210.2.5.17 / 255.255.255.252 - (210.2.5.16-19)

OK.

> eth1 = 210.2.5.20 / 255.255.255.248 - (210.2.5.16-23)

Not OK. As you can see, this subnet is covering the other one before. Use
255.255.255.252 mask to have 210.2.5.20-23.

> eth2 = 210.2.5.24 / 255.255.255.248 - (210.2.5.24-31)

OK, and all is fine.

> hm... looks wrong... eth0 and eth1 having overlapping ip's... in eth0 .19 is
> broadcast adress and in eth1 the .23 - this looks like only 2 hosts in
> dmz... shit...

As I said, it is fine, but, for a given subnet, you must have one network
address and one broadcast address, which means you have lost 6 addresses in
the subnetting process (210.2.5.16,19,20,23,24,31).

Another approach is to use NAT in such a way :

210.2.5.16/28 --eth0-- Box --eth1-- DMZ1, RFC1918 : 192.168.1.0/24
			|
			|__eth2____ DMZ2, RFC1918 : 192.168.2.0/24

So, you established full NAT rules, one public IP to one private IP, on
the DMZ you need. I don't have your needs anymore in mind, but, if you
want to have 210.2.5.21 on DMZ1, you can use a rule like this one :

iptables -t nat -A PREROUTING -i eth0 -d 210.2.5.21 -j DNAT --to 192.168.1.21

For one on DMZ2 :

iptables -t nat -A PREROUTING -i eth0 -d 210.2.5.27 -j DNAT --to 192.168.2.27

And if your server needs to initiate connections to the real world :

iptables -t nat -A POSTROUING -o eth0 -s 192.168.2.27 -j SNAT --to 210.2.5.27


Such a way, you can keep your whole subnet in front, and redirect IPs where
you want your servers to stand.

-- 
BOFH excuse #34:

(l)user error
Technical Details
Message-ID: <slrn9sd7qn.i0.blancher@elendil.intranet.cartel-info.fr>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news.tele.dk!small.news.tele.dk!213.56.195.71!fr.usenet-edu.net!usenet-edu.net!oleane.net!oleane!nnrp.oleane.net!not-for-mail
References: <9q3qa9$tbr$06$1@news.t-online.com> <3BC5D700.8040408@ntlworld.com> <9q4vv7$csk$00$1@news.t-online.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 1041dd,b373d989fc833e9e
X-Google-Attributes: gid1041dd,public
X-Google-Thread: f4b73,b373d989fc833e9e
X-Google-Attributes: gidf4b73,public
X-Google-Thread: 10669a,b373d989fc833e9e
X-Google-Attributes: gid10669a,public
X-Google-ArrivalTime: 2001-10-12 00:45:04 PST
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news.tele.dk!small.news.tele.dk!213.56.195.71!fr.usenet-edu.net!usenet-edu.net!oleane.net!oleane!nnrp.oleane.net!not-for-mail
From: Cedric Blancher <blancher@cartel-info.fr>
Newsgroups: alt.os.linux.suse,ch.comp.os.linux,comp.os.linux.networking
Subject: Re: iptables/routing and DMZ's
Followup-To: comp.os.linux.networking
Date: Fri, 12 Oct 2001 07:44:24 +0000 (UTC)
Organization: Cartel Informatique
Lines: 75
Message-ID: <slrn9sd7qn.i0.blancher@elendil.intranet.cartel-info.fr>
References: <9q3qa9$tbr$06$1@news.t-online.com> <3BC5D700.8040408@ntlworld.com> <9q4vv7$csk$00$1@news.t-online.com>
NNTP-Posting-Host: apollo.cartel-info.fr
X-Trace: s1.read.news.oleane.net 1002872664 9523 194.3.136.11 (12 Oct 2001 07:44:24 GMT)
X-Complaints-To: abuse@oleane.net
NNTP-Posting-Date: Fri, 12 Oct 2001 07:44:24 +0000 (UTC)
User-Agent: slrn/0.9.7.2 (Linux)