[Linux/Iptables] Port forwarding met exception

Pagina: 1
Acties:

  • c-nan
  • Registratie: Juni 2008
  • Nu online
Met behulp van iptables heb ik port forwarding op poort 80 draaiend:
code:
1
2
iptables -t nat -A PREROUTING -p tcp --dport 80 -j DNAT --to-destination 10.0.0.3
iptables -A FORWARD -p tcp -i eth0 -d 10.0.0.3 --dport 80 -j ACCEPT


Echter wil ik een aantal IP's uitsluiten, dus dat bijvoorbeeld 123.123.123.123 niet geforward moet worden. Ik heb de manual doorgenomen van iptables, echter veel wijzer ben ik er niet uit geworden.

Anyone?

EU DNS: 86.54.11.100


  • Rainmaker
  • Registratie: Augustus 2000
  • Laatst online: 14-07-2024

Rainmaker

RHCDS

iptables stopt na een match (behalve bij LOG).

Dus, als je er een regel bovenzet zoals

code:
1
iptables -t nat -A PREROUTING -s 123.123.123.123 -p tcp -j ACCEPT


Zou dat (in theorie, heb niks getest) moeten werken.

[ Voor 3% gewijzigd door Rainmaker op 14-08-2009 01:49 ]

We are pentium of borg. Division is futile. You will be approximated.


  • H!GHGuY
  • Registratie: December 2002
  • Niet online

H!GHGuY

Try and take over the world...

Rainmaker schreef op vrijdag 14 augustus 2009 @ 01:48:
iptables stopt na een match (behalve bij LOG).

Dus, als je er een regel bovenzet zoals

code:
1
iptables -t nat -A PREROUTING -s 123.123.123.123 -p tcp -j ACCEPT


Zou dat (in theorie, heb niks getest) moeten werken.
Dat moet natuurlijk -j DROP zijn.

Ook gebruikelijk is om voor zulke regels een nieuwe table aan te maken:
code:
1
2
3
4
iptables -N HTTP
iptables -A FORWARD -p tcp -i eth0 -d 10.0.0.3 --dport 80 -j HTTP
iptables -P HTTP ACCEPT
iptables -A HTTP -s 123.123.123.123 -j DROP

Ik kan me her en der vergissen in de exacte syntax, maar samen met de iptables tutorial (http://iptables-tutorial....et/iptables-tutorial.html) moet je er wel komen

ASSUME makes an ASS out of U and ME