Skip to contentSkip to conversation

port forwarding form IP range

DISCUSSION Nilesh 2 participants 2 messages Mar 13, 2006

lore
Share & tools
lore

Nilesh

author
#0 lore raw

Sorry earlier mail was without attchment.

Quoted 178 lines · --- Nilesh

no there is only Forward default chain.
I am confused , I have attached herewith my
rc.firewall could you please look into.If I am
going
wrong way.

Thanks
Nilesh,

Quoted 1 line · --- Seferovic Edvin

-i eth1 -o eth1 ??? How is this suppose to work?

Is

Quoted 12 lines

there any forward chain
on one interface?

iptables -A FORWARD -s 192.168.0.10 -i eth1 -d
192.168.0.1 -o eth1 -p tcp --sport 1024:65535
--dport
3128 -j ACCEPT.

Regards,

Edvin

Quoted 9 lines
Quoted 4 lines · --- Rob Sterenborg
Quoted 3 lines · Nilesh

Thanks Leandro,

I have tried with this rules but unfortunately

not

Quoted 2 lines
Quoted 2 lines

working.
Squid server running on the 192.168.0.3 and

its

Quoted 1 line
Quoted 1 line
Quoted 1 line

working fine. I have not installed any

firewall

Quoted 3 lines
Quoted 3 lines

on

Quoted 2 lines

the 192.168.0.3.
In my Internet browser settings If I chnage

the

Quoted 35 lines
Quoted 1 line
Quoted 1 line

settings from 192.168.0.1:3128 to

192.168.0.3:3128

Quoted 8 lines

I

Quoted 5 lines

can surf the web.
but If I dont change to 192.168.0.3:3128 proxy
settings I get the connection timout error.

I think DNAT is not working

Probably you tell Netfilter to do DNAT, but are

not

Quoted 2 lines

allowing it.
Do you have a FORWARD rule that allows this

traffic

Quoted 16 lines

or is your policy ACCEPT ?

Please don't top-post.

Gr,
Rob

Quoted 7 lines
Quoted 5 lines · --- Leandro Silva

Hello !

You can use something like that:

iptables -I PREROUTING -t nat -s 192.168.0.10

-p

Quoted 4 lines

tcp

Quoted 3 lines
Quoted 3 lines

--dport 80 -j
DNAT --to 192.168.0.3:3128
iptables -I PREROUTING -t nat -s 192.168.0.10

Quoted 12 lines

-p

Quoted 5 lines

tcp

Quoted 4 lines
Quoted 4 lines

--dport 3128 -j
DNAT --to 192.168.0.3:3128

If you have iprange compiled for iptables you

can

Quoted 5 lines
Quoted 3 lines
Quoted 3 lines

use:

iptables -I PREROUTING -t nat -m iprange

--src-range

Quoted 1 line
Quoted 1 line

192.168.0.10-192.168.0.20 -p tcp --dport 80

-j

Quoted 22 lines
Quoted 6 lines

DNAT

Quoted 3 lines
Quoted 3 lines

--to
192.168.0.3:3128
iptables -I PREROUTING -t nat -m iprange

--src-range

Quoted 1 line
Quoted 1 line

192.168.0.10-192.168.0.20 -p tcp --dport 3128

-j

Quoted 15 lines
Quoted 15 lines
Quoted 15 lines

DNAT --to
192.168.0.3:3128

I hope this can help,
Leandro

2006/3/11, Nilesh <[email protected]>:

Quoted 8 lines

Dear all,

I have two squid proxy servers and two ISP

1) 192.168.0.1 port 3128
2) 192.168.0.3 port 3128

We have around 70 comps assigned IP's

between

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

192.168.0.4 to 192.168.0.250
The default proxy we are using is

192.168.0.1

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

which is

Quoted 2 lines

on the ISP 1.
Now I have configured 192.168.0.3 squid

proxy

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

server

Quoted 2 lines

on ISP 2 line.
Both ISP 1 and ISP 2 are landing

(connected)

Quoted 10 lines

on

Quoted 9 lines
Quoted 4 lines
Quoted 4 lines

the

Quoted 3 lines

same Switch.

Now I want setup the request coming from IP

range

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

(192.168.0.10 to 192.168.0.20) for the
192.168.0.1:3128
Will be forward to 192.168.0.3:3128
So the users from this IP range will access

Quoted 10 lines
Quoted 4 lines

only

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

192.168.0.3 proxy server.

Could any one please help me which rules

should

Quoted 5 lines

I

Quoted 4 lines
Quoted 4 lines

use

Quoted 3 lines

in IPTABLES .

I have attached herewith my rc.firewall

file.

Quoted 17 lines
Quoted 9 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines

Please help me.

Regards
Nilesh.

__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam
protection around
http://mail.yahoo.com

Quoted 9 lines

__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam
protection around
http://mail.yahoo.com

__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam
protection around
http://mail.yahoo.com

Quoted 6 lines

__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam
protection around
http://mail.yahoo.com

__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com

#1 lore raw

Hi,

first of all an IP address should have /32 mask - or simply NO mask !

INTIP="192.168.0.1/24" <<< but I haven't seen the use of this variable in your script

You are prerouting http traffic to your proxy ( squid I suppose ) which is running on the same machine ( 192.168.0.1 )! So you need

--to-port 3128 without the IP address

$IPTABLES -t nat -A PREROUTING -i eth1 -p tcp --dport 80 -j REDIRECT --to-ports 192.168.0.1:3128 <<<

