Freesco, NND, CDN, EOS
http://forum.freesco.pl/

ehhhh, juz 2 tygodnie, iptables, forward, thttpd ...
http://forum.freesco.pl/viewtopic.php?f=22&t=10318
Strona 1 z 1

Autor:  milkdrinker [ sobota, 17 grudnia 2005, 00:21 ]
Tytuł:  ehhhh, juz 2 tygodnie, iptables, forward, thttpd ...

http://tasior.iglu.cz/nnd/rc.zewip

witam wszystkich,

mam następujący problem, razem z hx'em (darkiem wszechmogącym ;) ) konfigurowalismy moje nnd, niceshaper, imp_p2p, etc... wszystko zapier... jak należy,
mam problem z dwiema kwestiami, pierwsżą jest thttpd, i co ważniejsza druga to forward.

po kolei:

dzerżawie internet od gościa drogą radiową, 1MB,

(internet) ---wlan ---- (ap:10.0.0.129)---- kabel (router NND : 10.0.0.229 | 192.168.0.1 ) , ----- lan .....

i teraz tak, dostalem zewnetrzny ip 83.18.xx.xx poprzez ten skrypt http://tasior.iglu.cz/nnd/rc.zewip

... pierwszą ważną kwestią jest to że nie dziala forward portów, pogrzebalem troche i oto fakty

