Antworten ohne Registrierung

Routing mit iptables




Gismo
26.03.2010, 17:15 Uhr
Hab hier ein Problem mit einem meiner Rechner ins Netz zu kommen. Die Situation:

Rechner MINI ist Gateway/Firewall; ppp0 ist Interface zur Außenwelt und eth0 (192.168.0.11) ist das Interface zum LAN

Rechner MAXI hat 2 Interfaces, eth0 (192.168.0.31) ist sein Interface zum LAN; eth1 (192.168.0.200) ist das Interface zu Rechner NEO.
NEO hat ein Interface (usb0) mit der IP 192.168.0.202.

Rechner MAXI kann problemlos auf's Internet zugreifen; ganz normale Sache; Rechner hinter Firewall mit Zugriff zum Internet.
Rechner MAXI kann auch mit NEO Verbindung aufnehmen, die iptables-Regel für MAXI ist ja noch recht einfach.

iptables -t filter -A INPUT -s 192.168.0.202 -j ACCEPT
iptables -t filter -A OUTPUT -s 192.168.0.200 -j ACCEPT

Fräge: Welche iptables Filter- bzw. Nat-Regeln sind nötig um NEO ins Internet zu kriegen ?

Internet
|
|
ppp0 (dyn Adresse)
MINI
eth0 (192.168.0.11
|
|
eth0 (192.168.0.31)
MAXI
eth1 (192.168.0.200)
|
|
usb0 (192.168.0.202)
NEO

Irgendwie muß ich dem System mitteilen, daß Datenpakete von oder für NEO durch MAXI hindurch transportiert werden müssen; aber wie ?

Falls das hilfreich ist; die Regeln des Firewall-Rechners (MINI)
( Port-Forwarding auf 8090 ist nut temporär, wegen Osterlauf-Webcam-Server;
Einträge in 'mangle' hab ich weg gelassen, sind ja auch hier bedeutungslos;
Geheimnisse werden hier auch nicht ausgeplaudert, ist im Wesentlichen die

[Zur Link-Ansicht bitte registrieren.]

-Firewall)

Code:
mini tuxfan # iptables -L                                           
Chain INPUT (policy DROP)                                           
target     prot opt source               destination                
LIMIT      all  --  anywhere             anywhere                   
ACCEPT     all  --  anywhere             anywhere            state RELATED,ESTABLISHED 
FLOOD      tcp  --  anywhere             anywhere                                      
ICMP       icmp --  anywhere             anywhere                                      
INVALID    tcp  --  anywhere             anywhere                                      
BASIC      all  --  anywhere             anywhere                                      
ACCEPT     all  --  anywhere             anywhere                                      
ACCEPT     all  --  anywhere             anywhere                                      

Chain FORWARD (policy DROP)
target     prot opt source               destination         
ACCEPT     all  --  anywhere             anywhere            state RELATED,ESTABLISHED 
ACCEPT     all  --  192.168.0.0/24       anywhere                                      
ACCEPT     tcp  --  anywhere             maxi.home.lan       tcp dpt:8090              
ACCEPT     udp  --  anywhere             maxi.home.lan       udp dpt:8090              

Chain OUTPUT (policy DROP)
target     prot opt source               destination         
ACCEPT     all  --  anywhere             anywhere            state RELATED,ESTABLISHED 
ACCEPT     all  --  anywhere            !192.168.0.0/24                                
ACCEPT     all  --  192.168.0.0/24       anywhere                                      
ACCEPT     all  --  anywhere             anywhere                                      

Chain BASIC (1 references)
target     prot opt source               destination         
DROP       tcp  --  anywhere             anywhere            tcp flags:!FIN,SYN,RST,ACK/SYN state NEW 
DROP       all  --  <dyn-IP des ISP>  anywhere                                              
DROP       all  --  localhost            anywhere                                                     
DROP       all  --  anywhere             192.168.0.0/24                                               
RETURN     all  --  anywhere             anywhere                                                     

Chain FLOOD (1 references)
target     prot opt source               destination         
ACCEPT     tcp  --  anywhere             anywhere            tcp flags:FIN,SYN,RST,ACK/SYN limit: avg 3/sec burst 5                                                                                                         
ACCEPT     tcp  --  anywhere             anywhere            tcp flags:FIN,SYN,RST,ACK/RST limit: avg 3/sec burst 5                                                                                                         
ACCEPT     icmp --  anywhere             anywhere            icmp echo-request limit: avg 3/sec burst 5       
DROP       tcp  --  anywhere             anywhere                                                             

Chain ICMP (1 references)
target     prot opt source               destination         
ACCEPT     icmp --  anywhere             anywhere            icmp echo-reply limit: avg 3/sec burst 5 
ACCEPT     icmp --  anywhere             anywhere            icmp destination-unreachable limit: avg 3/sec burst 5                                                                                                          
ACCEPT     icmp --  anywhere             anywhere            icmp echo-request limit: avg 3/sec burst 5       
ACCEPT     icmp --  anywhere             anywhere            icmp time-exceeded limit: avg 3/sec burst 5      
DROP       icmp --  anywhere             anywhere                                                             

Chain INVALID (1 references)
target     prot opt source               destination         
DROP       tcp  --  anywhere             anywhere            tcp flags:FIN,SYN,RST,PSH,ACK,URG/FIN,PSH,URG 
DROP       tcp  --  anywhere             anywhere            tcp flags:FIN,SYN,RST,PSH,ACK,URG/NONE        
DROP       tcp  --  anywhere             anywhere            tcp flags:SYN,RST/SYN,RST                     
DROP       tcp  --  anywhere             anywhere            tcp flags:FIN,SYN/FIN,SYN                     
DROP       tcp  --  anywhere             anywhere            tcp flags:FIN,SYN,RST,PSH,ACK,URG/FIN,PSH,URG 
DROP       tcp  --  anywhere             anywhere            tcp flags:FIN,SYN,RST,PSH,ACK,URG/NONE        
DROP       tcp  --  anywhere             anywhere            tcp flags:SYN,RST/SYN,RST                     
DROP       tcp  --  anywhere             anywhere            tcp flags:FIN,SYN/FIN,SYN
DROP       tcp  --  anywhere             anywhere            tcp flags:FIN,SYN,RST,PSH,ACK,URG/FIN,PSH,URG
DROP       tcp  --  anywhere             anywhere            tcp flags:FIN,SYN,RST,PSH,ACK,URG/NONE
DROP       tcp  --  anywhere             anywhere            tcp flags:SYN,RST/SYN,RST
DROP       tcp  --  anywhere             anywhere            tcp flags:FIN,SYN/FIN,SYN
DROP       tcp  --  anywhere             anywhere            tcp flags:FIN,SYN,RST,PSH,ACK,URG/FIN,PSH,URG
DROP       tcp  --  anywhere             anywhere            tcp flags:FIN,SYN,RST,PSH,ACK,URG/NONE
DROP       tcp  --  anywhere             anywhere            tcp flags:SYN,RST/SYN,RST
DROP       tcp  --  anywhere             anywhere            tcp flags:FIN,SYN/FIN,SYN
RETURN     all  --  anywhere             anywhere

Chain LIMIT (1 references)
target     prot opt source               destination
           tcp  --  anywhere             anywhere            tcp dpt:ssh state NEW recent: SET name: DEFAULT side: source
DROP       tcp  --  anywhere             anywhere            tcp dpt:ssh state NEW recent: UPDATE seconds: 120 hit_count: 4 name: DEFAULT side: source
RETURN     all  --  anywhere             anywhere
mini tuxfan # iptables -t nat -L
Chain PREROUTING (policy ACCEPT)
target     prot opt source               destination
DNAT       tcp  --  anywhere             anywhere            tcp dpt:8090 to:192.168.0.31
DNAT       udp  --  anywhere             anywhere            udp dpt:8090 to:192.168.0.31
REDIRECT   tcp  --  192.168.0.0/24       anywhere            tcp dpt:http redir ports 3128

Chain POSTROUTING (policy ACCEPT)
target     prot opt source               destination
MASQUERADE  all  --  192.168.0.0/24      !192.168.0.0/24

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination
mini tuxfan #
P.S. Wenn ich in etwa 2.5 bis 3 Stunden vom Pool-Billiard wieder zurück bin will ich Antworten
sehen, sonst geht hier heut Abend die Burg hoch :flam:
#1




Gismo
27.03.2010, 13:51 Uhr
Hab schon den ganzen Vormittag an dem Problem rumgebastelt; leider bislang immer noch ohne Erfolg :cry:

Der bislang letzte Versuch das NEO ins Netz zu kriegen sieht so aus:
Code:
echo 1 > /proc/sys/net/ipv4/ip_forward

iptables -I INPUT 1 -s 192.168.0.202 -j ACCEPT
iptables -I OUTPUT 1 -s 192.168.0.200 -j ACCEPT
#iptables -A POSTROUTING -t nat -j MASQUERADE -s 192.168.0.0/24

iptables -A FORWARD -i eth0 -d 192.168.0.202 -j ACCEPT
iptables -A FORWARD -i eth1 -s 192.168.0.200 -j ACCEPT

iptables -t nat -A PREROUTING -i eth0 -d 192.168.0.200 -j DNAT --to-destination 192.168.0.202
iptables -t nat -A PREROUTING -i eth1 -s 192.168.0.202 -j DNAT --to-destination 192.168.0.200

iptables -t nat -A PREROUTING -p tcp -s 192.168.0.202 -d 192.168.0.200 --dport domain -j DNAT --to-destination 192.168.0.11
iptables -t nat -A PREROUTING -p udp -s 192.168.0.202 -d 192.168.0.200 --dport domain -j DNAT --to-destination 192.168.0.11
#2


Facebook

Jahresarchive