PDA

Archiv verlassen und diese Seite im Standarddesign anzeigen : Kleine Probleme mit Router



Maduski
03.08.05, 13:22
Hallo zusammen!

Ich habe einen Router mit Suse 9.3.

Ich komme von meinen Clients aus nicht ins Netz (Gateway etc. ist richtig eingestellt).

Ich habe folgenden bekannte Guide benutzt:
http://linuxrouter.minots.net/index.php

(1) Internet am Rouer geht
(2) Anpingen meines Routers im Netzwerk geht auch
(3) Namensauflösung geht auch von den Clients (z.B. ping www.t-online.de liefert mir eine IP Adresse)
(4) Anpingen der Seiten (Namen wie IP-Adresse) liefert von den Clients aus aber immer eine Zeitüberschreitung

Ansonsten:
(A) Susefirewall2 läuft NICHT
(B) named und dslfirewall laufen (alles laut Runlevel Editor)

maconey
03.08.05, 15:04
ist den masquerading aktiviert?
was gibt

iptables -L -t nat aus?

da sollte sowas in der art rauskommen:

Chain PREROUTING (policy ACCEPT)
target prot opt source destination

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

Chain OUTPUT (policy ACCEPT)
target prot opt source destination

Ede
03.08.05, 15:19
http://www.linuxforen.de/forums/showthread.php?t=190211

Maduski
03.08.05, 15:31
Danke für die Antworten!

iptables -L -t nat gibt aus:


linuxserver:/etc/init.d # iptables -L -t nat
Chain PREROUTING (policy ACCEPT)
target prot opt source destination
DROP all -- 192.168.0.0/16 anywhere
DROP all -- 10.0.0.0/8 anywhere
DROP all -- 172.16.0.0/12 anywhere
DROP all -- loopback/8 anywhere

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

Chain OUTPUT (policy ACCEPT)
target prot opt source destination

Ich habe mein DSL-Modem an einer Netzwerkkarte mit IP 192.168.1.1 hängen. Mein Routernetzwerk hängt an 192.168.0.xxx (99=mein Router).

Mein DSL-Firewallskript sieht so aus:


#/bin/sh
################################################## ######
# #
# Skript: Firewall-Skript fuer DSL-Router #
# #
################################################## ######
# Author: idef.x@infinity-community.com #
# Datum : 16.02.2003 #
# Status: funktiostuechtiges Beispiel #
################################################## ######
# Dieses Skript darf und soll von jedem kopiert #
# und veraendert werden. #
# Fuer Anregungen aller Art bin ich jederzeit dankbar. #
################################################## ######


#--- Forwarding aktivieren ---
echo -n '.'
echo 1 >> /proc/sys/net/ipv4/ip_forward
echo 1 >> /proc/sys/net/ipv4/ip_dynaddr


#--- Netfilter-Module laden ---
echo -n '.'
modprobe ip_tables
echo -n '.'
modprobe iptable_filter
modprobe iptable_nat
echo -n '.'
modprobe ip_conntrack
modprobe ip_conntrack_ftp
modprobe ip_conntrack_irc
echo -n '.'
modprobe ip_nat_ftp
modprobe ip_nat_irc
echo -n '.'

# test
modprobe ipt_state
modprobe ipt_tcpmss
echo -n '.'
modprobe ipt_MASQUERADE
modprobe ipt_TCPMSS
modprobe ipt_LOG


#--- alte Regeln l�chen ---
echo -n '.'
iptables -t filter -F
iptables -t nat -F


#--- Default Policy setzen ---
echo -n '.'
iptables -t filter -P INPUT ACCEPT
iptables -t filter -P FORWARD ACCEPT
iptables -t filter -P OUTPUT ACCEPT
iptables -t nat -P PREROUTING ACCEPT
iptables -t nat -P POSTROUTING ACCEPT


#--- Masquerading aktivieren ---
echo -n '.'
iptables -t nat -A POSTROUTING -o ppp0 -s 192.168.0.0/16 -j MASQUERADE