stawiam serwer www, na porcie 80 na (192.168.0.1 [czyli u niego 10.0.0.129 ] .. na zewnątrz widać mnie jako 83.18.xx.xx , po przeskanowaniu tego ip z zewnątrz i sprawdzeniu czy dziala, wszystko jest wporządku, czyli
_____
nmap 83.18.xx.xx
80 www open ..
end.
_____
strona uruchamia się


nmap 192.168.0.1
80 www open ..
end.
_____
strona uruchamia się


namp 10.0.0.129
80 www open ..
end.
_____
strona uruchamia się


czyli wszystko jest ok ...

teraz robię tak... zmieniam port thhtpd na np. 81 .. uruchamiam ./thhtpd restart ... [wykonane]

skanuje siec

_____
namp 10.0.0.129
81 www open ..
end.
_____
strona uruchamia się

namp 192.168.0.1
81 www open ..
end.
_____
strona uruchamia się

i z zewnątrz

nmap 83.18.xx.xx
PORT STATE SERVICE
81/tcp filtered hosts2-ns
________
strona nie uruchamia się

:( , oto moje iptables :

[root@RCNdeamon rc.d]# iptables -L
Chain INPUT (policy DROP)
target prot opt source destination
ACCEPT all -- anywhere anywhere
DROP tcp -- anywhere anywhere multiport dports 135,445
ACCEPT tcp -- anywhere anywhere tcp dpt:www
ACCEPT tcp -- anywhere anywhere tcp dpt:ftp-data
ACCEPT tcp -- anywhere anywhere tcp dpt:ftp
ACCEPT tcp -- anywhere anywhere tcp dpt:ssh
REJECT tcp -- anywhere anywhere tcp dpt:auth reject-with icmp-port-unreachable
REJECT tcp -- anywhere anywhere tcp dpt:1080 reject-with icmp-port-unreachable
ACCEPT icmp -- anywhere anywhere icmp echo-request limit: avg 1/sec burst 5
ACCEPT all -- Komp_2 anywhere
ACCEPT all -- Komp_4 anywhere
ACCEPT all -- Komp_5 anywhere
ACCEPT all -- Komp_6 anywhere
ACCEPT all -- Komp_7 anywhere
ACCEPT all -- Komp_8 anywhere
ACCEPT all -- Komp_9 anywhere
ACCEPT all -- Komp_10 anywhere
ACCEPT all -- Komp_11 anywhere
ACCEPT all -- Komp_12 anywhere
ACCEPT all -- Komp_13 anywhere
ACCEPT all -- Komp_20 anywhere
ACCEPT all -- 192.168.0.29 anywhere
ACCEPT all -- anywhere anywhere state RELATED,ESTABLISHED

Chain FORWARD (policy DROP)
target prot opt source destination
ACCEPT all -- anywhere anywhere
DROP tcp -- anywhere anywhere multiport dports 135,445
DROP tcp -- Komp_2 anywhere tcp flags:SYN,RST,ACK/SYN #conn/32 > 50
DROP tcp -- Komp_4 anywhere tcp flags:SYN,RST,ACK/SYN #conn/32 > 50
DROP tcp -- Komp_5 anywhere tcp flags:SYN,RST,ACK/SYN #conn/32 > 50
DROP tcp -- Komp_6 anywhere tcp flags:SYN,RST,ACK/SYN #conn/32 > 50
DROP tcp -- Komp_9 anywhere tcp flags:SYN,RST,ACK/SYN #conn/32 > 50
DROP tcp -- Komp_10 anywhere tcp flags:SYN,RST,ACK/SYN #conn/32 > 50
DROP tcp -- Komp_11 anywhere tcp flags:SYN,RST,ACK/SYN #conn/32 > 50
DROP tcp -- Komp_13 anywhere tcp flags:SYN,RST,ACK/SYN #conn/32 > 50
ACCEPT all -- Komp_2 anywhere
ACCEPT all -- Komp_4 anywhere
ACCEPT all -- Komp_5 anywhere
ACCEPT all -- Komp_6 anywhere
ACCEPT all -- Komp_7 anywhere
ACCEPT all -- Komp_8 anywhere
ACCEPT all -- Komp_9 anywhere
ACCEPT all -- Komp_10 anywhere
ACCEPT all -- Komp_11 anywhere
ACCEPT all -- Komp_12 anywhere
ACCEPT all -- Komp_13 anywhere
ACCEPT all -- Komp_20 anywhere
ACCEPT all -- 192.168.0.29 anywhere
ACCEPT all -- anywhere anywhere state RELATED,ESTABLISHED

Chain OUTPUT (policy ACCEPT)
target prot opt source destination
[root@RCNdeamon rc.d]#




... wydaje mi się że tutaj również jest problem z forward...

używam firewall czerwo.. tam jest śliczny skrypt konfigurujący dla debili :), i nie dziala

próbowałem wszystkiego... np. w sieci lan jest ap o adresie 192.168.0.4 i otwartym portem 80 , do administracji przez www

doszedlem do wniosku że jeżeli chodzi port 80 na routerze, i nie jest fitrowany (?!?) to bede mógł zrobić przekierowanie do maszyny 192.160.0.4 ..teeeeeeeeeeeeeeeeeeeee .. lipa

po zrobieniu forwardm na wszystkie możliwe sposoby czyli :
#Reguly przekierowywania, użyj skryptu aby modyfikować
0/0 both 0/0:80 192.168.0.4:80
10.0.0.229 both 0/0:80 192.168.0.4:80
83.18.76.107 both 0/0:80 192.168.0.4:80
192.168.0.1 both 0/0:80 192.168.0.4:80
, razem i odzielnie .... niestety nie dziala

iptables wygląda teraz tak :
[root@RCNdeamon rc.d]# iptables -L
Chain INPUT (policy DROP)
target prot opt source destination
ACCEPT all -- anywhere anywhere
DROP tcp -- anywhere anywhere multiport dports 135,445
ACCEPT all -- Komp_7 anywhere
ACCEPT tcp -- anywhere anywhere tcp dpt:www
ACCEPT tcp -- anywhere anywhere tcp dpt:ftp-data
ACCEPT tcp -- anywhere anywhere tcp dpt:ftp
ACCEPT tcp -- anywhere anywhere tcp dpt:ssh
REJECT tcp -- anywhere anywhere tcp dpt:auth reject-with icmp-port-unreachable
REJECT tcp -- anywhere anywhere tcp dpt:1080 reject-with icmp-port-unreachable
ACCEPT icmp -- anywhere anywhere icmp echo-request limit: avg 1/sec burst 5
ACCEPT all -- Komp_2 anywhere
ACCEPT all -- Komp_4 anywhere
ACCEPT all -- Komp_5 anywhere
ACCEPT all -- Komp_6 anywhere
ACCEPT all -- Komp_7 anywhere
ACCEPT all -- Komp_8 anywhere
ACCEPT all -- Komp_9 anywhere
ACCEPT all -- Komp_10 anywhere
ACCEPT all -- Komp_11 anywhere
ACCEPT all -- Komp_12 anywhere
ACCEPT all -- Komp_13 anywhere
ACCEPT all -- Komp_20 anywhere
ACCEPT all -- 192.168.0.29 anywhere
ACCEPT all -- anywhere anywhere state RELATED,ESTABLISHED

Chain FORWARD (policy DROP)
target prot opt source destination
ACCEPT all -- anywhere anywhere
DROP tcp -- anywhere anywhere multiport dports 135,445
DROP tcp -- Komp_2 anywhere tcp flags:SYN,RST,ACK/SYN #conn/32 > 50
DROP tcp -- Komp_4 anywhere tcp flags:SYN,RST,ACK/SYN #conn/32 > 50
DROP tcp -- Komp_5 anywhere tcp flags:SYN,RST,ACK/SYN #conn/32 > 50
DROP tcp -- Komp_6 anywhere tcp flags:SYN,RST,ACK/SYN #conn/32 > 50
DROP tcp -- Komp_9 anywhere tcp flags:SYN,RST,ACK/SYN #conn/32 > 50
DROP tcp -- Komp_10 anywhere tcp flags:SYN,RST,ACK/SYN #conn/32 > 50
DROP tcp -- Komp_11 anywhere tcp flags:SYN,RST,ACK/SYN #conn/32 > 50
DROP tcp -- Komp_13 anywhere tcp flags:SYN,RST,ACK/SYN #conn/32 > 50
ACCEPT tcp -- anywhere Komp_3 tcp dpt:www
ACCEPT tcp -- Komp_3 anywhere tcp spt:www
ACCEPT udp -- anywhere Komp_3 udp dpt:www
ACCEPT udp -- Komp_3 anywhere udp spt:www
ACCEPT tcp -- anywhere Komp_3 tcp dpt:www
ACCEPT tcp -- Komp_3 anywhere tcp spt:www
ACCEPT udp -- anywhere Komp_3 udp dpt:www
ACCEPT udp -- Komp_3 anywhere udp spt:www
ACCEPT tcp -- anywhere Komp_3 tcp dpt:www
ACCEPT tcp -- Komp_3 anywhere tcp spt:www
ACCEPT udp -- anywhere Komp_3 udp dpt:www
ACCEPT udp -- Komp_3 anywhere udp spt:www
ACCEPT tcp -- anywhere Komp_3 tcp dpt:www
ACCEPT tcp -- Komp_3 anywhere tcp spt:www
ACCEPT udp -- anywhere Komp_3 udp dpt:www
ACCEPT udp -- Komp_3 anywhere udp spt:www
ACCEPT all -- Komp_2 anywhere
ACCEPT all -- Komp_4 anywhere
ACCEPT all -- Komp_5 anywhere
ACCEPT all -- Komp_6 anywhere
ACCEPT all -- Komp_7 anywhere
ACCEPT all -- Komp_8 anywhere
ACCEPT all -- Komp_9 anywhere
ACCEPT all -- Komp_10 anywhere
ACCEPT all -- Komp_11 anywhere
ACCEPT all -- Komp_12 anywhere
ACCEPT all -- Komp_13 anywhere
ACCEPT all -- Komp_20 anywhere
ACCEPT all -- 192.168.0.29 anywhere
ACCEPT all -- anywhere anywhere state RELATED,ESTABLISHED

Chain OUTPUT (policy ACCEPT)
target prot opt source destination
[root@RCNdeamon rc.d]#



...
czy ktoś pomoże mi rozwązać tą łamigłówkę ?!?!?!?!?!?, naprawdę nie mam do tego zdrowia :/
moj gg to 3625368

pzdr i pomocy

Autor:  tasiorek [ sobota, 17 grudnia 2005, 00:39 ]
Tytuł: 

Maly edit ;)
wpisz:
iptables -I INPUT -p tcp --dport 81 -j ACCEPT
I zobacz, czy wtedy serwer thttpd na porcie 81 bedzie widoczny spoza sieci.