I do NOT see the aim of this rule.. every packet from 192.168.0.10 to 192.168.0.1 ( machine with this firewall script ) which comes on the same ethernet card ? There is a forward chain for the packets that are being routed. Every packet which has destination of a local eth card hits the input chain. So your following rule should be changed

$IPTABLES -A FORWARD -s 192.168.0.10 -i eth1 -d 192.168.0.1 -o eth1 -p tcp --sport 1024:65535 --dport 3128 -j ACCEPT

.. to something what suits your needs !

Regards,

Edvin

-----Original Message-----
From: Nilesh [mailto:[email protected]]
Sent: Montag, 13. März 2006 12:39
To: Nilesh; [email protected]; [email protected]
Subject: RE: port forwarding form IP range

Sorry earlier mail was without attchment.

Quoted 178 lines · --- Nilesh

no there is only Forward default chain.
I am confused , I have attached herewith my
rc.firewall could you please look into.If I am
going
wrong way.

Thanks
Nilesh,

Quoted 1 line · --- Seferovic Edvin

-i eth1 -o eth1 ??? How is this suppose to work?

Is

Quoted 12 lines

there any forward chain
on one interface?

iptables -A FORWARD -s 192.168.0.10 -i eth1 -d
192.168.0.1 -o eth1 -p tcp --sport 1024:65535
--dport
3128 -j ACCEPT.

Regards,

Edvin

Quoted 9 lines
Quoted 4 lines · --- Rob Sterenborg
Quoted 3 lines · Nilesh

Thanks Leandro,

I have tried with this rules but unfortunately

not

Quoted 2 lines
Quoted 2 lines

working.
Squid server running on the 192.168.0.3 and

its

Quoted 1 line
Quoted 1 line
Quoted 1 line

working fine. I have not installed any

firewall

Quoted 3 lines
Quoted 3 lines

on

Quoted 2 lines

the 192.168.0.3.
In my Internet browser settings If I chnage

the

Quoted 35 lines
Quoted 1 line
Quoted 1 line

settings from 192.168.0.1:3128 to

192.168.0.3:3128

Quoted 8 lines

I

Quoted 5 lines

can surf the web.
but If I dont change to 192.168.0.3:3128 proxy
settings I get the connection timout error.

I think DNAT is not working

Probably you tell Netfilter to do DNAT, but are

not

Quoted 2 lines

allowing it.
Do you have a FORWARD rule that allows this

traffic

Quoted 16 lines

or is your policy ACCEPT ?

Please don't top-post.

Gr,
Rob

Quoted 7 lines
Quoted 5 lines · --- Leandro Silva

Hello !

You can use something like that:

iptables -I PREROUTING -t nat -s 192.168.0.10

-p

Quoted 4 lines

tcp

Quoted 3 lines
Quoted 3 lines

--dport 80 -j
DNAT --to 192.168.0.3:3128
iptables -I PREROUTING -t nat -s 192.168.0.10

Quoted 12 lines

-p

Quoted 5 lines

tcp

Quoted 4 lines
Quoted 4 lines

--dport 3128 -j
DNAT --to 192.168.0.3:3128

If you have iprange compiled for iptables you

can

Quoted 5 lines
Quoted 3 lines
Quoted 3 lines

use:

iptables -I PREROUTING -t nat -m iprange

--src-range

Quoted 1 line
Quoted 1 line

192.168.0.10-192.168.0.20 -p tcp --dport 80

-j

Quoted 22 lines
Quoted 6 lines

DNAT

Quoted 3 lines
Quoted 3 lines

--to
192.168.0.3:3128
iptables -I PREROUTING -t nat -m iprange

--src-range

Quoted 1 line
Quoted 1 line

192.168.0.10-192.168.0.20 -p tcp --dport 3128

-j

Quoted 15 lines
Quoted 15 lines
Quoted 15 lines

DNAT --to
192.168.0.3:3128

I hope this can help,
Leandro

2006/3/11, Nilesh <[email protected]>:

Quoted 8 lines

Dear all,

I have two squid proxy servers and two ISP

1) 192.168.0.1 port 3128
2) 192.168.0.3 port 3128

We have around 70 comps assigned IP's

between

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

192.168.0.4 to 192.168.0.250
The default proxy we are using is

192.168.0.1

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

which is

Quoted 2 lines

on the ISP 1.
Now I have configured 192.168.0.3 squid

proxy

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

server

Quoted 2 lines

on ISP 2 line.
Both ISP 1 and ISP 2 are landing

(connected)

Quoted 10 lines

on

Quoted 9 lines
Quoted 4 lines
Quoted 4 lines

the

Quoted 3 lines

same Switch.

Now I want setup the request coming from IP

range

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

(192.168.0.10 to 192.168.0.20) for the
192.168.0.1:3128
Will be forward to 192.168.0.3:3128
So the users from this IP range will access

Quoted 10 lines
Quoted 4 lines

only

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

192.168.0.3 proxy server.

Could any one please help me which rules

should

Quoted 5 lines

I

Quoted 4 lines
Quoted 4 lines

use

Quoted 3 lines

in IPTABLES .

I have attached herewith my rc.firewall

file.

Quoted 17 lines
Quoted 9 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines

Please help me.

Regards
Nilesh.

__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam
protection around
http://mail.yahoo.com

Quoted 9 lines

__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam
protection around
http://mail.yahoo.com

__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam
protection around
http://mail.yahoo.com

Quoted 6 lines

__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam
protection around
http://mail.yahoo.com

__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com