Temat: multiSSID z izolacją klientów

Jak spowodować aby klienci w sieci dla gości nie mieli dostępu do routera? Znaczy np FTP, SAMBA itp
Podstawowa sieć to 192.168.2.0, dla gości 192.168.3.0 . Będąc zalogowanym do sieci dla gości jestem w stanie wpisać 192.168.2.1 i uzyskać dostęp do udostępnianych dysków (SAMBA).

kombinowałem coś z iptables, ale nie bardzo mi idzie:]

iptables -I FORWARD -d 192.168.3.0/255.255.255.0  -s 192.168.2.1 -j DROP




Opis co zrobiłem:


Wydzieliłem osobną sieć dla 'gości' na Wi-Fi. Czyli interfejs osobny plus podłączenie do niego drugiej sieci bezprzewodowej działającej na tym samym radiu.

Dodałem wpisy do /etc/config/firewall:

config 'zone'
        option 'name' 'hotspot'
        option 'network' 'hotspot'
        option 'input' 'ACCEPT'
        option 'output' 'ACCEPT'
        option 'forward' 'REJECT'

config 'forwarding'
        option 'src' 'lan'
        option 'dest' 'wan'

config 'forwarding'
        option 'src' 'hotspot'
        option 'dest' 'wan'


network:

config 'interface' 'loopback'
        option 'ifname' 'lo'
        option 'proto' 'static'
        option 'ipaddr' '127.0.0.1'
        option 'netmask' '255.0.0.0'

config 'interface' 'lan'
        option 'ifname' 'eth0.1'
        option 'type' 'bridge'
        option 'proto' 'static'
        option 'netmask' '255.255.255.0'
        option 'ipaddr' '192.168.2.1'
        option 'dns' '192.168.2.1'

config 'interface' 'wan'
        option 'ifname' 'eth0.2'
        option 'proto' 'dhcp'

config 'interface' 'hotspot'
       option 'ifname' 'eth0.3'
       option 'type' 'bridge'
       option 'proto' 'static'
       option 'netmask' '255.255.255.0'
       option 'ipaddr' '192.168.3.1'
#      option 'dns' '192.168.3.1'


config 'switch'
        option 'name' 'rtl8366rb'
        option 'reset' '1'
        option 'enable_vlan' '1'

config 'switch_vlan'
        option 'device' 'rtl8366rb'
        option 'vlan' '1'
        option 'ports' '1 2 3 4 5t'

config 'switch_vlan'
        option 'device' 'rtl8366rb'
        option 'vlan' '2'
        option 'ports' '0 5t'

#config 'switch_vlan'
#       option 'device' 'rt18366rb'
#       option 'vlan' '3'

wireless:

config 'wifi-device' 'radio0'
        option 'type' 'mac80211'
        option 'macaddr' '94:0c:6d:ac:51:1a'
        list 'ht_capab' 'SHORT-GI-40'
        list 'ht_capab' 'DSSS_CCK-40'
        option 'hwmode' '11ng'
        option 'htmode' 'HT40+'
        option 'txpower' '15'
        option 'channel' '1'

config 'wifi-iface' 'cfg2'
        option 'device' 'radio0'
        option 'mode' 'ap'
        option 'network' 'lan'
        option 'ssid' 'Gargoyle'
        option 'encryption' 'wpa2'
        option 'key' 'xxxx'
        option 'server' '192.168.2.1'
        option 'port' '1812'

config 'wifi-iface' 'cfg3'
        option 'device' 'radio0'
        option 'mode' 'ap'
        option 'network' 'hotspot'
        option 'ssid' 'konkurencja'
        option 'encryption' 'psk2'
        option 'key' 'xxx'

TL-WR1043ND + Gargoyle PL || WRT54GL

2

Odp: multiSSID z izolacją klientów

Uwal na firewallu wszystko co nie chodzi z sieci 2.1

iptables -I INPUT ! -s 192.168.2.1/24 -d 192.168.2.1 -j DROP

coś takiego, chociaż nie sprawdzałem.