Autor:  hx [ sobota, 17 grudnia 2005, 00:52 ]
Tytuł: 

wygląda to dokładnie tak


(internet)---(serwer z skryptem zew ip) ---wlan ---- (ap:10.0.0.129)---- kabel (router NND : 10.0.0.229 | 192.168.0.1 ) , ----- lan .....

Autor:  milkdrinker [ sobota, 17 grudnia 2005, 01:13 ]
Tytuł: 

DZIALA!!! , TERAZ TYLKO TEN FORWARD... CO DALEJ?

Autor:  tasiorek [ sobota, 17 grudnia 2005, 01:19 ]
Tytuł: 

Nie zebym sie pogubil, ale rozumiem ze masz zew ip na swoim NND (nie hx'a) i teraz chcesz przekierowac jakis port do kompa w LANie (np. 192.168.0.2), jesli tak to www.wiki.nnd.freesco.pl

Autor:  milkdrinker [ sobota, 17 grudnia 2005, 01:46 ]
Tytuł: 

dalej robię gdzieś błąd, próbowałem przez firewalla, prz iptables...
source adres powinienem uzywac 10.0.0.229, czy 83.18.xx.xx (nadany)?!?

iptables -t nat -A PREROUTING -i eth0 -p TCP -d 10.0.0.229 --dport 900 -j REDIRECT --to 192.168.0.4:80

nie dziala

iptables -t nat -A PREROUTING -i eth0 -p TCP -d 83.18.xx.xx--dport 900 -j REDIRECT --to 192.168.0.4:80

nie dziala


iptables -t nat -A PREROUTING -i eth0 -p TCP -d 10.0.0.229 --dport 900 -j DNAT --to 192.168.0.4:80

nie dziala

iptables -t nat -A PREROUTING -i eth0 -p TCP -d 83.18.xx.xx--dport 900 -j DNAT --to 192.168.0.4:80

nie dziala


&^%$&^%$&$#%$#^%$# wrrrr

Autor:  tasiorek [ sobota, 17 grudnia 2005, 01:54 ]
Tytuł: 

Bo nie czytasz dokladnie...
iptables -I FORWARD -p tcp -d 192.168.0.4 -j ACCEPT
iptables -t nat -A PREROUTING -p tcp -i eth0 --dport 900 -j DNAT --to 192.168.0.4:80

Autor:  milkdrinker [ sobota, 17 grudnia 2005, 02:04 ]
Tytuł: 

ufff, nie czytam, bo nie wiem zabradzo gdzie mam czytać??!?! nie lda kazdego iptables to chleb powszedni... nie wiem czy te reguły dodać czy zastosować 'odzienie'
po wklepaniu ich , dalej 900 nie chodzi,

przepraszam za moją niewiedzę, ale gdzies się tego muszę nauczyć, a książki czy wiki, to trochę błądzenie w kółko i tygodnie pracy

:/

Autor:  tasiorek [ sobota, 17 grudnia 2005, 02:14 ]
Tytuł: 

Jesli Twoj eth0 ma ip 10.0.0.229, to te regulki sa poprawne i szczerze mowiac nie mam pomyslu dlaczego to nie dziala.
Za niewiedze nie masz co przepraszac, ale zapalu do nauki to Ty nie masz ;) Wiki nnd wcale nie jest takie obszerne, a jak chcesz poczytac o iptables to zacznij tu: http://szluug.org/pliki/wyklady/2004/28 ... filter.pdf
Sprobuj jeszcze przekierowac port 80 na 192.168.0.4 wedlug opisu stad: http://www.wiki.nnd.freesco.pl/index.ph ... gramie_p2p

