Skip to contentSkip to conversation

Plz i need help.... or i ll be fired :(

DISCUSSION Edmundo Carmona 1 participant 1 message Sep 27, 2005 2 messages not in the archive

lore
Share & tools
lore
#2 lore raw
In reply to a message not in the archive

Are you gonna use the inner machine to "serve" the internet? say... have a web server?

Use the rules I said before... plus these:

iptables -t nat -A PREROUTING -p tcp --dport 80 -d my-public-address -j DNAT --to-destination the-inner-web-server

iptables -A FORWARD -i eth1 -o eth0 -p tcp --dport 80 -j ACCEPT

Quoted 179 lines · Alaios

Hmm... i dont want to make the web work.... just to make my simple task to work

Quoted 88 lines · --- Edmundo Carmona

I would recommend to start over.

Do this. On the "router" box do this:

iptables -F
iptables -t nat -F

iptables -P FORWARD DROP
iptables -P INPUT DROP

iptables -A FORWARD -i eth0 -j ACCEPT
iptables -A FORWARD -m conntrack --ctstate
ESTABLISHED,RELATED -j ACCEPT

iptables -t nat -A POSTROUTING -o eth1 -j MASQUERADE

echo 1 > /proc/sys/net/ipv4/ip_forward

That should allow the "inner" machine to use the web without a problem.

Quoted 1 line · Alaios

Thx for your quick reply..... i have just tested

but

Quoted 1 line

it didnt work... I think that i cant explain what

i

Quoted 5 lines

need or i am doing sth wrong..
i have enabled the packets loging
so executing dmesg prints the following IN=eth1 OUT= MAC=(the mac addresses)
As u can see the OUT is null which means thats

perhaps

Quoted 6 lines

the problem... What do u have in mind?

--- "John A. Sullivan III"

Quoted 1 line · <[email protected]> wrote:

On Tue, 2005-09-27 at 11:14 -0400, John A.

Sullivan

Quoted 2 lines
Quoted 2 lines
Quoted 1 line · III

On Tue, 2005-09-27 at 07:57 -0700, Alaios

Quoted 4 lines · wrote:
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

Hi plz take a look at the following example

The laptop has 2 ethernet interfaces
To eth1 comes traffic from src

143.233.222.253

Quoted 8 lines
Quoted 8 lines
Quoted 1 line
Quoted 1 line

The eth0 has ip address 10.2.4.2 and it is

connected

Quoted 1 line
Quoted 1 line

back to back with eth1 of other pc with ip

address

Quoted 2 lines
Quoted 2 lines

10.2.4.1
I want to forward the traffic with src

143.233.222.253

Quoted 1 line
Quoted 1 line

to the 10.2.4.1 pc and if it works i will

redo

Quoted 2 lines
Quoted 2 lines

this

Quoted 1 line
Quoted 1 line

for a second pc so as to l send the traffic

to a

Quoted 11 lines
Quoted 11 lines

third

Quoted 6 lines
Quoted 6 lines

on.
Can u help me plz?

I have tried this one
iptables -t nat -A PREROUTING -i eth1 -s
143.233.222.253 -j DNAT --to-destination

10.2.4.1

Quoted 3 lines
Quoted 3 lines

i have also set the
/proc/sys/net/ipv4/ip_forward to 1
but still i cant see any trafiic to eth0

Quoted 8 lines
Quoted 8 lines

interface (ip

Quoted 5 lines
Quoted 5 lines

10.2.4.2)

I have also tested this one
iptables -t nat -A PREROUTING -p tcp -d

143.233.222.77

Quoted 1 line
Quoted 1 line

(laptop eth1 card) --dport 22453 (i have

cheched

Quoted 2 lines
Quoted 2 lines

dst

Quoted 1 line
Quoted 1 line

port with tcpdump) 00 -j DNAT

--to-destination

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

10.2.4.1
this still doesnt work
Every time i try to apply a new rule i use

first

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

the iptables -F
iptables -t nat -F command

Quoted 11 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

<snip>

I'm a little confused about what you are

doing. I

Quoted 2 lines
Quoted 2 lines

would normally refer

Quoted 1 line

you to Oskar Andreasson's excellent tutorial

at

Quoted 3 lines
Quoted 2 lines
Quoted 1 line

http://iptables-tutorial.frozentux.net/iptables-tutorial.html

Quoted 59 lines
Quoted 4 lines
Quoted 4 lines

or the

Quoted 1 line

training slides on the ISCS web site

(http://iscs.sourceforge.net) but,

Quoted 1 line

since it appears that you have an emergency,

here

Quoted 3 lines
Quoted 3 lines

goes:

Quoted 2 lines

First, if the source is 143.233.222.253, you

would

Quoted 2 lines
Quoted 2 lines

not want to DNAT it.

Quoted 1 line

DNAT changes the destination. Thus, your

second

Quoted 2 lines
Quoted 2 lines

attempt is the correct

Quoted 1 line

one. You might want to lock the destination

port

Quoted 2 lines
Quoted 2 lines

- it's not likely to

Quoted 1 line

be a problem but, if it ever is, it will be

one of

Quoted 5 lines
Quoted 5 lines

those really hard to

Quoted 4 lines

diagnose, sporadic problems:
-j DNAT --to-destination 10.2.4.1:22453

Second, this only takes care of the

addressing.

Quoted 5 lines
Quoted 5 lines

You must still allow

Quoted 1 line

the traffic in the FORWARD chain of the filter

table, e.g.,

Quoted 2 lines

iptables -A FORWARD -d 10.2.4.1 -p 6 --dport

22453

Quoted 5 lines
Quoted 5 lines

-j ACCEPT

Quoted 2 lines

Hope this helps - John

Oh, yes, you wanted to restrict the source

address.

Quoted 3 lines
Quoted 3 lines

Add that to your
filter table rule:
iptables -A FORWARD -s 143.233.222.253 -d

10.2.4.1

Quoted 9 lines
Quoted 9 lines

-p 6 --dport 22453 -j
ACCEPT
--
John A. Sullivan III
Open Source Development Corporation
+1 207-985-7880
[email protected]

If you would like to participate in the

development

Quoted 2 lines
Quoted 2 lines

of an open source
enterprise class network security management

system,

Quoted 6 lines
Quoted 4 lines

please visit
http://iscs.sourceforge.net

Quoted 8 lines
Quoted 3 lines

__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam

protection around

Quoted 3 lines

http://mail.yahoo.com

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