Masz niepotrzebny router, uszkodzony czy nie - chętnie przygarnę go.

3

Odp: multiSSID z izolacją klientów

No ok. teraz się nie da na na 2.1 ale na 3.1 jest ta sama SAMBA.

TL-WR1043ND + Gargoyle PL || WRT54GL

4

Odp: multiSSID z izolacją klientów

Najprościej to w konfigu samby powiedzieć jej na jakim interfejsie ma słuchać - 100% będzie tylko na wymienionym i żadnym innym.

Masz niepotrzebny router, uszkodzony czy nie - chętnie przygarnę go.

5 (edytowany przez micolajevicz 2011-01-23 18:14:58)

Odp: multiSSID z izolacją klientów

dodałem do /etc/samba/smb.conf do sekcji [global]
interfases = 192.168.2.0/24
tylko coś to nadpisuje przy restarcie:/

P.S.
zmieniłem w /etc/samba/smb.conf.template . Już nie nadpisuje ale wejść na \\192.168.3.1 dalej się da.

na iptables to trzeba jakiegoś commita zrobić? to filtrowanie co założyłem na 2.1 po restarcie przestało działać.

TL-WR1043ND + Gargoyle PL || WRT54GL

6

Odp: multiSSID z izolacją klientów

interfaces jak już.

Masz niepotrzebny router, uszkodzony czy nie - chętnie przygarnę go.

7 (edytowany przez snifer 2011-01-23 21:44:14)

Odp: multiSSID z izolacją klientów

Jak chcesz wyciąć cały dostęp z klasy 192.168.3.0/24 to

iptables -I INPUT -s 192.168.3.0/24 --dport 53 -j ACCEPT #inaczej nie zadziała ludkom dns
iptables -I INPUT -s 192.168.3.0/24  -j DROP

dopisujesz to do /etc/firewall.user

Archer C7 v.2 + LEDE by Cezary http://beta.speedtest.net/pl/result/6621599402

8 (edytowany przez micolajevicz 2011-01-24 16:19:01)

Odp: multiSSID z izolacją klientów

Wiem Cezary, że 'interfaces'. Literówka w poście.

Wywala mi coś takiego

root@Gargoyle:~# iptables -I INPUT -s 192.168.3.0/24 --dport 53 -j ACCEPT
iptables v1.4.6: unknown option `--dport'
Try `iptables -h' or 'iptables --help' for more information.

na stronie http://www.dd-wrt.com/wiki/index.php/Iptables_command stoi że --dport jest, więc? Mam jakąś dupiatą wersję iptables?

TL-WR1043ND + Gargoyle PL || WRT54GL

9

Odp: multiSSID z izolacją klientów

Protokół musisz podać.

Masz niepotrzebny router, uszkodzony czy nie - chętnie przygarnę go.

10 (edytowany przez micolajevicz 2011-01-24 20:10:18)

Odp: multiSSID z izolacją klientów

Wpis jest ok.

iptables -I INPUT -p udp -s 192.168.3.0/24 --dport 53 -j ACCEPT
iptables -I INPUT -p tcp -s 192.168.3.0/24 --dport 53 -j ACCEPT
iptables -I INPUT -s 192.168.3.0/24  -j DROP

tylko że firewall DNS'a nie przepuszcza teraz hmm

TL-WR1043ND + Gargoyle PL || WRT54GL

11

Odp: multiSSID z izolacją klientów

Zrobiłem tak jak napisał snifer. Nie ma dostępu do samby, ale stron tez się nie da otwierać.
Jak ręcznie na kompie wpiszę serwer DNS (8.8.8.8) do wszystko chodzi.

Dodałem w /etc/config/network do interfejsu "hotspot" (od tej sieci) wpis dns na 8.8.8.8 ale potem w kompie i tak jest 192.168.3.1 .

Możecie doradzić coś z tymi iptables?

