LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Security
User Name
Password
Linux - Security This forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here.

Notices


Closed Thread
  Search this Thread
Old 10-12-2006, 04:08 AM   #1
^vampire^
LQ Newbie
 
Registered: Oct 2006
Posts: 2

Rep: Reputation: 0
Port Forwarding Problem using IPTABLES


Hello!
Please.. I need help.

I have a problem with setting up my iptables.
I need to forward port 80 and other useful ports to my local machine.
Aside from port forwarding, i also configured NAT for other PCs in my local
network to access the internet. NAT works fine except for my port forward.
I just get confused because other ports being forwarded works just fine. e.g
port 25(stmp) but just can't forward port 80. I think the problem is with the
return packets that is forwarded back into my server.

Below is the complete script running in my linux box... please help. there should be something wrong with my script.

Thanks!!...

#!/bin/sh
#Load NAT module

modprobe ip_tables

modprobe ip_conntrack
modprobe iptable_nat

modprobe ip_conntrack_ftp
modprobe ip_nat_ftp

#Turn IP Forward
sysctl -w net.ipv4.ip_forward=1

#Flush NAT POSTROUTING CHAIN
iptables -t nat -F POSTROUTING

# Add Iptables nat to eth0 (local loop back)
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE

# Flush PREROUTING CHAIN
iptables -t nat -F PREROUTING
iptables -t nat -F OUTPUT

#forward http port

iptables -t nat -A PREROUTING -p tcp --dport 80 -i eth0 -j DNAT --to-destination 192.36.253.2

#forward other ports for mail
iptables -t nat -A PREROUTING -p tcp --dport 25 -i eth0 -j DNAT --to-destination 192.36.253.2
iptables -t nat -A PREROUTING -p tcp --dport 443 -i eth0 -j DNAT --to-destination 192.36.253.2
iptables -t nat -A PREROUTING -p tcp --dport 1352 -i eth0 -j DNAT --to-destination 192.36.253.2

# Flush forward chain
iptables -F FORWARD

iptables -A FORWARD -s 192.36.253.2 -j ACCEPT
iptables -A FORWARD -d 192.36.253.2 -j ACCEPT

#set drop rules
# All access

iptables -A FORWARD -m mac --mac-source 00:02:55:07:47:03 -j ACCEPT #ibmserver
iptables -A FORWARD -m mac --mac-source 00:04:75:C7:61:69 -j ACCEPT #Access_server

# Deny everyone else


iptables -A FORWARD -s 192.36.253.0/16 -j DROP

Thank You for replying

Regards,
^vampire^
 
Old 10-12-2006, 04:22 AM   #2
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
Please post your thread in only one forum. Posting a single thread in the most relevant forum will make it easier for members to help you and will keep the discussion in one place. This thread is being closed because it is a duplicate.
 
  


Closed Thread



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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Port Forwarding Problem using IPTABLES ^vampire^ Linux - Networking 1 10-12-2006 06:27 AM
iptables with port forwarding problem ... please help me rubenscript Linux - Networking 1 04-26-2006 04:51 PM
iptables problem.....port forwarding..... shahg_shahg Linux - Networking 1 03-22-2006 05:17 AM
IPTables port forwarding problem deadlydemon Linux - Security 2 04-25-2005 04:43 PM
IPTables Port Forwarding Problem delusi0n Linux - Networking 0 10-02-2001 01:34 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Security

All times are GMT -5. The time now is 05:07 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration