Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > macOS > ipfw and port forwarding

ipfw and port forwarding
Thread Tools
cwasko
Senior User
Join Date: Jul 2000
Status: Offline
Reply With Quote
Aug 27, 2003, 08:07 AM
 
I thought I could use ipfw for this, but for the life of me, I can't figure it out. Other suggestions would be wonderful.

I use EIMS for OSX as my mail server. I want to setup and ADDITIONAL port to use for SMTP. I'd like to have EIMS listen on 25, and 1025 but, EIMS can only be configured to run on a single port for smtp. I figure that I could setup some rule in ipfw that would take all incoming requests on port 1025 and forward them to 25 instead (even if I have to do this on a per IP basis, I'm good with that).

I've looked into using 'divert', but it forwards ALL request to a single port. The 'fwd' command looks like what I want, but it doesn't seem to work, or at least not in the manner I think it should .

Any suggestions on how to do this with what is installed on OSXS? Or, do I have to use a real proxy app like squid or something? I figured this would be easier than it is turning out to be.
     
cwasko  (op)
Senior User
Join Date: Jul 2000
Status: Offline
Reply With Quote
Aug 27, 2003, 09:06 AM
 
Well, I've got a few solutions. First off, EIMS has a way to do an additional port. Its the 'smtp submission' port in the Prefs. This is defaulted to 587.

Next, I found a simple little util that will do exactly what I want:

http://sourceforge.net/projects/simpleproxy/

Usage for my case:

# simpleproxy -L 1025 -R localhost:25 &

It compiled with no problems on OSX 10.2 and OSXS 10.2.
     
Arkham_c
Mac Elite
Join Date: Dec 2001
Location: Atlanta, GA, USA
Status: Offline
Reply With Quote
Aug 27, 2003, 09:11 AM
 
Another solution is to use SSH port forwarding. Requires no additional software.

Something like this should work:


Code:
ssh -f -g -L 1025:localhost:25 localhost "while true ; do sleep 100; done"
SSH port forwarding is useful in a lot of ways. This is a pretty trivial example but it would suit your needs.
Mac Pro 2x 2.66 GHz Dual core, Apple TV 160GB, two Windows XP PCs
     
Jellytussle
Dedicated MacNNer
Join Date: Jan 2001
Location: Badfort
Status: Offline
Reply With Quote
Aug 27, 2003, 09:12 AM
 
You could also use xinetd, with a divert. see http://www.afp548.com/Articles/Jagua...redirect.html.
You see, my friends, pirates are the key. - thalo
     
cwasko  (op)
Senior User
Join Date: Jul 2000
Status: Offline
Reply With Quote
Aug 28, 2003, 12:01 AM
 
Excellent, thanks for the great tips. I got this from another source:

% sudo ipfw add fwd 192.168.1.1,25 tcp from any to 192.168.1.1 1025 in

I was mixing up the ports. I inverted the 1025 and 25 so it didn't work. I didn't even thing to do this... ugh.
     
   
 
Forum Links
Forum 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
Top
Privacy Policy
All times are GMT -4. The time now is 01:32 PM.
All contents of these forums © 1995-2017 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.8 © 2000-2017, Jelsoft Enterprises Ltd.,