Skip to contentSkip to conversation

Ports

DISCUSSION Mattia Martinello 4 participants 5 messages Sep 9, 2002

lore
Share & tools
lore
#0 lore raw

Could I allow a packet to transit in the FORWARD chain (under masquerading) from some host (or any host) to a host on a port?

iptables -A FORWARD -p tcp -s 0.0.0.0/0 -d 192.168.2.101 -dport 80 -j ACCEPT

don't work (only one -d is allowed). What can I do?

Thank you very much
Bye
Mattia

#1 lore raw
Quoted 1 line

iptables -A FORWARD -p tcp -s 0.0.0.0/0 -d 192.168.2.101 -dport 80 -j ACCEPT

It is: --dport, not -dport

Regards

#2 lore raw
In reply to Mattia Martinello
Quoted 4 lines · Mattia Martinello

Could I allow a packet to transit in the FORWARD chain (under masquerading) from some host (or any host) to a host on a port?

iptables -A FORWARD -p tcp -s 0.0.0.0/0 -d 192.168.2.101 -dport 80 -j ACCEPT

I think that your problem is --dport. You missed a "-".

Ramin

Quoted 7 lines

don't work (only one -d is allowed). What can I do?

Thank you very much
Bye
Mattia

#3 lore raw

Ramin Alidousti ha scritto:

Quoted 4 lines

I think that your problem is --dport. You missed a "-".

Ramin

Thank all wery much!
Bye
Mattia

#4 lore raw
In reply to Mattia Martinello
Quoted 7 lines · Mattia Martinello

Could I allow a packet to transit in the FORWARD chain (under masquerading) from some host (or any host) to a host on a port?

iptables -A FORWARD -p tcp -s 0.0.0.0/0 -d 192.168.2.101 -dport 80 -j ACCEPT

don't work (only one -d is allowed). What can I do?

You can add another '-' :-)

iptables -A FORWARD -p tcp -d 192.168.2.101 --dport 80 -j ACCEPT

(The -s 0.0.0.0/0 is redundant - remove it to keep thing simpler.)

Antony.

Signature · 3 lines
90% of network problems are routing problems.
9 of the remaining 10% are routing problems in the other direction.
The remaining 1% might be something else, but check the routing anyway.