LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (https://www.linuxquestions.org/questions/linux-networking-3/)
-   -   Slackware 8.1 & Iptables Help (https://www.linuxquestions.org/questions/linux-networking-3/slackware-8-1-and-iptables-help-516353/)

siadam 01-12-2007 02:08 PM

Quote:

iptables -t nat -A PREROUTING -p tcp -d <YOUR PUBLIC IP> --dport 80 -j DNAT --to-destination 192.168.x.x:80
Used that and it worked, HOWEVER not completely.

I did not however add the 2nd rule yet. Will have to wait until I get back to work.

I enter the ip addy into a browser to hit the internal device..which brings up a log in page.

I then enter the username/password for the device and it says connect failed...

Keep in mind, doing the above steps from inside the lan works perfectly.

Does the 2nd rule that I left out create a path back out? I am not sure how it gets there and back, but when I enter the username/password it fails??

:cool:

siadam 01-17-2007 01:07 PM

Both rules added.

No luck, same problem.

??

loewen 01-22-2007 02:26 AM

Slackware 8.1 & Iptables Help
 
Remove POSTrouting for now. I am not sure its needed. Just use PREROUTING TABLE as this will forward all packets from internet going to your public IP to your LAN webserver. I didnt include the forward as I assume its allowed by your firewall already (all established connections forwarded). But here is an additional rule for the FORWARD tables. This basically verifies if the packet came from within the LAN (-i eth1) and should go through the iNet interface (-o eth0). I made sure that the LAN IP is the source though. Hope this works for you.


iptables -D PREROUTING -t nat -p tcp -d <PUBLIC-IP> --dport 80 -m state --state NEW,ESTABLISHED,RELATED -j DNAT --to <LOCAL LAN IP>:80
iptables -D FORWARD -i eth1 -o eth0 -s <LACAL LAN IP> -p tcp --dport 80 -m state --state NEW,ESTABLISHED,RELATED -j ACCEPT

If it still doesnt work, try specifying default rules for FORWARD to allow. Then add the PREROUTING rule.

siadam 01-22-2007 08:59 AM

I will try that.

Thank you for your time!!

:cool:

siadam 01-22-2007 10:23 AM

Odd problem. I restarted the box as to flush the old chains as I normally have when trying something new.

Well it says "Bad rule (does a matching rule exist in the chain?)"

Happened on both, so needless to say I could not enter them.

:confused:

siadam 02-02-2007 02:21 PM

Quote:

Originally Posted by siadam
Odd problem. I restarted the box as to flush the old chains as I normally have when trying something new.

Well it says "Bad rule (does a matching rule exist in the chain?)"

Happened on both, so needless to say I could not enter them.

:confused:

Bump.
:cool:

siadam 02-05-2007 09:40 AM

Well...I figured out the system was using a port number..entered that into the above rules and nothing..

So I am still stuck..

More bumpage...

:cool:

siadam 02-07-2007 02:29 PM

Quote:

Originally Posted by siadam
Well...I figured out the system was using a port number..entered that into the above rules and nothing..

So I am still stuck..

More bumpage...

:cool:


You guys give up on me or what?

:cool:

siadam 02-21-2007 12:42 PM

Quote:

Originally Posted by siadam
You guys give up on me or what?

:cool:

**Looks around room**

[/crickets]

:cool:

siadam 02-28-2007 03:13 PM

Still looking to figure this out..

Any help would be GREATLY appreciated.

Thanks in advance.
:cool:

siadam 02-28-2007 03:21 PM

Here is what I am working w/currently.

Quote:

$IPTABLES -F
$IPTABLES -t nat -F
$IPTABLES -t mangle -F
$IPTABLES -t nat -A POSTROUTING -o eth0 -j SNAT --to $EXT
$IPTABLES -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
$IPTABLES -A INPUT -m state --state NEW -i ! eth0 -j ACCEPT
$IPTABLES -P INPUT DROP
Flushed the old rules to start over..

Everything is fine, w/the exception that I can't access the device from outside the net.

:cool:

siadam 03-19-2007 12:17 PM

So I'll take this as a we don't know, or we don't care to help..

Still plugging away w/no luck...

:confused:


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