#--- MSS der Pakete ins I-Net an die MTU von DSL (=1492) anpassen ---
echo -n '.'
iptables -A FORWARD -o ppp0 -p TCP --tcp-flags SYN,RST SYN -j TCPMSS --clamp-mss-to-pmtu


#---- Massnahmen gegen Angriffsversuche ergreifen ----------------------------->
echo -n '.'

#-- ungew�nliche/defekte Pakete verwerfen --
# forwarding
#iptables -A FORWARD -m unclean -j DROP
# local input
#iptables -A INPUT -m unclean -j DROP
#iptables -A INPUT -f -j DROP
#iptables -A INPUT -m state --state INVALID -j DROP
#iptables -A FORWARD -f -j DROP
#iptables -A FORWARD -m state --state INVALID -j DROP

#-- Pakete aus I-Net mit privaten (gefaelschten) Absenderadressen verwerfen --
# prerouting
iptables -t nat -A PREROUTING -i ppp0 -s 192.168.0.0/16 -j DROP
iptables -t nat -A PREROUTING -i ppp0 -s 10.0.0.0/8 -j DROP
iptables -t nat -A PREROUTING -i ppp0 -s 172.16.0.0/12 -j DROP
iptables -t nat -A PREROUTING -i ppp0 -s 127.0.0.0/8 -j DROP
# forwarding
iptables -A FORWARD -i ppp0 -s 192.168.0.0/16 -j DROP
iptables -A FORWARD -i ppp0 -s 10.0.0.0/8 -j DROP
iptables -A FORWARD -i ppp0 -s 172.16.0.0/12 -j DROP
iptables -A FORWARD -i ppp0 -s 127.0.0.0/8 -j DROP
# local input
iptables -A INPUT -i ppp0 -s 192.168.0.0/16 -j DROP
iptables -A INPUT -i ppp0 -s 10.0.0.0/8 -j DROP
iptables -A INPUT -i ppp0 -s 172.16.0.0/12 -j DROP
iptables -A INPUT -i ppp0 -s 127.0.0.0/8 -j DROP


#---- Destination-NAT aktivieren ---------------------------------------------->
echo -n '.'

#-- eMule-Verbindungen nach 192.168.1.5 leiten --
#iptables -t nat -A PREROUTING -i ppp0 -p TCP --dport 4662 -j DNAT --to-destination 192.168.1.5
#iptables -t nat -A PREROUTING -i ppp0 -p UDP --dport 5662 -j DNAT --to-destination 192.168.1.5


#---- bestimmte Verbindungen aus I-Net erlauben -------------------------------->
echo -n '.'

#-- HTTP --
#iptables -A INPUT -i ppp0 -p TCP --dport 80 -j ACCEPT

#-- SSH --
#iptables -A INPUT -i ppp0 -p TCP --dport 22 -j ACCEPT

#-- FTP (mit offenen Ports fr "passive mode") --
#iptables -A INPUT -i ppp0 -p TCP --dport 21 -j ACCEPT
#iptables -A INPUT -i ppp0 -p TCP --dport 49152:65534 -j ACCEPT

#-- Ping --
iptables -A INPUT -i ppp0 -p ICMP --icmp-type ping -j ACCEPT

#-- Destination-NAT fr lokales Netzwerk erlauben --
iptables -A FORWARD -i ppp0 -d 192.168.0.0/16 -j ACCEPT


#---- alle uebrigen Verbindungen aus I-Net abweisen --------------------------->
echo -n '.'
# forwarding
iptables -A FORWARD -i ppp0 -m state --state NEW,INVALID -j LOG
iptables -A FORWARD -i ppp0 -m state --state NEW,INVALID -j DROP
# local input
iptables -A INPUT -i ppp0 -m state --state NEW,INVALID -j LOG
iptables -A INPUT -i ppp0 -m state --state NEW,INVALID -j DROP


#---- Ende Firewall-Skript ---------------------------------------------------->
echo -n '.'

Und es gibt folgenden Status aus:

linuxserver:/etc/init.d # ./dslfirewall status

--- IPTable 'filter': ---

