From owner-freebsd-questions Mon Jan 24 6:57:49 2000 Delivered-To: freebsd-questions@freebsd.org Received: from mail.eye2eye.co.za (mail.eye2eye.co.za [196.31.83.226]) by hub.freebsd.org (Postfix) with ESMTP id 4455514E78 for ; Mon, 24 Jan 2000 06:57:30 -0800 (PST) (envelope-from cataract@eye2eye.net) Received: from [192.168.62.150] (helo=optic.eye2eye.net) by mail.eye2eye.co.za with esmtp (Exim 3.12 #1) id 12Cn1o-00020n-00; Mon, 24 Jan 2000 17:11:48 +0000 Received: by OPTIC with Internet Mail Service (5.5.2448.0) id ; Mon, 24 Jan 2000 17:10:13 +0200 Message-ID: From: Michael Bartlett To: "'cjclark@home.com'" Cc: "'questions@freebsd.org'" Subject: RE: FW: internet gateway setup using NATD Date: Mon, 24 Jan 2000 17:10:07 +0200 MIME-Version: 1.0 X-Mailer: Internet Mail Service (5.5.2448.0) Content-Type: multipart/alternative; boundary="----_=_NextPart_001_01BF667D.1CAEEF10" Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG This message is in MIME format. Since your mail reader does not understand this format, some or all of this message may not be legible. ------_=_NextPart_001_01BF667D.1CAEEF10 Content-Type: text/plain; charset="iso-8859-1" Crist, Thanks for your response, maybe you could clear a couple of things up for me here... [eyeland] # ipfw list 01000 allow ip from any to any via lo0 01100 deny ip from 127.0.0.0/8 to 127.0.0.0/8 01500 divert 8668 ip from any to any via rl0 65000 allow ip from any to any 65535 deny ip from any to any I was under the impression that the # of the firewall rule is the order in which the rule is implemented (01000 will happen before 01100). If this is the case, do rules 65000 and 65535 not conflict each other? I cannot for the life of me find what is instigating rule 65535 on my box, nor can I delete it : [eyeland] # ipfw delete 65535 ipfw: rule 65535: setsockopt(IP_FW_DEL): Invalid argument > On one of my other boxes I run this script in /usr/local/etc/rc.d > > /sbin/natd -n fxp0 -redirect_port tcp 196.38.133.194:110 196.38.133.198:80 > /sbin/ipfw add divert natd all from any to any via fxp0 I have been previously told that it is "bad practise" to execute stuff like this in rc.d - but that has never been justified properly to me (I was told its not "pure"). Now in the abovementioned example this is my ipfw list: [messenger] # ipfw list 00100 divert 8668 ip from any to any via fxp0 65535 allow ip from any to any The difference between the two boxes is that the [messenger] box does not act as a gateway whereas the [eyeland] box does. We can see that the firewall rules are slightly different but otherwise I can't see anything glaringly obvious that is making this thing not work. And yes... >However, even if we assume >they are now OK, we can't say if there is a problem with natd. If you >call 196.31.83.226 directly on port 25, do you actually get to talk to >sendmail (or whatever MTA is supposed to be listening)? natd could be >working and we would not know it. Exim runs on port 25 and I'm not THAT dumb ;) Any clarity/advise/money will be greatly apprectiated! Cheers Mike -----Original Message----- From: owner-freebsd-questions@FreeBSD.ORG [mailto:owner-freebsd-questions@FreeBSD.ORG]On Behalf Of Crist J. Clark Sent: Sunday, January 23, 2000 5:50 AM To: Michael Bartlett Cc: 'questions@freebsd.org' Subject: Re: FW: internet gateway setup using NATD On Sat, Jan 22, 2000 at 03:05:31PM +0200, Michael Bartlett wrote: > Thought I'd throw this @ the list as well... > > -----Original Message----- > From: Michael Bartlett > Sent: Saturday, January 22, 2000 2:56 PM > To: 'Burke Gallagher' > Subject: RE: internet gateway setup using NATD > > > Hey Burke, > > Sorry to bug you again, but I'm having another problem and it could be > related to what you told me to do and could also prove interesting... > > On one of my other boxes I run this script in /usr/local/etc/rc.d > > /sbin/natd -n fxp0 -redirect_port tcp 196.38.133.194:110 196.38.133.198:80 > /sbin/ipfw add divert natd all from any to any via fxp0 > > If you are confused, the reason is that we needed to get around a firewall > problem (one of our consultants other company close 110 access on their > firewall - this way he can pickup his mail from us with port 80!! ;) ). > > Anyway, > > I tried the identical thing on my box with your settings and take a look... > > [eyeland] # /sbin/natd -n rl0 -redirect_port tcp 196.31.83.226:25 > 196.31.83.227:80 > [eyeland] # telnet 196.31.83.227 80 > Trying 196.31.83.227... > telnet: Unable to connect to remote host: Connection refused > > Now the .227 ip is an alias on rl0, so it should just be passed along the > same NIC and have no problems. I also tried the destination being on rl1 > (192.168.62.150:25) which is an smtp server on my local network and that > didn't work either. > > Any thoughts? Yes. First, don't start NATd from /usr/local/etc/rc.d. That is pretty much dead last in the startup process and could prevent lotsa stuff from being started properly in the ealier steps since the networking won't work. It also means that your divert to natd in the firewall is the last rule. Most likely, that will mess things up too (especially if you have a 'pass ip any to any' before it). In your second problem, it's really hard to say what is going on. Your firewall rules (with the divert) are suspect for the above reasons, so I would not be surprised if nothing works. However, even if we assume they are now OK, we can't say if there is a problem with natd. If you call 196.31.83.226 directly on port 25, do you actually get to talk to sendmail (or whatever MTA is supposed to be listening)? natd could be working and we would not know it. -- Crist J. Clark cjclark@home.com To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message ------_=_NextPart_001_01BF667D.1CAEEF10 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable RE: FW: internet gateway setup using NATD

Crist,

Thanks for your response, maybe you could clear a = couple of things up for me here...
[eyeland] # ipfw list
01000 allow ip from any to any via lo0
01100 deny ip from 127.0.0.0/8 to 127.0.0.0/8
01500 divert 8668 ip from any to any via rl0
65000 allow ip from any to any
65535 deny ip from any to any

I was under the impression that the # of the firewall = rule is the order in which the rule is implemented (01000 will happen = before 01100). If this is the case, do rules 65000 and 65535 not = conflict each other? I cannot for the life of me find what is = instigating rule 65535 on my box, nor can I delete it :

[eyeland] # ipfw delete 65535
ipfw: rule 65535: setsockopt(IP_FW_DEL): Invalid = argument

> On one of my other boxes I run this script in = /usr/local/etc/rc.d
>
> /sbin/natd -n fxp0 -redirect_port tcp = 196.38.133.194:110 196.38.133.198:80
> /sbin/ipfw add divert natd all from any to any = via fxp0

I have been previously told that it is "bad = practise" to execute stuff like this in rc.d - but that has never = been justified properly to me (I was told its not "pure"). = Now in the abovementioned example this is my ipfw list:

[messenger] # ipfw list
00100 divert 8668 ip from any to any via fxp0
65535 allow ip from any to any

The difference between the two boxes is that the = [messenger] box does not act as a gateway whereas the [eyeland] box = does. We can see that the firewall rules are slightly different but = otherwise I can't see anything glaringly obvious that is making this = thing not work.

And yes...

>However, even if we assume
>they are now OK, we can't say if there is a = problem with natd. If you
>call 196.31.83.226 directly on port 25, do you = actually get to talk to
>sendmail (or whatever MTA is supposed to be = listening)? natd could be
>working and we would not know it.

Exim runs on port 25 and I'm not THAT dumb ;)

Any clarity/advise/money will be greatly = apprectiated!

Cheers

Mike

-----Original Message-----
From: owner-freebsd-questions@FreeBSD.ORG
[mailto:owner-freebsd= -questions@FreeBSD.ORG]On Behalf Of Crist J. Clark
Sent: Sunday, January 23, 2000 5:50 AM
To: Michael Bartlett
Cc: 'questions@freebsd.org'
Subject: Re: FW: internet gateway setup using = NATD


On Sat, Jan 22, 2000 at 03:05:31PM +0200, Michael = Bartlett wrote:
> Thought I'd throw this @ the list as = well...
>
> -----Original Message-----
> From: Michael Bartlett
> Sent: Saturday, January 22, 2000 2:56 PM
> To: 'Burke Gallagher'
> Subject: RE: internet gateway setup using = NATD
>
>
> Hey Burke,
>
> Sorry to bug you again, but I'm having another = problem and it could be
> related to what you told me to do and could = also prove interesting...
>
> On one of my other boxes I run this script in = /usr/local/etc/rc.d
>
> /sbin/natd -n fxp0 -redirect_port tcp = 196.38.133.194:110 196.38.133.198:80
> /sbin/ipfw add divert natd all from any to any = via fxp0
>
> If you are confused, the reason is that we = needed to get around a firewall
> problem (one of our consultants other company = close 110 access on their
> firewall - this way he can pickup his mail from = us with port 80!! ;) ).
>
> Anyway,
>
> I tried the identical thing on my box with your = settings and take a look...
>
> [eyeland] # /sbin/natd -n rl0 -redirect_port = tcp 196.31.83.226:25
> 196.31.83.227:80
> [eyeland] # telnet 196.31.83.227 80
> Trying 196.31.83.227...
> telnet: Unable to connect to remote host: = Connection refused
>
> Now the .227 ip is an alias on rl0, so it = should just be passed along the
> same NIC and have no problems. I also tried the = destination being on rl1
> (192.168.62.150:25) which is an smtp server on = my local network and that
> didn't work either.
>
> Any thoughts?

Yes. First, don't start NATd from = /usr/local/etc/rc.d. That is pretty
much dead last in the startup process and could = prevent lotsa stuff
from being started properly in the ealier steps = since the networking
won't work. It also means that your divert to natd = in the firewall is
the last rule. Most likely, that will mess things up = too (especially
if you have a 'pass ip any to any' before = it).

In your second problem, it's really hard to say what = is going on. Your
firewall rules (with the divert) are suspect for the = above reasons, so
I would not be surprised if nothing works. However, = even if we assume
they are now OK, we can't say if there is a problem = with natd. If you
call 196.31.83.226 directly on port 25, do you = actually get to talk to
sendmail (or whatever MTA is supposed to be = listening)? natd could be
working and we would not know it.
--
Crist J. = Clark           &= nbsp;           &= nbsp;   cjclark@home.com


To Unsubscribe: send mail to = majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in = the body of the message

------_=_NextPart_001_01BF667D.1CAEEF10-- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message