Autor:  marask [ sobota, 17 grudnia 2005, 16:25 ]
Tytuł: 

czy ja dobrze rozumiem, że uruchamiasz thttpd na porcie 81 a przekierowujesz port 80?

Autor:  milkdrinker [ sobota, 17 grudnia 2005, 17:12 ]
Tytuł: 

uruchamiam www na porcie 80, ale na innej MASZYNIE ! (192.168.0.4) i na 192.168.0.1 przekierowuje z 81 (1) na 80(4) i lipa, i nie mówcie że tak się nie da zrobić bo na freesco 0.27 i 0.3x , robi się to w 30 sec.

pzdr

Autor:  milkdrinker [ sobota, 17 grudnia 2005, 17:33 ]
Tytuł: 

zrobilem, tak jak na wiki

aby nie popierdolić, otworzylem sertwer www na porcie 4343 na komputerze o adresie IP 192.168.0.4 !!!!

a na 192.168.0.1 (router)
wpisalem nastepujące regułki
iptables -I FORWARD -p tcp -d 192.168.0.4 --dport 4343 -j ACCEPT
iptables -t nat -A PREROUTING -p tcp -i eth0 --dport 4343 -j DNAT --to 192.168.0.4

i dalej liiiiiiiiipaaaaaaaaaaaaaaaa