Chain INPUT (policy ACCEPT 125K packets, 106M bytes)
pkts bytes target prot opt in out source destination
0 0 DROP all -- ppp0 any 192.168.0.0/16 anywhere
0 0 DROP all -- ppp0 any 10.0.0.0/8 anywhere
0 0 DROP all -- ppp0 any 172.16.0.0/12 anywhere
0 0 DROP all -- ppp0 any loopback/8 anywhere
0 0 ACCEPT icmp -- ppp0 any anywhere anywhere icmp echo-request
0 0 LOG all -- ppp0 any anywhere anywhere state INVALID,NEW LOG level warning
0 0 DROP all -- ppp0 any anywhere anywhere state INVALID,NEW

Chain FORWARD (policy ACCEPT 4 packets, 240 bytes)
pkts bytes target prot opt in out source destination
0 0 TCPMSS tcp -- any ppp0 anywhere anywhere tcp flags:SYN,RST/SYN TCPMSS clamp to PMTU
0 0 DROP all -- ppp0 any 192.168.0.0/16 anywhere
0 0 DROP all -- ppp0 any 10.0.0.0/8 anywhere
0 0 DROP all -- ppp0 any 172.16.0.0/12 anywhere
0 0 DROP all -- ppp0 any loopback/8 anywhere
0 0 ACCEPT all -- ppp0 any anywhere 192.168.0.0/16
0 0 LOG all -- ppp0 any anywhere anywhere state INVALID,NEW LOG level warning
0 0 DROP all -- ppp0 any anywhere anywhere state INVALID,NEW

Chain OUTPUT (policy ACCEPT 59032 packets, 3946K bytes)
pkts bytes target prot opt in out source destination

--- IPTable 'nat': ---

Chain PREROUTING (policy ACCEPT 755 packets, 51346 bytes)
pkts bytes target prot opt in out source destination
0 0 DROP all -- ppp0 any 192.168.0.0/16 anywhere
0 0 DROP all -- ppp0 any 10.0.0.0/8 anywhere
0 0 DROP all -- ppp0 any 172.16.0.0/12 anywhere
0 0 DROP all -- ppp0 any loopback/8 anywhere

Chain POSTROUTING (policy ACCEPT 555 packets, 42206 bytes)
pkts bytes target prot opt in out source destination
0 0 MASQUERADE all -- any ppp0 192.168.0.0/16 anywhere

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

maconey
03.08.05, 15:45
ich hab im script/ausgabe jetzt keinen fehler gesehen.

was hast du auf den clients als gateway eingestellt? 192.168.0.99? hast du mal versucht auf dem router tcpdump laufen zu lassen, kommen überhaupt pakete die ins internet gehen sollen bei dem router an?

kannst du nochmal die ausgabe von

iptables -L -v -t nat
iptables -L -v

posten nachdem du schon ein paar verbindungsversuche von den clients gemacht hast?
dann sieht man vielleicht wo die pakete hängenbleiben!

Maduski
03.08.05, 15:56
ich hab im script/ausgabe jetzt keinen fehler gesehen.

was hast du auf den clients als gateway eingestellt? 192.168.0.99? hast du mal versucht auf dem router tcpdump laufen zu lassen, kommen überhaupt pakete die ins internet gehen sollen bei dem router an?

kannst du nochmal die ausgabe von

(1) iptables -L -v -t nat
(2) iptables -L -v

posten nachdem du schon ein paar verbindungsversuche von den clients gemacht hast?
dann sieht man vielleicht wo die pakete hängenbleiben!

Logisch, danke für die schnelle Hilfe!

(1)


linuxserver:/etc/init.d # iptables -L -v -t nat
Chain PREROUTING (policy ACCEPT 1133 packets, 76984 bytes)
pkts bytes target prot opt in out source destination
0 0 DROP all -- ppp0 any 192.168.0.0/16 anywhere
0 0 DROP all -- ppp0 any 10.0.0.0/8 anywhere
0 0 DROP all -- ppp0 any 172.16.0.0/12 anywhere
0 0 DROP all -- ppp0 any loopback/8 anywhere

Chain POSTROUTING (policy ACCEPT 689 packets, 53008 bytes)
pkts bytes target prot opt in out source destination
0 0 MASQUERADE all -- any ppp0 192.168.0.0/16 anywhere

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


