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!

Ogłoszenie

Prosimy o pomoc dla małej Julki — przekaż 1% podatku na Fundacji Dzieciom zdazyć z Pomocą.
Więcej informacji na dug.net.pl/pomagamy/.

#1  2007-03-20 22:08:53

  Marek_boss - Członek DUG

Marek_boss
Członek DUG
Skąd: Pilawa
Zarejestrowany: 2006-06-27

iptables i netbios

O co chodzi?
Mój komp treningowy :) na którym mam postawiony router pomiędzy sieciami 10.0.0.0 i 192.168.1.0 ma IP eth0 10.0.0.1 oraz  ath0 192.168.1.1. Dopóki nie włączam tego firewalla (kod poniżej) wszystko jest cacy: mogę przeglądać spokojnie otoczenie sieciowe 10.0.0.0 windowsów i grupa robocza z nazwami kompów  ładnie mi się zgłasza.
Po włączeniu jest lipa. Co trzeba jeszcze dodać żeby można było normalnie przeglądać zasoby?

Mój firewall wygląda tak:

Kod:

#!/bin/bash

# wlaczenie w kernelu forwardowania 
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 nna laczenie sie z naszym zewnetrznym ip po ssh

iptables -A INPUT -i lo -j ACCEPT
iptables -A OUTPUT -o lo -j ACCEPT 
iptables -A FORWARD -o lo -j ACCEPT

############################## SAMBA #############################

iptables -A INPUT -p tcp --dport 137 -s 10.0.0.0/24 -m state --state NEW -j ACCEPT 
iptables -A INPUT -p udp --dport 137 -s 10.0.0.0/24 -m state --state NEW -j ACCEPT 
iptables -A INPUT -p tcp --dport 138 -s 10.0.0.0/24 -m state --state NEW -j ACCEPT
iptables -A INPUT -p udp --dport 138 -s 10.0.0.0/24 -m state --state NEW -j ACCEPT
iptables -A INPUT -p tcp --dport 139 -s 10.0.0.0/24 -m state --state NEW -j ACCEPT
iptables -A INPUT -p udp --dport 139 -s 10.0.0.0/24 -m state --state NEW -j ACCEPT


################################## ssh ##########################
iptables -A INPUT -s 0/0 -d 10.0.0.1 -p tcp --dport 22 -j ACCEPT
iptables -A OUTPUT -s 0/0 -d 10.0.0.1 -p tcp --dport 22 -j ACCEPT
iptables -A INPUT -s 0/0 -d 10.0.0.1 -p udp --dport 22 -j ACCEPT
iptables -A OUTPUT -s 0/0 -d 10.0.0.1 -p udp --dport 22 -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 nat -A POSTROUTING -s 192.168.1.0/24 -j MASQUERADE
iptables -A FORWARD -s 192.168.1.0/24 -j ACCEPT

Linux Registered User: #458169

Offline

 

#2  2007-03-20 23:24:26

  buli - Użytkownik

buli
Użytkownik
Skąd: Człuchów
Zarejestrowany: 2006-04-30

Re: iptables i netbios

wydaje mi sie ze ten firewall dziala na polityce..
najpierw wszystko zablokujemy a pozniej bedziemy otwierac poszczegolne furtki :)


blehh :F

Offline

 

#3  2007-03-21 00:38:52

  zielkam - były zielony_83 :)

zielkam
były zielony_83 :)
Skąd: Zawiercie
Zarejestrowany: 2006-05-06
Serwis

Re: iptables i netbios

otwórz jeszcze port 445


Zostałeś zarejestrowany jako użytkownik #416423 przez.. :mrgreen:
##
FluxboxPL | Mój Lepszy Świat | UnixyPL | Telenia VOIP dla ISP
JID: zielony@jabster.pl

Offline

 

#4  2007-03-21 10:17:27

  Marek_boss - Członek DUG

Marek_boss
Członek DUG
Skąd: Pilawa
Zarejestrowany: 2006-06-27

Re: iptables i netbios

Dopisałem to:

Kod:

iptables -A INPUT -p tcp --dport 445 -s 10.0.0.0/24 -m state --state NEW -j ACCEPT
iptables -A INPUT -p udp --dport 445 -s 10.0.0.0/24 -m state --state NEW -j ACCEPT

Teraz w otoczeniu sieciowym widze tylko siebie. Na kompach z XP jestem widziany normalnie.
Jak u siebie wpisze np. smb://10.0.0.2/ to wchodze w sasoby tamtego kompa, natomiast po nazwie NIE.


Linux Registered User: #458169

Offline

 

#5  2007-03-21 17:40:35

  Usnar - Członek DUG

Usnar
Członek DUG
Zarejestrowany: 2005-02-14

Re: iptables i netbios

Na twoim miejscu to bym nie liczyl na otoczenie sieciowe windy bo to jest bardzo zawodna sprawa. Jak chcesz zeby wszystkie komputery w sieci byly widoczne to skonfiguruj sobie dns