nie ma przekierowania ani na eth0 (10.0.0.229) ani na eth1(192.168.0.1)

iptables po oberacji wyglada tak
_________________
[root@RCNdeamon maya]# iptables -I FORWARD -p tcp -d 192.168.0.4 --dport 4343 -j ACCEPT
[root@RCNdeamon maya]# iptables -t nat -A PREROUTING -p tcp -i eth0 --dport 4343 -j DNAT --to 192.168.0.4
[root@RCNdeamon maya]# iptables -L
Chain INPUT (policy DROP)
target prot opt source destination
ACCEPT all -- anywhere anywhere
DROP tcp -- anywhere anywhere multiport dports 135,445
ACCEPT all -- Komp_7 anywhere
ACCEPT tcp -- anywhere anywhere tcp dpt:www
ACCEPT tcp -- anywhere anywhere tcp dpt:ftp-data
ACCEPT tcp -- anywhere anywhere tcp dpt:ftp
ACCEPT tcp -- anywhere anywhere tcp dpt:ssh
REJECT tcp -- anywhere anywhere tcp dpt:auth reject-with icmp-port-unreachable
REJECT tcp -- anywhere anywhere tcp dpt:1080 reject-with icmp-port-unreachable
ACCEPT icmp -- anywhere anywhere icmp echo-request limit: avg 1/sec burst 5
ACCEPT all -- Komp_2 anywhere
ACCEPT all -- Komp_4 anywhere
ACCEPT all -- Komp_5 anywhere
ACCEPT all -- Komp_6 anywhere
ACCEPT all -- Komp_7 anywhere
ACCEPT all -- Komp_8 anywhere
ACCEPT all -- Komp_9 anywhere
ACCEPT all -- Komp_10 anywhere
ACCEPT all -- Komp_11 anywhere
ACCEPT all -- Komp_12 anywhere
ACCEPT all -- Komp_13 anywhere
ACCEPT all -- Komp_20 anywhere
ACCEPT all -- 192.168.0.29 anywhere
ACCEPT all -- anywhere anywhere state RELATED,ESTABLISHED

