LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 09-17-2005, 07:55 AM   #1
stomach
Member
 
Registered: Sep 2005
Distribution: Debian
Posts: 202

Rep: Reputation: 30
prerouting not function


#!/bin/bash
IF_EXTERNA="eth0";
IF_INTERNA="eth1";

REDE_INTERNA="192.168.254.0/24"

iptables -F
iptables -Z
iptables -X
iptables -F -t nat
iptables -X -t nat
iptables -F -t mangle
iptables -X -t mangle

iptables -P FORWARD ACCEPT
iptables -P INPUT DROP
iptables -P OUTPUT ACCEPT

iptables -A INPUT -i lo -j ACCEPT
iptables -A INPUT -i $IF_INTERNA -j ACCEPT
iptables -A FORWARD -i $IF_INTERNA -j ACCEPT

iptables -t nat -A PREROUTING -i $IF_INTERNA -p tcp --dport 80 -j REDIRECT --to-port 3128

iptables -t nat -A POSTROUTING -s $REDE_INTERNA -j MASQUERADE




The redirect does not function.

But if politics INPUT is ACCEPT, functions!
 
Old 12-19-2005, 07:16 PM   #2
win32sux
LQ Guru
 
Registered: Jul 2003
Location: Los Angeles
Distribution: Ubuntu
Posts: 9,870

Rep: Reputation: 380Reputation: 380Reputation: 380Reputation: 380
it should work for you like this:
Code:
#!/bin/bash

IF_EXTERNA="eth0"
IF_INTERNA="eth1"
REDE_INTERNA="192.168.254.0/24"

iptables -F
iptables -F -t nat
iptables -F -t mangle

iptables -X
iptables -X -t nat
iptables -X -t mangle

iptables -Z

iptables -P INPUT DROP
iptables -P FORWARD DROP
iptables -P OUTPUT ACCEPT

iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT

iptables -A INPUT -i lo -j ACCEPT

iptables -A INPUT -p TCP -i $IF_INTERNA -s $REDE_INTERNA \
--dport 3128 -m state --state NEW -j ACCEPT

iptables -A FORWARD -m state --state ESTABLISHED,RELATED -j ACCEPT

iptables -A FORWARD -i $IF_INTERNA -o $IF_EXTERNA \
-s $REDE_INTERNA -m state --state NEW -j ACCEPT

iptables -t nat -A PREROUTING -p TCP -i $IF_INTERNA \
--dport 80 -j REDIRECT --to-ports 3128

iptables -t nat -A POSTROUTING -o $IF_EXTERNA -j MASQUERADE



Quote:
Originally Posted by stomach
#!/bin/bash
IF_EXTERNA="eth0";
IF_INTERNA="eth1";

REDE_INTERNA="192.168.254.0/24"

iptables -F
iptables -Z
iptables -X
iptables -F -t nat
iptables -X -t nat
iptables -F -t mangle
iptables -X -t mangle

iptables -P FORWARD ACCEPT
iptables -P INPUT DROP
iptables -P OUTPUT ACCEPT

iptables -A INPUT -i lo -j ACCEPT
iptables -A INPUT -i $IF_INTERNA -j ACCEPT
iptables -A FORWARD -i $IF_INTERNA -j ACCEPT

iptables -t nat -A PREROUTING -i $IF_INTERNA -p tcp --dport 80 -j REDIRECT --to-port 3128

iptables -t nat -A POSTROUTING -s $REDE_INTERNA -j MASQUERADE




The redirect does not function.

But if politics INPUT is ACCEPT, functions!

Last edited by win32sux; 12-19-2005 at 07:21 PM.
 
  


Reply



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
Iptables+prerouting niranjan_mr Linux - Networking 1 04-19-2005 12:23 PM
prerouting question bugstein Linux - Networking 1 04-07-2005 09:49 PM
PREROUTING stuff zalmox Linux - Security 1 11-23-2003 06:35 PM
Nat Prerouting lambmt Linux - Networking 5 10-07-2003 08:17 PM
DNAT and prerouting is my only problem closer8888 Linux - Networking 0 02-17-2003 10:46 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 04:58 PM.

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