Strona 1 z 1

[+] brak Internetu - modemu DSL

: 29 czerwca 2007, 13:56
autor: butek
Mam serwer linuksowy z dwiema kartami sieciowymi. Jedna 172.23.198.1/24 - sieć lokalna a druga 192.168.1.35 /24 odpowiedzialna jest za połączenie z Internetem Na serwerze działa proxy - squid i Dansguardian - program filtrujący strony (wymóg ministra edukacji bo serwer jest w szkole). Karta odpowiedzialna za Internet podłączona jest do rutera DSL o IP 192.168.1.1, a ten do modemu DSL. Internet niestety nie działa. Przed instalacją DSL miałem neostradę i karta internetowa miała adres 10.0.0.10/255.0.0.0 i to działało. Gdzie leży pies pochowany?
Fragment kodu pliku konfiguracyjnego dansguardian.conf:

Kod: Zaznacz cały

# Network Settings
# 
# the IP that DansGuardian listens on.  If left blank DansGuardian will
# listen on all IPs.  That would include all NICs, loopback, modem, etc.
# Normally you would have your firewall protecting this, but if you want
# you can limit it to only 1 IP.  Yes only one.
filterip = 172.23.198.1

# the port that DansGuardian listens to.
filterport = 8080

# the ip of the proxy (default is the loopback - i.e. this server)
proxyip = 172.23.198.1

# the port DansGuardian connects to proxy on
proxyport = 3128 
Squid działa na porcie 3128 i jest prawie nie zmieniony

Kod: Zaznacz cały

# Network Settings
# 
# the IP that DansGuardian listens on.  If left blank DansGuardian will
# listen on all IPs.  That would include all NICs, loopback, modem, etc.
# Normally you would have your firewall protecting this, but if you want
# you can limit it to only 1 IP.  Yes only one.
filterip = 172.23.198.1

# the port that DansGuardian listens to.
filterport = 8080

# the ip of the proxy (default is the loopback - i.e. this server)
proxyip = 172.23.198.1

# the port DansGuardian connects to proxy on
proxyport = 3128
Moje regułki iptables:

Kod: Zaznacz cały

echo 1 > /proc/sys/net/ipv4/ip_forward
# czyszczenie starych regul
iptables -F
iptables -X
iptables -t nat -X
iptables -t nat -F
# ustawienie polityki dzialania
iptables -P INPUT DROP
iptables -P FORWARD DROP
iptables -P OUTPUT ACCEPT
# zezwolenie na laczenie sie z naszym zewnetrznym ip po ssh

iptables -A INPUT -i eth0 -s 172.23.198.0/24 -j ACCEPT 
iptables -A INPUT -p icmp --icmp-type echo-request -j ACCEPT
iptables -A INPUT -i lo -j ACCEPT
iptables -A FORWARD -o lo -j ACCEPT

iptables -A INPUT -s 0/0 -d 172.23.198.1 -p tcp --dport 3128 -j ACCEPT
iptables -A OUTPUT -s 0/0 -d 172.23.198.1 -p tcp --dport 3128 -j ACCEPT
iptables -A INPUT -s 0/0 -d 172.23.198.1  -p udp --dport 3128 -j ACCEPT
iptables -A OUTPUT -s 0/0 -d 172.23.198.1 -p udp --dport 3128 -j ACCEPT

iptables -A INPUT -s 0/0 -d 172.23.198.1 -p tcp --dport 8080 -j ACCEPT
iptables -A OUTPUT -s 0/0 -d 172.23.198.1 -p tcp --dport 8080 -j ACCEPT
iptables -A INPUT -s 0/0 -d 172.23.198.1  -p udp --dport 8080 -j ACCEPT
iptables -A OUTPUT -s 0/0 -d 172.23.198.1 -p udp --dport 8080 -j ACCEPT


iptables -A INPUT -s 0/0 -d 172.23.198.0/24 -p tcp --dport 3128 -j ACCEPT
iptables -A OUTPUT -s 0/0 -d 172.23.198.0/24 -p tcp --dport 3128 -j ACCEPT
iptables -A INPUT -s 0/0 -d 172.23.198.0/24  -p udp --dport 3128 -j ACCEPT
iptables -A OUTPUT -s 0/0 -d 172.23.198.0/24 -p udp --dport 3128 -j ACCEPT

# polaczenia nawiazane
iptables -A INPUT -j ACCEPT -m state --state ESTABLISHED,RELATED
iptables -A FORWARD -j ACCEPT -m state --state ESTABLISHED,RELATED
iptables -A OUTPUT -j ACCEPT -m state --state ESTABLISHED,RELATED


# udostepniaie internetu w sieci lokalnej
iptables -t filter -A FORWARD -s 172.23.198.0/255.255.255.0 -d 0/0 -j ACCEPT
iptables -t filter -A FORWARD -s 0/0 -d 172.23.198.0/255.255.255.0 -j ACCEPT


iptables -t nat -A POSTROUTING -s 172.23.198.0/24 -j MASQUERADE
iptables -t nat -A PREROUTING -s 172.23.198.0/24  -p tcp --dport 80 -j REDIRECT --to-port 8080
iptables -t nat -A PREROUTING -s 172.23.198.0/255.255.255.0 -p tcp --dport 80 -j REDIRECT --to-port 3128

Po chwili.
Już chyba wiem. Nie ustawiłem rutingu na drugą kartę po zmianie adresu. Ale i tak proszę o uwagi krytyczne i analizę. Pingi na ruter 192.168.1.1 chodzą

Czy obie karty mogą mieć tą samą maskę?
Ruter umożliwia nadanie masek:
  • 255.255.255.0
    255.255.255.128
    255.255.255.192
    255.255.255.224
    255.255.255.240
    255.255.255.248
    255.255.255.252
Czyli maski rutera wymuszają nadanie maski karcie sieciowej odpowiedzialnej za Internet.

[Dodano: 2007-07-02, 18:57]
Przepraszam za zamieszanie. Wpisałem zły adres rutera jako bramy, ale wpadka.