Chain FORWARD (policy DROP)
target prot opt source destination
ACCEPT tcp -- anywhere Komp_3 tcp dpt:4343
ACCEPT all -- anywhere anywhere
DROP tcp -- anywhere anywhere multiport dports 135,445
DROP tcp -- Komp_2 anywhere tcp flags:SYN,RST,ACK/SYN #conn/32 > 50
DROP tcp -- Komp_4 anywhere tcp flags:SYN,RST,ACK/SYN #conn/32 > 50
DROP tcp -- Komp_5 anywhere tcp flags:SYN,RST,ACK/SYN #conn/32 > 50
DROP tcp -- Komp_6 anywhere tcp flags:SYN,RST,ACK/SYN #conn/32 > 50
DROP tcp -- Komp_9 anywhere tcp flags:SYN,RST,ACK/SYN #conn/32 > 50
DROP tcp -- Komp_10 anywhere tcp flags:SYN,RST,ACK/SYN #conn/32 > 50
DROP tcp -- Komp_11 anywhere tcp flags:SYN,RST,ACK/SYN #conn/32 > 50
DROP tcp -- Komp_13 anywhere tcp flags:SYN,RST,ACK/SYN #conn/32 > 50
ACCEPT all -- Komp_2 anywhere
ACCEPT all -- Komp_4 anywhere
ACCEPT all -- Komp_5 anywhere
ACCEPT all -- Komp_6 anywhere
ACCEPT all -- Komp_7 anywhere
ACCEPT all -- Komp_8 anywhere
ACCEPT all -- Komp_9 anywhere
ACCEPT all -- Komp_10 anywhere
ACCEPT all -- Komp_11 anywhere
ACCEPT all -- Komp_12 anywhere
ACCEPT all -- Komp_13 anywhere
ACCEPT all -- Komp_20 anywhere
ACCEPT all -- 192.168.0.29 anywhere
ACCEPT all -- anywhere anywhere state RELATED,ESTABLISHED

Chain OUTPUT (policy ACCEPT)
target prot opt source destination
[root@RCNdeamon maya]#
_____________________________

oczywisie nie musze dodawac ze w lokalu wpisuje 192.168.0.4:4343 i odpala się strona!

Autor:  Anonymous [ sobota, 17 grudnia 2005, 19:00 ]
Tytuł: 

Wklej no ten twój skrypt do iptables, bo kolejność reguł ma znaczenie.
Poza tym nie wiem jak to ma działać, skoro masz:

Spróbuj też wywalić wszystko co masz w firewallu oprócz masq, ustawić wszystkie polityki na ACCEPT i po POSTROUTING w skrypcie dać:
: [/] [] ()
    iptables -t nat -A PREROUTING -p TCP -s 0/0 --dport 81 -j DNAT --to 192.168.0.4:80


Pozdrawiam.

Autor:  milkdrinker [ niedziela, 18 grudnia 2005, 01:43 ]
Tytuł: 

dzieki pomocy kilku osób rozwiązałem problem ,wiec sam odpowiadam na swoje pytanie :>

1. każdy komputer do którego robimy przekierowanie, powinien być przepuszczany przez maskarade, czyli musi mieć dostęp do inetu
2. musi mieć ustwioną bramę internetową
3. przekierowanie można zrobić przez kreatora np. w firewall czerwo lub przez iptables, etc.

oto regułki:
iptables -t nat -A PREROUTING -p tcp --dport 900 -j DNAT --to 192.168.0.5:80
iptables -I FORWARD -p tcp -d 192.168.0.5 --dport 80 -j ACCEPT

na tym przykładzie przekierowujemy ruch do komputera w sieci lokalnej 192.168.0.5 na port 80
na zewnątrz będzie nasłuchiwał port 900

czyli : internet ----- 192.168.0.1:900 (firewall)----> 192.168.0.6:80(client)

pozdrawiam

Strona 1 z 1 Strefa czasowa UTC+2godz.
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/