• Willkommen im Linux Club - dem deutschsprachigen Supportforum für GNU/Linux. Registriere dich kostenlos, um alle Inhalte zu sehen und Fragen zu stellen.

iptables lokale Pakete

Hallo Zusammen,

mal wieder gibt es ein Problem mit iptables... Ich habe Load Balancing mit iptables-Regeln gelöst und es funktioniert soweit alles, wenn ich vom internen Netzwerk nach außen Pinge. Wenn ich allerdings vom Load Balancer selbst nach außen pingen möchte oder von außer zum Load Balancer, geht der Ping nicht. Dies liegt vermutlich daran, dass ich aufgrund des Balancings mit iptable-Regeln keine normale Default-Route angelegt habe. Ich habe nun geschaut wo das Paket hängen bleibt wenn man von außen anpingt. (kann man über die Byteanzahl der Regeln schauen). Die Pakete werden auf jedenfall in der Tabelle mangle noch markiert und durchlaufen die INPUT-Chain, da hier der counter hochgezählt wird. Allerdings fehlen anschließend die Pakete einfach. Nach der INPUT-Chain folgt normalerweise das lokale System oder irre ich mich? Ich vermute das das lokale Routingsystem die Pakete verwirft, da es keine normale Default-Route zurück gibt. Ich verstehe nicht ganz warum nicht erkannt wird, dass die Pakete bereits markiert wurden?

Herzlichen Dank ;)

Grüße,

HltmaN
 
Auf welche IP pingst du? Die des Load Balancers oder die des Servers?