Offline

 

#6  2007-03-21 20:40:57

  BiExi - matka przelozona

BiExi
matka przelozona
Skąd: Gorlice
Zarejestrowany: 2004-04-16
Serwis

Re: iptables i netbios

Kod:

iptables -A FORWARD -s 10.0.0.0/24 -d 192.168.1.0 -j ACCEPT
iptables -A INPUT -s 10.0.0.0/24 -d 192.168.1.0 -j ACCEPT
iptables -A FORWARD -d 10.0.0.0/24 -s 192.168.1.0 -j ACCEPT
iptables -A INPUT -d 10.0.0.0/24 -s 192.168.1.0 -j ACCEPT

Co do otoczenia sieciwego to sprawa jest taka ze jak sie postawi sambe i zalaczy w niej seerver wins i ustawi sie go na terminalach to wiekszego problemu niema :]

Offline

 

#7  2007-03-21 21:07:43

  Marek_boss - Członek DUG

Marek_boss
Członek DUG
Skąd: Pilawa
Zarejestrowany: 2006-06-27

Re: iptables i netbios

Niestety BiExi po dodaniu tamtego wywala:

Kod:

Bad argument `192.168.1.0'

To się tyczyło mojego kompa na którym mam postawiony teraz router.


Teraz w otoczeniu sieciowym widze tylko siebie. Na kompach z XP jestem widziany normalnie.
Jak u siebie wpisze np. smb://10.0.0.2/ to wchodze w sasoby tamtego kompa, natomiast po nazwie NIE.

Próbowałem już dużo różnych wpisów, ale po włączeniu firewall-a wszyscy mi giną :(

PS. Jest jakiś edytor pod XP do pisania skryptów dla linux? Chodzi o znak końca linii.


Linux Registered User: #458169

Offline

 

#8  2007-03-22 12:00:37

  ba10 - Członek DUG

ba10
Członek DUG
Skąd: jesteś ?
Zarejestrowany: 2006-03-07
Serwis

Re: iptables i netbios


PS. Jest jakiś edytor pod XP do pisania skryptów dla linux? Chodzi o znak końca linii.

Może gvim ;)
ftp://ftp.vim.org/pub/vim/pc/gvim70.exe


"Jeżeli chcesz się nauczyć Linuksa, to pierwsze co musisz zrobić to odrzucić wszelkie przyzwyczajenia wyniesione z poprzedniego systemu. Twoja wiedza jest o tyle zgubna, że daje Ci poczucie że coś jednak wiesz — jednak w kontekście Linuksa prawdopodobnie nie wiesz jeszcze nic." Minio
Mój Blog, a później Tańczymy ;)

Offline

 

#9  2007-03-22 13:22:47

  Marek_boss - Członek DUG

Marek_boss
Członek DUG
Skąd: Pilawa
Zarejestrowany: 2006-06-27

Re: iptables i netbios

Nie moge sobie z tym poradzic :(

W XP-kach jestem normalnie widziany, natomiast Ja ich po netbios nie widze.
Pingi po IP sa odbijane, po nazwach juz nie :(

Samba jest napewno dobrze skonfigurowana, bo dopoki nie uruchomie skryptu firewall-a, wszystko dziala super.
Moj obecny skrypt:

Kod:

#!/bin/bash
##################### zmienne srodowiskowe #######################
# IP sieci wewnetrznej
IPSW=10.0.0.0/24
# IP sieci zewnetrznej
IPSZ=192.168.1.0/24
# Moje IP wewnetrzne
IPMW=10.0.0.1
############## wlaczenie w kernelu forwardowania #################
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 pelny ruch na interfejsie lo ##
iptables -A INPUT -i lo -j ACCEPT
iptables -A OUTPUT -o lo -j ACCEPT 
iptables -A FORWARD -o lo -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
############################### DNS ##############################
iptables -A INPUT -p tcp --dport 53 -j ACCEPT
iptables -A INPUT -p udp --dport 53 -j ACCEPT
############################## http i https ######################
iptables -A INPUT -p tcp --dport 80 -j ACCEPT
iptables -A INPUT -p udp --dport 80 -j ACCEPT
iptables -A INPUT -p tcp --dport 443 -j ACCEPT
iptables -A INPUT -p udp --dport 443 -j ACCEPT
######################## smtp oraz pop3 - oba z ssl ##############
iptables -A INPUT -p tcp --dport 25 -j ACCEPT
iptables -A INPUT -p udp --dport 25 -j ACCEPT
iptables -A INPUT -p tcp --dport 110 -j ACCEPT
iptables -A INPUT -p udp --dport 110 -j ACCEPT
iptables -A INPUT -p tcp --dport 465 -j ACCEPT
iptables -A INPUT -p udp --dport 465 -j ACCEPT
iptables -A INPUT -p tcp --dport 995 -j ACCEPT
iptables -A INPUT -p udp --dport 995 -j ACCEPT
################################## ssh ###########################
iptables -A INPUT -s 0/0 -d $IPMW -p tcp --dport 22 -j ACCEPT
iptables -A OUTPUT -s 0/0 -d $IPMW -p tcp --dport 22 -j ACCEPT
iptables -A INPUT -s 0/0 -d $IPMW -p udp --dport 22 -j ACCEPT
iptables -A OUTPUT -s 0/0 -d $IPMW -p udp --dport 22 -j ACCEPT
############################## SAMBA #############################
#iptables -I INPUT -i $IPSW -p udp --dport 137:139 -j ACCEPT
#iptables -I INPUT -i $IPSW -p tcp --dport 137:139 -j ACCEPT
#lub samba
iptables -A INPUT -p tcp --dport 137 -s $IPSW -m state --state NEW -j ACCEPT 
iptables -A INPUT -p udp --dport 137 -s $IPSW -m state --state NEW -j ACCEPT 
iptables -A INPUT -p tcp --dport 138 -s $IPSW -m state --state NEW -j ACCEPT
iptables -A INPUT -p udp --dport 138 -s $IPSW -m state --state NEW -j ACCEPT
iptables -A INPUT -p tcp --dport 139 -s $IPSW -m state --state NEW -j ACCEPT
iptables -A INPUT -p udp --dport 139 -s $IPSW -m state --state NEW -j ACCEPT
############################ otoczenie sieciowe dwoch sieci ##############
#iptables -A FORWARD -s $IPSW-d $IPSZ -j ACCEPT 
#iptables -A INPUT -s $IPSW -d $IPSZ -j ACCEPT 
#iptables -A FORWARD -d $IPSW -s $IPSZ -j ACCEPT 
#iptables -A INPUT -d $IPSW -s $IPSZ -j ACCEPT
#################################### osolek #######################
iptables -A INPUT -p tcp --dport 4663 -j ACCEPT
iptables -A INPUT -p udp --dport 4673 -j ACCEPT
################# udostepniaie internetu w sieci lokalnej##########
iptables -t nat -A POSTROUTING -s $IPSZ -j MASQUERADE
iptables -A FORWARD -s $IPSZ -j ACCEPT

Linux Registered User: #458169

Offline

 

#10  2007-03-22 14:08:08

  guzzi - Członek DUG

guzzi
Członek DUG
Skąd: Asteroida Linux
Zarejestrowany: 2005-03-31

Re: iptables i netbios

iptables -F
iptables -F INPUT
iptables -P INPUT DROP
iptables -A INPUT -i lo -j ACCEPT

iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT

iptables -A INPUT -s 192.168.1.0/24 -p udp --dport 137 -m state --state NEW -j ACCEPT
iptables -A INPUT -s 192.168.1.0/24 -p udp --dport 138 -m state --state NEW -j ACCEPT
iptables -A INPUT -s 192.168.1.0/24 -p tcp --dport 139 -m state --state NEW -j ACCEPT
iptables -A INPUT -s 192.168.1.0/24 -p tcp --dport 445 -m state --state NEW -j ACCEPT

iptables -A INPUT -s 192.168.2.0/24 -p udp --dport 137 -m state --state NEW -j ACCEPT
iptables -A INPUT -s 192.168.2.0/24 -p udp --dport 138 -m state --state NEW -j ACCEPT
iptables -A INPUT -s 192.168.2.0/24 -p tcp --dport 139 -m state --state NEW -j ACCEPT
iptables -A INPUT -s 192.168.2.0/24 -p tcp --dport 445 -m state --state NEW -j ACCEPT


I ma działać

Offline

 

#11  2007-03-22 17:29:38

  BiExi - matka przelozona

BiExi
matka przelozona
Skąd: Gorlice
Zarejestrowany: 2004-04-16
Serwis

Re: iptables i netbios

dopisz sobie tam maske /24

Offline

 

#12  2007-03-23 16:52:25

  Marek_boss - Członek DUG

Marek_boss
Członek DUG
Skąd: Pilawa
Zarejestrowany: 2006-06-27

Re: iptables i netbios

BiExi: Probowalem ale ciagle to samo :(
guzzi: I dziala :)

PS. Mam superkarambe z zainstalowanym monitorem sieci. O co chodzi z tym znikaniem transferu co 1s. tzn jest np. 22KB/s, 00KB/s, jest np 90KB/s, 00KB/s, 70KB/s, 00KB/s i tak cały czas zarowno na UL jak i DL. Wykres dosyc dziwnie wyglada tzn.  /////////


Linux Registered User: #458169

Offline

 

Stopka forum

Powered by PunBB
© Copyright 2002–2005 Rickard Andersson
To nie jest tylko forum, to nasza mała ojczyzna ;-)