iptables / iproute2 - Wo hab ich den Denkfehler?

shavenne

Enthusiast
Thread Starter
Mitglied seit
02.07.2008
Beiträge
935
Ort
OWL
Hiho,

edit: Hat sich erledigt. ip rule add from $ip_vom_interface table [dsl1|dsl2] vergessen.

Ich habe zwei DSL-Anschlüsse und benutze ein schlichtes Debian als Router.
Nun habe ich ein Problem, dass ich eigentlich mal temporär gelöst hatte, habe das aber leider nirgendwo gespeichert, da ich dachte, ich hätte das nun vollständig verstanden und würde das jederzeit wieder hinkriegen. Jetzt hatte ich endlich Zeit den Router mal rebootsafe zu machen, hat auch fast alles geklappt, aber auch nur fast, und zwar:
Ich habe die Interfaces ppp0 und ppp1. Meistens ist ppp1 Default Route, weil's einfach später online kommt. Wenn ich jetzt von außerhalb (z.B. von der Firma aus) versuche auf ppp1 beispielsweise eine SSH-Verbindung zu öffnen, klappt alles wunderbar. Versuche ich aber eine Verbindung zu ppp0 aufzubauen, kriegts einen Timeout. Der Grund ist klar: Verbindung kommt über ppp0 rein und da ppp1 default route ist, versucht er über ppp1 zu antworten.
Das hatte ich eigentlich vorher so gelöst, indem ich die Pakete von ppp0 und ppp1 verschieden markiert habe und via ip rule eben bestimmte Routen gesetzt habe.

Nun habe ich es soweit geschafft, dass er über das richtige Interface antwortet, aber noch über eine falsche Source IP, also dachte ich an SNAT (obwohl ich schwören könnte, dass ich vor dem Reboot kein SNAT drin hatte), aber das funktioniert auch nicht...

So schaut's derzeit in den iptables aus:

Code:
root@atom:/proc# iptables -S
-P INPUT ACCEPT
-P FORWARD ACCEPT
-P OUTPUT ACCEPT
root@atom:/proc# iptables -t nat -S
-P PREROUTING ACCEPT
-P INPUT ACCEPT
-P OUTPUT ACCEPT
-P POSTROUTING ACCEPT
-A POSTROUTING -o ppp0 -j MASQUERADE
-A POSTROUTING -o ppp1 -j MASQUERADE
-A POSTROUTING -o ppp0 -j SNAT --to-source 80.133.x.y
-A POSTROUTING -o ppp1 -j SNAT --to-source 93.196.x.y
root@atom:/proc# iptables -t mangle -S
-P PREROUTING ACCEPT
-P INPUT ACCEPT
-P FORWARD ACCEPT
-P OUTPUT ACCEPT
-P POSTROUTING ACCEPT
-A PREROUTING -j CONNMARK --restore-mark --nfmask 0xffffffff --ctmask 0xffffffff
-A PREROUTING -i ppp1 -j MARK --set-xmark 0xb/0xffffffff
-A PREROUTING -i ppp0 -j MARK --set-xmark 0xa/0xffffffff
-A PREROUTING -m mark ! --mark 0x0 -j RETURN
-A POSTROUTING -j CONNMARK --save-mark --nfmask 0xffffffff --ctmask 0xffffffff
root@atom:/proc#

So die ip rules und routes:
Code:
root@atom:/proc# ip rule
0:      from all lookup local
32762:  from 192.168.99.0/24 lookup dsl1
32763:  from all fwmark 0xa lookup dsl1
32764:  from all fwmark 0xb lookup dsl2
32766:  from all lookup main
32767:  from all lookup default
root@atom:/proc# ip route show
default dev ppp1  scope link
default dev ppp0  scope link
192.168.90.0/24 dev eth0  proto kernel  scope link  src 192.168.90.1
192.168.91.0/24 dev eth2  proto kernel  scope link  src 192.168.91.11
192.168.92.0/24 dev eth3  proto kernel  scope link  src 192.168.92.11
192.168.99.0/24 dev eth1  proto kernel  scope link  src 192.168.99.1
217.0.119.15 dev ppp0  proto kernel  scope link  src 80.133.x.y
217.0.119.15 dev ppp1  proto kernel  scope link  src 93.196.x.y
root@atom:/proc# ip route show table dsl1
default dev ppp0  scope link
192.168.90.0/24 dev eth0  scope link
192.168.91.0/24 dev eth2  scope link
192.168.92.0/24 dev eth3  scope link
192.168.99.0/24 dev eth1  scope link
root@atom:/proc# ip route show table dsl2
default dev ppp1  scope link
192.168.90.0/24 dev eth0  scope link
192.168.91.0/24 dev eth2  scope link
192.168.92.0/24 dev eth3  scope link
192.168.99.0/24 dev eth1  scope link
root@atom:/proc#

Und das spuckt tcpdump bei einem Ping-Versuch von der Firma auf ppp0 aus:
Code:
tcpdump: verbose output suppressed, use -v or -vv for full protocol decodelistening on ppp0, link-type LINUX_SLL (Linux cooked), capture size 65535 bytes
11:16:57.597840 IP $firma > p12345678.dip0.t-ipconnect.de: ICMP echo request, id 14476, seq 55, length 40
11:16:57.614189 IP 217.0.119.15 > p12345678.dip0.t-ipconnect.de: ICMP host $firma unreachable - admin prohibited filter, length 60

Jemand ne Idee?
 
Zuletzt bearbeitet:
Hardwareluxx setzt keine externen Werbe- und Tracking-Cookies ein. Auf unserer Webseite finden Sie nur noch Cookies nach berechtigtem Interesse (Art. 6 Abs. 1 Satz 1 lit. f DSGVO) oder eigene funktionelle Cookies. Durch die Nutzung unserer Webseite erklären Sie sich damit einverstanden, dass wir diese Cookies setzen. Mehr Informationen und Möglichkeiten zur Einstellung unserer Cookies finden Sie in unserer Datenschutzerklärung.


Zurück
Oben Unten refresh