Matzetronic
16.03.03, 18:50
hallo,
ich habe gerade bemerkt, dass es scheinbar nicht egal ist, an welcher stelle der firewall-regeln das masquerading steht. laut den dokumentationen auf www.netfilter.org spielt es keine rolle, da der kernel-code "intelligent genug" sei, das zu brücksichtigen. ich habe dem bisher so vertraut, ohne es weiter zu überprüfen. jetzt bin ich gerade dabei, mal ein "ordentliches" paketfilter-script zu hacken, und teste natürlich immer nach jeder regel...
wenn ich beispielsweise
"iptables -t nat -A POSTROUTING -o $DEV_EXT -j MASQUERADE"
an den anfang setze, ist es völlig egal, was in dem restlichen script steht, es geht von innen nach aussen alles.
sobald ich erst dienste einschränke und am schluss diese zeile einfüge, funktioniert es wie gewollt.
ist das jetzt ein bug, oder so gewollt, oder schlichtweg nur falsch in der doku ? kann das jemand bestätigen oder erklären ?
danke,
matze
Edit: Hier noch das Zitat...
It's common to want to do Network Address Translation (see the NAT HOWTO) and packet filtering. The good news is that they mix extremely well.
You design your packet filtering completely ignoring any NAT you are doing. The sources and destinations seen by the packet filter will be the `real' sources and destinations. For example, if you are doing DNAT to send any connections to 1.2.3.4 port 80 through to 10.1.1.1 port 8080, the packet filter would see packets going to 10.1.1.1 port 8080 (the real destination), not 1.2.3.4 port 80. Similarly, you can ignore masquerading: packets will seem to come from their real internal IP addresses (say 10.1.1.1), and replies will seem to go back there.
ich habe gerade bemerkt, dass es scheinbar nicht egal ist, an welcher stelle der firewall-regeln das masquerading steht. laut den dokumentationen auf www.netfilter.org spielt es keine rolle, da der kernel-code "intelligent genug" sei, das zu brücksichtigen. ich habe dem bisher so vertraut, ohne es weiter zu überprüfen. jetzt bin ich gerade dabei, mal ein "ordentliches" paketfilter-script zu hacken, und teste natürlich immer nach jeder regel...
wenn ich beispielsweise
"iptables -t nat -A POSTROUTING -o $DEV_EXT -j MASQUERADE"
an den anfang setze, ist es völlig egal, was in dem restlichen script steht, es geht von innen nach aussen alles.
sobald ich erst dienste einschränke und am schluss diese zeile einfüge, funktioniert es wie gewollt.
ist das jetzt ein bug, oder so gewollt, oder schlichtweg nur falsch in der doku ? kann das jemand bestätigen oder erklären ?
danke,
matze
Edit: Hier noch das Zitat...
It's common to want to do Network Address Translation (see the NAT HOWTO) and packet filtering. The good news is that they mix extremely well.
You design your packet filtering completely ignoring any NAT you are doing. The sources and destinations seen by the packet filter will be the `real' sources and destinations. For example, if you are doing DNAT to send any connections to 1.2.3.4 port 80 through to 10.1.1.1 port 8080, the packet filter would see packets going to 10.1.1.1 port 8080 (the real destination), not 1.2.3.4 port 80. Similarly, you can ignore masquerading: packets will seem to come from their real internal IP addresses (say 10.1.1.1), and replies will seem to go back there.