Nie jesteś zalogowany.
Jeśli nie posiadasz konta, zarejestruj je już teraz! Pozwoli Ci ono w pełni korzystać z naszego serwisu. Spamerom dziękujemy!
Prosimy o pomoc dla małej Julki — przekaż 1% podatku na Fundacji Dzieciom zdazyć z Pomocą.
Więcej informacji na dug.net.pl/pomagamy/.
Zawartość firewall:
#-----Zmienne globalne dla calego pakietu------# source /etc/firewall/users.conf source /etc/firewall/rates.conf source /etc/firewall/interfaces.conf source /etc/firewall/mac.conf #..............................................# # WLACZENIE FORWARDOWANIA # #..............................................# echo 1 > /proc/sys/net/ipv4/ip_forward #----------------------------------------------# # CZYSZCZENIE REGUL # #----------------------------------------------# iptables -F # czyszczenie wpisow iptables -X # usuniecie lancucha iptables -t nat -F # czyszczenie tablicy (-t) NAT iptables -t nat -X # usuniecie lancucha w tabeli #----------------------------------------------# # USTAWAIENIE POLITYKI DZIALANIA # #----------------------------------------------# iptables -P INPUT DROP # domyslna polityka lancucha iptables -P FORWARD DROP iptables -P OUTPUT ACCEPT #----------------------------------------------# # SSH DLA SERWERA # #----------------------------------------------# iptables -N SSH # utworzenie nowego lanvucha iptables -A INPUT -p tcp --dport 22 -j SSH iptables -A SSH -s $ip_wan_range -j ACCEPT iptables -A SSH -s $ip_lan_range -j ACCEPT iptables -A SSH -m limit --limit 5/s -j LOG # regula logowania iptables -A SSH -j DROP #iptables -A INPUT -i $lop -j ACCEPT # dodanie reguly do lancucha(-A), na interfejsie(-i), polityka(-j) #iptables -A FORWARD -o $lop -j ACCEPT #iptables -A INPUT -s 0/24 -d $ip_lan -p tcp --dport 22 -j ACCEPT # wybierani zrodla pakietu(-s), maska(-0/0), #iptables -A OUTPUT -s 0/24 -d $ip_lan -p tcp --dport 22 -j ACCEPT # adres pakietu(-d), protokol(-p) #iptables -A INPUT -s 0/24 -d $ip_lan -p udp --dport 22 -j ACCEPT # okreslenie portu docelowego(--dport) #iptables -A OUTPUT -s 0/24 -d $ip_lan -p tcp --dport 22 -j ACCEPT #iptables -A INPUT -s 0/24 -d $ip_wan -p tcp --dport 22 -j ACCEPT #iptables -A OUTPUT -s 0/24 -d $ip_wan -p tcp --dport 22 -j ACCEPT #iptables -A INPUT -s 0/24 -d $ip_wan -p udp --dport 22 -j ACCEPT #iptables -A OUTPUT -s 0/24 -d $ip_wan -p udp --dport 22 -j ACCEPT #----------------------------------------------# # POLACZENIA NAWIAZANE # #----------------------------------------------# iptables -A INPUT -j ACCEPT -m state --state ESTABLISHED,RELATED # zaladowanie modulu(-m), uzycie modulu(--modul) iptables -A FORWARD -j ACCEPT -m state --state ESTABLISHED,RELATED iptables -A OUTPUT -j ACCEPT -m state --state ESTABLISHED,RELATED #---------------DNS----------------------------# iptables -A INPUT -s $dns_1 -p udp -sport 53 -j ACCEPT iptables -A INPUT -s $dns_2 -p udp -sport 53 -j ACCEPT iptables -A INPUT -s $dns_3 -p udp -sport 53 -j ACCEPT #---------------FTP----------------------------# iptables -t mangle -A POSTROUTING -m layer7 --l7proto ftp -j MARK --set-mark 01 #------------BITTORRENT------------------------# iptables -t mangle -A POSTROUTING -m layer7 --l7proto bittorrent -j MARK --set-mark 001 iptables -t mangle -A POSTROUTING -m layer7 --l7proto ares -j MARK --set-mark 002 #--------------SSL-----------------------------# iptables -t mangle -A POSTROUTING -m layer7 --l7proto ssl -j MARK --set-mark 02 #-------------HTTP-----------------------------# iptables -t mangle -A POSTROUTING -m layer7 --l7proto http -j MARK --set-mark 03 #------------POCZTA----------------------------# iptables -t mangle -A POSTROUTING -m layer7 --l7proto smtp -j MARK --set-mark 04 iptables -t mangle -A POSTROUTING -m layer7 --l7proto pop3 -j MARK --set-mark 05 #----------------------------------------------# # HOSTS CONFIG # #----------------------------------------------# #-------------NOX.XEEN.PL----------------------# iptables -t nat -A POSTROUTING -s $u1 -j MASQUERADE iptables -A FORWARD -m mac --mac-source $mu1 -j ACCEPT #-----------PIETJA.XEEN.PL---------------------# iptables -t nat -A POSTROUTING -s $u8 -j MASQUERADE iptables -A FORWARD -m mac --mac-source $mu2 -j ACCEPT #---------HOT_SZPROT.XEEN.PL-------------------# iptables -t nat -A POSTROUTING -s $u2 -j MASQUERADE iptables -A FORWARD -m mac --mac-source $mu3 -j ACCEPT
po wystartowaniu tego skryptu dostaje:
root@nox:~# /etc/firewall/firewall iptables v1.4.0: multiple -s flags not allowed Try `iptables -h' or 'iptables --help' for more information. iptables v1.4.0: multiple -s flags not allowed Try `iptables -h' or 'iptables --help' for more information. iptables v1.4.0: multiple -s flags not allowed Try `iptables -h' or 'iptables --help' for more information.
i przestaje działac WWW, GG i inne rzeczy działaja.
Offline
prorokuję problem z DNS, prorokiem jestem marnym, ale obstawiałbym zmianę:
#---------------DNS----------------------------# iptables -A INPUT -s $dns_1 -p udp -sport 53 -j ACCEPT iptables -A INPUT -s $dns_2 -p udp -sport 53 -j ACCEPT iptables -A INPUT -s $dns_3 -p udp -sport 53 -j ACCEPT
na
#---------------DNS----------------------------# iptables -A INPUT -s $dns_1 -p udp --dport 53 -j ACCEPT iptables -A INPUT -s $dns_2 -p udp --dport 53 -j ACCEPT iptables -A INPUT -s $dns_3 -p udp --dport 53 -j ACCEPT
Offline
Ok dzieki, zaraz przetestuje. Mam natomiast inne pytanie. Nigdzie nie znalazlem wyjasnienia:
co mozna robic za pomoca : POSTROUNTING, PREROUTING kiedy stosowac do jakich uslug ( przykłaodowo)
oraz co mozna robic w tableach NAT i MANGLE
z góry dziekuje za odpowiedz
Offline
zajrzyj tutaj
Offline