(2)


linuxserver:/etc/init.d # iptables -L -v
Chain INPUT (policy ACCEPT 140K packets, 108M bytes)
pkts bytes target prot opt in out source destination
0 0 DROP all -- ppp0 any 192.168.0.0/16 anywhere
0 0 DROP all -- ppp0 any 10.0.0.0/8 anywhere
0 0 DROP all -- ppp0 any 172.16.0.0/12 anywhere
0 0 DROP all -- ppp0 any loopback/8 anywhere
0 0 ACCEPT icmp -- ppp0 any anywhere anywhere icmp echo-request
0 0 LOG all -- ppp0 any anywhere anywhere state INVALID,NEW LOG level warning
0 0 DROP all -- ppp0 any anywhere anywhere state INVALID,NEW

Chain FORWARD (policy ACCEPT 47 packets, 2540 bytes)
pkts bytes target prot opt in out source destination
0 0 TCPMSS tcp -- any ppp0 anywhere anywhere tcp flags:SYN,RST/SYN TCPMSS clamp to PMTU
0 0 DROP all -- ppp0 any 192.168.0.0/16 anywhere
0 0 DROP all -- ppp0 any 10.0.0.0/8 anywhere
0 0 DROP all -- ppp0 any 172.16.0.0/12 anywhere
0 0 DROP all -- ppp0 any loopback/8 anywhere
0 0 ACCEPT all -- ppp0 any anywhere 192.168.0.0/16
0 0 LOG all -- ppp0 any anywhere anywhere state INVALID,NEW LOG level warning
0 0 DROP all -- ppp0 any anywhere anywhere state INVALID,NEW

Chain OUTPUT (policy ACCEPT 76119 packets, 12M bytes)
pkts bytes target prot opt in out source destination
linuxserver:/etc/init.d #

Als Gateway kommt natürlich 192.168.0.99 zum Einsatz, die DNS-Namensauflösung klappt auch von den Clients.

EDIT: Unter 9.0 hat das alles noch vorzüglich funktioniert. :confused:

tcpdump sieht so aus (man schaue auf www.t-online.de, als ich die Adresse angepingt hab):


linuxserver:/etc/init.d # tcpdump
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on eth0, link-type EN10MB (Ethernet), capture size 96 bytes

16:53:48.645142 IP 192.168.0.10.instl_boots > linuxserver.site.netbios-ssn: P 205233274:205233327(53) ack 2015166531 win 64240 NBT Packet
16:53:48.645581 IP linuxserver.site.netbios-ssn > 192.168.0.10.instl_boots: P 1:54(53) ack 53 win 2532 NBT Packet
16:53:48.768672 IP 192.168.0.10.instl_boots > linuxserver.site.netbios-ssn: . ack 54 win 64187
16:54:22.773704 IP 192.168.0.10.instl_boots > linuxserver.site.netbios-ssn: P 53:106(53) ack 54 win 64187 NBT Packet
16:54:22.773924 IP linuxserver.site.netbios-ssn > 192.168.0.10.instl_boots: P 54:107(53) ack 106 win 2532 NBT Packet
16:54:22.773960 IP linuxserver.site.netbios-ssn > 192.168.0.10.instl_boots: P 107:111(4) ack 106 win 2532 NBT Packet
16:54:22.774326 IP 192.168.0.10.instl_boots > linuxserver.site.netbios-ssn: . ack 111 win 64130
16:54:43.645844 IP 192.168.0.10 > www.t-online.de: icmp 40: echo request seq 9216
16:54:48.884633 IP 192.168.0.10 > www.t-online.de: icmp 40: echo request seq 9472
16:54:54.385215 IP 192.168.0.10 > www.t-online.de: icmp 40: echo request seq 9728
16:54:56.902175 IP 192.168.0.10.instl_boots > linuxserver.site.netbios-ssn: P 106:159(53) ack 111 win 64130 NBT Packet
16:54:56.902621 IP linuxserver.site.netbios-ssn > 192.168.0.10.instl_boots: P 111:164(53) ack 159 win 2532 NBT Packet
16:54:57.025865 IP 192.168.0.10.instl_boots > linuxserver.site.netbios-ssn: . ack 164 win 64077
16:54:59.885804 IP 192.168.0.10 > www.t-online.de: icmp 40: echo request seq 9984

