Microsoft SQL Server + iptables

Konfiguracja serwerów, usług, itp.
arekk
Posty: 56
Rejestracja: 02 października 2006, 18:22

Microsoft SQL Server + iptables

Post autor: arekk »

Witam. Mam taka sytuacje w sieci lokalnej komputer o adresie 192.168.0.240 ma zainstalowany Microsoft SQL Server, ja np, z domu chce sie z nim połączyć a dokładnie z baza danych, wpisuję więc w regułkach taką oto składnie

Kod: Zaznacz cały

iptables -A FORWARD -i eth1 -s 83.18.234.26 -d 1433 -p tcp --dport 1433 -j ACCEPT
iptables -t nat -A PREROUTING -i eth0 -p tcp -s 83.18.234.26 --dport 1433 -j DNAT --to-destination 192.168.0.240
iptables -A FORWARD -i eth1 -s 83.18.234.26 -d 1434 -p udp --dport 1434 -j ACCEPT
iptables -t nat -A PREROUTING -i eth0 -p udp -s 83.18.234.26 --dport 1434 -j DNAT --to-destination 192.168.0.240
Gdzie eth0 jest to interfejs przez który wchodzi ruch ze świata (internet)


Potem wydając dwa następujące polecenia, aby sie upewnić czy wszystko jest OK

Kod: Zaznacz cały

debian:~# iptables -L
Chain INPUT (policy ACCEPT)
target     prot opt source               destination

Chain FORWARD (policy DROP)
target     prot opt source               destination
DROP       tcp  --  192.168.0.2          anywhere            #conn/32 > 50 ipp2p v0.8.0_rc3 --ipp2p
DROP       tcp  --  192.168.0.3          anywhere            #conn/32 > 50 ipp2p v0.8.0_rc3 --ipp2p
DROP       tcp  --  192.168.0.4          anywhere            #conn/32 > 50 ipp2p v0.8.0_rc3 --ipp2p
DROP       tcp  --  192.168.0.5          anywhere            #conn/32 > 50 ipp2p v0.8.0_rc3 --ipp2p
DROP       tcp  --  192.168.0.6          anywhere            #conn/32 > 50 ipp2p v0.8.0_rc3 --ipp2p
DROP       tcp  --  192.168.0.7          anywhere            #conn/32 > 50 ipp2p v0.8.0_rc3 --ipp2p
DROP       tcp  --  192.168.0.8          anywhere            #conn/32 > 50 ipp2p v0.8.0_rc3 --ipp2p
DROP       tcp  --  192.168.0.9          anywhere            #conn/32 > 50 ipp2p v0.8.0_rc3 --ipp2p
DROP       tcp  --  192.168.0.10         anywhere            #conn/32 > 50 ipp2p v0.8.0_rc3 --ipp2p
DROP       tcp  --  192.168.0.11         anywhere            #conn/32 > 50 ipp2p v0.8.0_rc3 --ipp2p
DROP       tcp  --  192.168.0.12         anywhere            #conn/32 > 50 ipp2p v0.8.0_rc3 --ipp2p
DROP       tcp  --  192.168.0.13         anywhere            #conn/32 > 50 ipp2p v0.8.0_rc3 --ipp2p
ACCEPT     all  --  192.168.0.2          anywhere            MAC 00:0C:76:E3:92:23
ACCEPT     all  --  192.168.0.3          anywhere            MAC 00:15:F2:17:BB:5A
ACCEPT     all  --  192.168.0.4          anywhere            MAC 00:18:F3:17:89:F3
ACCEPT     all  --  192.168.0.5          anywhere            MAC 00:C0:26:A3:8B:BE
ACCEPT     all  --  192.168.0.6          anywhere            MAC 00:0B:6A:C3:A9:63
ACCEPT     all  --  192.168.0.7          anywhere            MAC 00:C:D F:0F:97:46
ACCEPT     all  --  192.168.0.8          anywhere            MAC 00:0F:1F :D F:69:A5
ACCEPT     all  --  192.168.0.9          anywhere            MAC 00:15:F2:4B:3F:FA
ACCEPT     all  --  192.168.0.12         anywhere            MAC 00:11:43:A5:FC :D 3
ACCEPT     all  --  192.168.0.13         anywhere            MAC 00:14:85:3D:EA:95
ACCEPT     all  --  192.168.0.14         anywhere            MAC 00:06:5B:65:90:26
ACCEPT     all  --  anywhere             192.168.0.0/24      state NEW,RELATED,ESTABLISHED
ACCEPT     tcp  --  83.18.234.26         0.0.5.153           tcp dpt:ms-sql-s
ACCEPT     udp  --  83.18.234.26         0.0.5.154           udp dpt:ms-sql-m


oraz

Kod: Zaznacz cały

debian:~# iptables -t nat -nvL
Chain PREROUTING (policy ACCEPT 71906 packets, 5170K bytes)
 pkts bytes target     prot opt in     out     source               destination
    1    48 DNAT       tcp  --  eth0   *       83.18.234.26         0.0.0.0/0           tcp dpt:1433 to:192.168.0.240
    0     0 DNAT       udp  --  eth0   *       83.18.234.26         0.0.0.0/0           udp dpt:1434 to:192.168.0.240

Chain POSTROUTING (policy ACCEPT 110 packets, 6033 bytes)
 pkts bytes target     prot opt in     out     source               destination
  798 74926 MASQUERADE  all  --  *      eth0    192.168.0.0/24       0.0.0.0/0

Chain OUTPUT (policy ACCEPT 103 packets, 5697 bytes)
 pkts bytes target     prot opt in     out     source               destination
debian:~#
Lecz tu kompletna klapa, nie działa, ma ktoś jakieś pomysły gdzie leży wina nie jestem aż tak biegły w te klocki....Z góry dziękuje za wszelka pomoc...
Rad
Member
Posty: 1208
Rejestracja: 28 czerwca 2006, 15:05

Post autor: Rad »

Weź żeby puszczało w łańcuchu forward wychodzące na twój domowy ip.
miras_w
Beginner
Posty: 199
Rejestracja: 13 czerwca 2007, 19:32
Lokalizacja: Wejherowo

Post autor: miras_w »

mozesz podac jak wygląda twoja linijka udostepniania danej usługi po maku chodzi mi o linijke co daje wynik np:

Kod: Zaznacz cały

ACCEPT     all  --  192.168.0.2          anywhere            MAC 00:0C:76:E3:92:23
arekk
Posty: 56
Rejestracja: 02 października 2006, 18:22

Post autor: arekk »

To jest ta linijka która wiąże IP z MAC ale trzeba jeszcze dodać odpowiednie opcje w kernelu....

Kod: Zaznacz cały

#iptables -A FORWARD -i eth1 -o eth0 -s 192.168.0.21 -m mac --mac-source 00:06:5B:65:90:26 -j ACCEPT #WOLNE
//edit
używaj tagów code
mlyczek
ODPOWIEDZ