config 'interface' 'hotspot'
        option 'ifname' 'eth0.3'
        option 'type' 'bridge'
        option 'proto' 'static'
        option 'netmask' '255.255.255.0'
        option 'ipaddr' '192.168.3.1'
        option 'dns' '8.8.8.8'

TL-WR1043ND + Gargoyle PL || WRT54GL

12 (edytowany przez snifer 2011-01-25 23:06:29)

Odp: multiSSID z izolacją klientów

Nie działa dns czy nie przechodzą pakiety? Jak robisz ping to tłumaczy nazwy na ip? Sprawdź czy działa ping do 8.8.8.8 z kompa i z rutera.
Pokaż iptables -L

Archer C7 v.2 + LEDE by Cezary http://beta.speedtest.net/pl/result/6621599402

13

Odp: multiSSID z izolacją klientów

Właśnie, co właściwie teraz nie działa? Lub co ma nie działać?

Masz niepotrzebny router, uszkodzony czy nie - chętnie przygarnę go.

14 (edytowany przez micolajevicz 2011-01-26 00:06:55)

Odp: multiSSID z izolacją klientów

Z kompa na 192.168.3.0 :
  Ping wp.pl nie działa.
  Ping 8.8.8.8 działa.

Z routera oba działają.

Jak podłączę się kompem do sieci 192.168.3.0 to nie chodzi gg, strony, czyli DNS (pakiety dns'a, tak?)
Ping na adresy ip chodzią, np , 8.8.8.8
Jak ustawię na sztywno w kompie DNS na 8.8.8.8 to wszystko śmiga normalnie.

Ma to sens co mówię smile ?

root@Gargoyle:~# iptables -L
Chain INPUT (policy ACCEPT)
target     prot opt source               destination
DROP       all  --  192.168.3.0/24       anywhere
ACCEPT     tcp  --  192.168.3.0/24       anywhere            tcp dpt:53
ACCEPT     udp  --  192.168.3.0/24       anywhere            udp dpt:53
ACCEPT     all  --  anywhere             anywhere            state RELATED,ESTAB                                                                             LISHED
ACCEPT     all  --  anywhere             anywhere
syn_flood  tcp  --  anywhere             anywhere            tcp flags:FIN,SYN,R                                                                             ST,ACK/SYN
input_rule  all  --  anywhere             anywhere
input      all  --  anywhere             anywhere

Chain FORWARD (policy DROP)
target     prot opt source               destination
zone_wan_MSSFIX  all  --  anywhere             anywhere
ACCEPT     all  --  anywhere             anywhere            state RELATED,ESTAB                                                                             LISHED
forwarding_rule  all  --  anywhere             anywhere
forward    all  --  anywhere             anywhere
reject     all  --  anywhere             anywhere

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination
ACCEPT     all  --  anywhere             anywhere            state RELATED,ESTAB                                                                             LISHED
ACCEPT     all  --  anywhere             anywhere
output_rule  all  --  anywhere             anywhere
output     all  --  anywhere             anywhere

Chain forward (1 references)
target     prot opt source               destination
zone_lan_forward  all  --  anywhere             anywhere
zone_wan_forward  all  --  anywhere             anywhere
zone_hotspot_forward  all  --  anywhere             anywhere

Chain forwarding_hotspot (1 references)
target     prot opt source               destination

Chain forwarding_lan (1 references)
target     prot opt source               destination

Chain forwarding_rule (1 references)
target     prot opt source               destination
nat_reflection_fwd  all  --  anywhere             anywhere

Chain forwarding_wan (1 references)
target     prot opt source               destination

Chain input (1 references)
target     prot opt source               destination
zone_lan   all  --  anywhere             anywhere
zone_wan   all  --  anywhere             anywhere
zone_hotspot  all  --  anywhere             anywhere

Chain input_hotspot (1 references)
target     prot opt source               destination

Chain input_lan (1 references)
target     prot opt source               destination

Chain input_rule (1 references)
target     prot opt source               destination

Chain input_wan (1 references)
target     prot opt source               destination

Chain nat_reflection_fwd (1 references)
target     prot opt source               destination

Chain output (1 references)
target     prot opt source               destination
zone_lan_ACCEPT  all  --  anywhere             anywhere
zone_wan_ACCEPT  all  --  anywhere             anywhere
zone_hotspot_ACCEPT  all  --  anywhere             anywhere

Chain output_rule (1 references)
target     prot opt source               destination

Chain reject (7 references)
target     prot opt source               destination
REJECT     tcp  --  anywhere             anywhere            reject-with tcp-res                                                                             et
REJECT     all  --  anywhere             anywhere            reject-with icmp-po                                                                             rt-unreachable

Chain syn_flood (1 references)
target     prot opt source               destination
RETURN     tcp  --  anywhere             anywhere            tcp flags:FIN,SYN,R                                                                             ST,ACK/SYN limit: avg 25/sec burst 50
DROP       all  --  anywhere             anywhere

Chain zone_hotspot (1 references)
target     prot opt source               destination
input_hotspot  all  --  anywhere             anywhere
zone_hotspot_ACCEPT  all  --  anywhere             anywhere

Chain zone_hotspot_ACCEPT (2 references)
target     prot opt source               destination
ACCEPT     all  --  anywhere             anywhere
ACCEPT     all  --  anywhere             anywhere

Chain zone_hotspot_DROP (0 references)
target     prot opt source               destination
DROP       all  --  anywhere             anywhere
DROP       all  --  anywhere             anywhere

Chain zone_hotspot_MSSFIX (0 references)
target     prot opt source               destination
TCPMSS     tcp  --  anywhere             anywhere            tcp flags:SYN,RST/S                                                                             YN TCPMSS clamp to PMTU

Chain zone_hotspot_REJECT (1 references)
target     prot opt source               destination
reject     all  --  anywhere             anywhere
reject     all  --  anywhere             anywhere

Chain zone_hotspot_forward (1 references)
target     prot opt source               destination
zone_wan_ACCEPT  all  --  anywhere             anywhere
forwarding_hotspot  all  --  anywhere             anywhere
zone_hotspot_REJECT  all  --  anywhere             anywhere

Chain zone_lan (1 references)
target     prot opt source               destination
input_lan  all  --  anywhere             anywhere
zone_lan_ACCEPT  all  --  anywhere             anywhere

Chain zone_lan_ACCEPT (2 references)
target     prot opt source               destination
ACCEPT     all  --  anywhere             anywhere
ACCEPT     all  --  anywhere             anywhere

Chain zone_lan_DROP (0 references)
target     prot opt source               destination
DROP       all  --  anywhere             anywhere
DROP       all  --  anywhere             anywhere

Chain zone_lan_MSSFIX (0 references)
target     prot opt source               destination
TCPMSS     tcp  --  anywhere             anywhere            tcp flags:SYN,RST/S                                                                             YN TCPMSS clamp to PMTU

Chain zone_lan_REJECT (1 references)
target     prot opt source               destination
reject     all  --  anywhere             anywhere
reject     all  --  anywhere             anywhere

Chain zone_lan_forward (1 references)
target     prot opt source               destination
ACCEPT     all  --  anywhere             anywhere
zone_wan_ACCEPT  all  --  anywhere             anywhere
forwarding_lan  all  --  anywhere             anywhere
zone_lan_REJECT  all  --  anywhere             anywhere

Chain zone_wan (1 references)
target     prot opt source               destination
ACCEPT     udp  --  anywhere             anywhere            udp dpt:68
ACCEPT     icmp --  anywhere             anywhere            icmp echo-request
input_wan  all  --  anywhere             anywhere
zone_wan_REJECT  all  --  anywhere             anywhere

Chain zone_wan_ACCEPT (3 references)
target     prot opt source               destination
ACCEPT     all  --  anywhere             anywhere
ACCEPT     all  --  anywhere             anywhere

Chain zone_wan_DROP (0 references)
target     prot opt source               destination
DROP       all  --  anywhere             anywhere
DROP       all  --  anywhere             anywhere

Chain zone_wan_MSSFIX (1 references)
target     prot opt source               destination
TCPMSS     tcp  --  anywhere             anywhere            tcp flags:SYN,RST/S                                                                             YN TCPMSS clamp to PMTU

Chain zone_wan_REJECT (2 references)
target     prot opt source               destination
reject     all  --  anywhere             anywhere
reject     all  --  anywhere             anywhere

Chain zone_wan_forward (1 references)
target     prot opt source               destination
forwarding_wan  all  --  anywhere             anywhere
zone_wan_REJECT  all  --  anywhere             anywhere
root@Gargoyle:~#

TL-WR1043ND + Gargoyle PL || WRT54GL

15

Odp: multiSSID z izolacją klientów

echo "nameserver 8.8.8.8" > /tmp/resolv.conf.auto
echo "nameserver 8.8.8.8" >> /etc/resolv.conf

Masz niepotrzebny router, uszkodzony czy nie - chętnie przygarnę go.

16

Odp: multiSSID z izolacją klientów

Dodałem te wpisy o serwerze DNS do resolv.conf
Niestety bez zmian:/

ipconfig /all (fragment na kompie podpiętym do sieci 192.168.3.0)

Wireless LAN adapter Wireless Network Connection:

   Connection-specific DNS Suffix  . : lan
   Description . . . . . . . . . . . : Intel(R) WiFi Link 5100 AGN
   Physical Address. . . . . . . . . : 00-22-FB-C2-4B-AA
   DHCP Enabled. . . . . . . . . . . : Yes
   Autoconfiguration Enabled . . . . : Yes
   Link-local IPv6 Address . . . . . : fe80::d106:3b68:c573:d1df%11(Preferred)
   IPv4 Address. . . . . . . . . . . : 192.168.3.108(Preferred)
   Subnet Mask . . . . . . . . . . . : 255.255.255.0
   Lease Obtained. . . . . . . . . . : 26 stycznia 2011 10:25:46
   Lease Expires . . . . . . . . . . : 26 stycznia 2011 22:25:47
   Default Gateway . . . . . . . . . : 192.168.3.1
   DHCP Server . . . . . . . . . . . : 192.168.3.1
   DHCPv6 IAID . . . . . . . . . . . : 184558331
   DHCPv6 Client DUID. . . . . . . . : 00-01-00-01-12-67-B8-52-00-1D-BA-B1-AE-F1

   DNS Servers . . . . . . . . . . . : 192.168.3.1
   NetBIOS over Tcpip. . . . . . . . : Enabled

TL-WR1043ND + Gargoyle PL || WRT54GL

17

Odp: multiSSID z izolacją klientów

Dostałeś adres od routera, wiec tu jest dobrze. Dns w ogóle działa na routerze?

Masz niepotrzebny router, uszkodzony czy nie - chętnie przygarnę go.

18

Odp: multiSSID z izolacją klientów

hmmm

root@Gargoyle:~# ps | grep dns
3398 nobody     912 S    /usr/sbin/dnsmasq -K -D -y -Z -b -E -s lan -S /lan/ -
11779 root      1352 S    grep dns


root@Gargoyle:~# ping wp.pl
PING wp.pl (212.77.100.101): 56 data bytes
64 bytes from 212.77.100.101: seq=0 ttl=247 time=24.937 ms
64 bytes from 212.77.100.101: seq=1 ttl=247 time=25.196 ms
64 bytes from 212.77.100.101: seq=2 ttl=247 time=24.697 ms
^C
--- wp.pl ping statistics ---
3 packets transmitted, 3 packets received, 0% packet loss
round-trip min/avg/max = 24.697/24.943/25.196 ms
root@Gargoyle:~#

/etc/config/dhcp

config dnsmasq
        option domainneeded     1
        option boguspriv        1
        option filterwin2k      0  # enable for dial on demand
        option localise_queries 1
        option rebind_protection 1  # disable if upstream must serve RFC1918 addresses
        option rebind_localhost 1  # enable for RBL checking and similar services
        #list rebind_domain example.lan  # whitelist RFC1918 responses for domains
        option local    '/lan/'
        option domain   'lan'
        option expandhosts      1
        option nonegcache       0
        option authoritative    1
        option readethers       1
        option leasefile        '/tmp/dhcp.leases'
        option resolvfile       '/tmp/resolv.conf.auto'
        #list server            '/mycompany.local/1.2.3.4'
        #option nonwildcard     1
        #list interface         br-lan
        #list notinterface      lo
        #list bogusnxdomain     '64.94.110.11'

config dhcp lan
        option interface        lan
        option start    100
        option limit    150
        option leasetime        12h

config dhcp wan
        option interface        wan
        option ignore   1


config dhcp hotspot
        option interface        hotspot
        option start    100
        option limit    150
        option leasetime        12h

TL-WR1043ND + Gargoyle PL || WRT54GL

19

Odp: multiSSID z izolacją klientów

Restartowałeś dnsmasq? może biedaczek interfejsu nie widzi

Masz niepotrzebny router, uszkodzony czy nie - chętnie przygarnę go.

20

Odp: multiSSID z izolacją klientów

No nie robiłem tego.

Teraz robię i po restarcie wywala ten wpis.

root@Gargoyle:~# echo "nameserver 8.8.8.8" > /tmp/resolv.conf.auto
root@Gargoyle:~# echo "nameserver 8.8.8.8" >> /etc/resolv.conf
root@Gargoyle:~# tail /etc/resolv.conf
search lan
nameserver 127.0.0.1
nameserver 8.8.8.8
root@Gargoyle:~# /etc/init.d/dnsmasq restart
root@Gargoyle:~# tail /etc/resolv.conf
search lan
nameserver 127.0.0.1
root@Gargoyle:~#

TL-WR1043ND + Gargoyle PL || WRT54GL

21

Odp: multiSSID z izolacją klientów

To defacto to w option dns w sekcji lan powinno być. Zresztą - jeżeli dostał poprawną odpowiedź na dhcp z wanu to powinien mieć serwery dns w /tmp/resolv.conf.auto.

Masz niepotrzebny router, uszkodzony czy nie - chętnie przygarnę go.

22

Odp: multiSSID z izolacją klientów

No i jest w /tmp/resolv.conf.auto.

nameserver 8.8.8.8

To może ja sobie z tym dam spokój co? i dostawie 2 router?

TL-WR1043ND + Gargoyle PL || WRT54GL

23

Odp: multiSSID z izolacją klientów

Kolego ty zablokowałeś sobie cały ruch tymi zmianami firewalla.
Jest zła kolejność regułek od razu widać i dlatego dns nie działa
Wykasuj ty swoje wiersze czyli

iptables -I INPUT -p udp -s 192.168.3.0/24 --dport 53 -j ACCEPT
iptables -I INPUT -p tcp -s 192.168.3.0/24 --dport 53 -j ACCEPT
iptables -I INPUT -s 192.168.3.0/24  -j DROP

a wstaw poniższe zamiast tych powyżej

iptables -I INPUT -s 192.168.3.0/24 -j DROP
iptables -I INPUT -p udp -s 192.168.3.0/24 --dport 53 -j ACCEPT

kolejność w/w regułek MUSI zostać zachowana tak jak podałem. To jest ważne.
jak chcesz dodać dodatkową regułę piszesz na końcu np. icmp

iptables -I INPUT -s 192.168.3.0/24 -j DROP
iptables -I INPUT -p udp -s 192.168.3.0/24 --dport 53 -j ACCEPT
iptables -I INPUT -p icmp -s 192.168.3.0/24 -j ACCEPT

I nie blokuj icmp bo to złe rozwiązanie. ew. lepiej ograniczyć zasięg icmp.

howk

24

Odp: multiSSID z izolacją klientów

Oczywiście kolega Rafał ma rację.  W sumie to jan ze mnie:] Dzięki wszystkim za pomoc.

TL-WR1043ND + Gargoyle PL || WRT54GL