maconey
03.08.05, 16:10
iptables scheint zu passen, nur greift keine einzige regel! warum ist da wohl die frage...

was gibt ifconfig aus? (vllt hast du interfaces verwechselt?) gibts überhaupt ein ppp0?

gibt cat /proc/sys/net/ipv4/ip_forward 1 aus? sonst probier (kein >>)

echo 1 > /proc/sys/net/ipv4/ip_forward

das hab ich nämlich noch nie gesehn :-)

so langsam bin ich überfragt :ugly:

Maduski
03.08.05, 16:19
Ok, könnte sein, dass die Interfaces umbenannt worden sind. Ich bin leider ein Linuxn00b und übersehe manchmal auch einfachste Sachen.

Interface-Config:


linuxserver:/etc/init.d # ifconfig
dsl0 Protokoll:Punkt-zu-Punkt Verbindung
inet Adresse:84.146.1.93 P-z-P:217.0.116.92 Maske:255.255.255.255
UP PUNKTZUPUNKT RUNNING NOARP MULTICAST MTU:1492 Metric:1
RX packets:11840 errors:0 dropped:0 overruns:0 frame:0
TX packets:10198 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 Sendewarteschlangenlänge:3
RX bytes:9052851 (8.6 Mb) TX bytes:1230734 (1.1 Mb)

eth0 Protokoll:Ethernet Hardware Adresse 00:0A:E6:A0:7D:B5
inet Adresse:192.168.0.99 Bcast:192.168.0.255 Maske:255.255.255.0
inet6 Adresse: fe80::20a:e6ff:fea0:7db5/64 Gültigkeitsbereich:Verbindung
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:1840049 errors:0 dropped:0 overruns:0 frame:0
TX packets:613729 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 Sendewarteschlangenlänge:1000
RX bytes:1636703855 (1560.8 Mb) TX bytes:47508302 (45.3 Mb)
Interrupt:5 Basisadresse:0xd400

eth1 Protokoll:Ethernet Hardware Adresse 00:30:84:29:D8:02
inet Adresse:192.168.1.1 Bcast:192.168.1.255 Maske:255.255.255.0
inet6 Adresse: fe80::230:84ff:fe29:d802/64 Gültigkeitsbereich:Verbindung
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:12080 errors:0 dropped:0 overruns:0 frame:0
TX packets:10706 errors:0 dropped:0 overruns:0 carrier:0
collisions:51 Sendewarteschlangenlänge:1000
RX bytes:9327827 (8.8 Mb) TX bytes:1508069 (1.4 Mb)
Interrupt:5 Basisadresse:0xef00

lo Protokoll:Lokale Schleife
inet Adresse:127.0.0.1 Maske:255.0.0.0
inet6 Adresse: ::1/128 Gültigkeitsbereich:Maschine
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:5780 errors:0 dropped:0 overruns:0 frame:0
TX packets:5780 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 Sendewarteschlangenlänge:0
RX bytes:510825 (498.8 Kb) TX bytes:510825 (498.8 Kb)

Muss ich statt dem ppp0 überall dsl0 schreiben??


gibt cat /proc/sys/net/ipv4/ip_forward 1 aus? sonst probier (kein >>)

Ja gibt 1 aus, was bedeutet diese Abfrage?

maconey
03.08.05, 16:21
cat /proc/sys/net/ipv4/ip_forward 1

das gibt einfach die "datei" /proc/sys/net/ipv4/ip_forward aus

>Muss ich statt dem ppp0 überall dsl0 schreiben??

ja! das ist auf jeden fall ein fehler, deswegen greift keine iptables regel!

danach sollte es eigentlich funktionieren!

Maduski
03.08.05, 16:39
Ja funzt jetzt auch, danke!

Wenn mir noch wer bei meinem Sambaproblem helfen kann, würde eigentlich alles funktionieren, wie es vorher war. :D
http://www.linuxforen.de/forums/showthread.php?t=190953