Poste mal die Ausgabe von:
Code:
ip r s
( auf dem Load Balancer
 
Ich versuche einmal von außen, also vom Server die externe IP des Load Balancers zu pingen und einmal vom Load Balancer zum Server, aber geht beides nicht.
 
HItmaN schrieb:
Ich versuche einmal von außen, also vom Server die externe IP des Load Balancers zu pingen und einmal vom Load Balancer zum Server, aber geht beides nicht.

Du musst mehr Infos bringen mit der Aussage kann dir keiner helfen.

Poste mal die Ausgabe von:
Code:
ip r s
ip rule list
iptables -t mangle -vL
iptables -vL
[/quote]
 
ip r s
Code:
1.1.1.0/24 dev eth1  proto kernel  scope link  src 1.1.1.1 
2.2.2.0/24 dev eth2  proto kernel  scope link  src 2.2.2.1 
192.168.3.0/24 dev eth0  proto kernel  scope link  src 192.168.3.1

ip route show table T1
Code:
default via 1.1.1.2 dev eth1 
1.1.1.0/24 dev eth1  scope link 
192.168.3.0/24 dev eth0  scope link

ip route show table T2
Code:
default via 2.2.2.2 dev eth2 
2.2.2.0/24 dev eth2  scope link 
192.168.3.0/24 dev eth0  scope link

ip rule show
Code:
0:	from all lookup local 
32764:	from all fwmark 0x2 lookup T2 
32765:	from all fwmark 0x1 lookup T1 
32766:	from all lookup main 
32767:	from all lookup default

iptables -t mangle -vL
Code:
Chain PREROUTING (policy ACCEPT 5 packets, 523 bytes)
 pkts bytes target     prot opt in     out     source               destination         
    3   389 BALANCE_OUT  all  --  eth0   any     anywhere             anywhere            
    1    67 MARK-T1    all  --  eth1   any     anywhere             anywhere             ctstate NEW
    1    67 MARK-T2    all  --  eth2   any     anywhere             anywhere             ctstate NEW
    0     0 CONNMARK   all  --  eth1   any     anywhere             anywhere             ctstate RELATED,ESTABLISHED CONNMARK restore
    0     0 CONNMARK   all  --  eth2   any     anywhere             anywhere             ctstate RELATED,ESTABLISHED CONNMARK restore

Chain INPUT (policy ACCEPT 3 packets, 201 bytes)
 pkts bytes target     prot opt in     out     source               destination         

Chain FORWARD (policy ACCEPT 0 packets, 0 bytes)
 pkts bytes target     prot opt in     out     source               destination         

Chain OUTPUT (policy ACCEPT 3 packets, 201 bytes)
 pkts bytes target     prot opt in     out     source               destination         

Chain POSTROUTING (policy ACCEPT 6 packets, 402 bytes)
 pkts bytes target     prot opt in     out     source               destination         
    2   134 RATEEST    all  --  any    eth1    anywhere             anywhere             name WAN1_OUT interval 250.0ms ewmalog 500.0ms
    2   134 RATEEST    all  --  any    eth2    anywhere             anywhere             name WAN2_OUT interval 250.0ms ewmalog 500.0ms

Chain BALANCE_OUT (1 references)
 pkts bytes target     prot opt in     out     source               destination         
    0     0 MARK-T1    all  --  any    any     anywhere             anywhere             ctstate NEW rateest match WAN1_OUT delta bps 2000Kbit gt WAN2_OUT bps 2100Kbit
    3   389 MARK-T2    all  --  any    any     anywhere             anywhere             ctstate NEW rateest match WAN2_OUT delta bps 2100Kbit gt WAN1_OUT bps 2000Kbit
    0     0 CONNMARK   all  --  any    any     anywhere             anywhere             ctstate RELATED,ESTABLISHED CONNMARK restore

Chain MARK-T1 (2 references)
 pkts bytes target     prot opt in     out     source               destination         
    1    67 MARK       all  --  any    any     anywhere             anywhere             MARK set 0x1
    1    67 CONNMARK   all  --  any    any     anywhere             anywhere             CONNMARK save

Chain MARK-T2 (2 references)
 pkts bytes target     prot opt in     out     source               destination         
    4   456 MARK       all  --  any    any     anywhere             anywhere             MARK set 0x2
    4   456 CONNMARK   all  --  any    any     anywhere             anywhere             CONNMARK save

iptables -vL
Code:
Chain INPUT (policy ACCEPT 9 packets, 603 bytes)
 pkts bytes target     prot opt in     out     source               destination         

Chain FORWARD (policy ACCEPT 0 packets, 0 bytes)
 pkts bytes target     prot opt in     out     source               destination         

Chain OUTPUT (policy ACCEPT 13 packets, 897 bytes)
 pkts bytes target     prot opt in     out     source               destination
 
Ich dachte das ist der Sinn von den Markierungen, ich markiere mit Rateest bei iptables einmal mit fwmark 1 oder mit fwmark 2, je nachdem wieviel Bandbreite zur Verfügung steht und dann landen die Pakete mit fwmark 1 in T1 und mit fwmark 2 in T2. Dort ist dann jeweils nur die Default-Route zu einem ISP eingetragen? Oder wo ist da der Denkfehler?
 
HltmaN schrieb:
Ich dachte das ist der Sinn von den Markierungen, ich markiere mit Rateest bei iptables einmal mit fwmark 1 oder mit fwmark 2, je nachdem wieviel Bandbreite zur Verfügung steht und dann landen die Pakete mit fwmark 1 in T1 und mit fwmark 2 in T2. Dort ist dann jeweils nur die Default-Route zu einem ISP eingetragen? Oder wo ist da der Denkfehler?

Was willst du da mit dem Rateestimate? Du hast dann kein wirkliches Balancing, weil du erst eine Leitung vollständig auslastest. Es wird als erstes in der default Table nach einer Route gesucht und da du dort keine Route mit dem Verweis auf die jeweilige Tabelle hast funktioniert es nicht.

Sieh dir noch mal das Script an, was ich dir in deinem anderen Thread an die Hand gegeben habe.
 
Mir will einfach nicht rein warum des nicht gehn soll, also so wie ich die Regeln gesetzt hab :???: :???:

Ich glaub nicht, dass zuerst die default abgefragt wird, also jedenfalls sagt dieses Tutorial was anderes...
Each routing policy rule consists of a selector and an action predicate. The RPDB is scanned in the order of increasing priority, with the selector of each rule applied to the source address, destination address, incoming interface, TOS, and fwmark.

http://www.policyrouting.org/PolicyRoutingBook/ONLINE/CH03.web.html

Also müsste doch zuerst local und dann die fwmarks aufgerufen werden, in diesem Fall T1 oder T2 bevor die main aufgerufen wird oder?

Danke.

Grüße
 
HltmaN schrieb:
Mir will einfach nicht rein warum des nicht gehn soll, also so wie ich die Regeln gesetzt hab :???: :???:

Ich glaub nicht, dass zuerst die default abgefragt wird, also jedenfalls sagt dieses Tutorial was anderes...
Each routing policy rule consists of a selector and an action predicate. The RPDB is scanned in the order of increasing priority, with the selector of each rule applied to the source address, destination address, incoming interface, TOS, and fwmark.

Also müsste doch zuerst local und dann die fwmarks aufgerufen werden, in diesem Fall T1 oder T2 bevor die main aufgerufen wird oder?

Richtig, aber du hast die Route zu T1 gesetzt ohne die Tabelle anzugeben. Poste mal das Script.
 
Oben