Naszym celem będzie osiągnięcie działającej konfiguracji dwóch ssid. Jedno szyfrowane z pełnym dostępem do sieci kablowej, drugi "publiczny", nieszyfrowany z możliwością dostępu tylko do WANu. Część publiczna jest wydzielona do odrębnej podsieci tak więc mamy:
192.168.0.x - Lan + szyfrowane WIFI
192.168.2.x - publiczne WIFI
Kolorem oznaczono nowe sekcje w konfiguracji.
Zaczynamy od utworzenia drugiego SSID.
root@Router:~# cat /etc/config/wireless
config 'wifi-device' 'radio0'
option 'type' 'mac80211'
option 'macaddr' '00:27:19:d8:9a:ca'
option 'htmode' 'HT20'
option 'disabled' '0'
option 'channel' '1'
option 'hwmode' '11ng'
config 'wifi-iface'
option 'device' 'radio0'
option 'mode' 'ap'
option 'network' 'lan'
option 'ssid' '2low.pl_private'
option 'encryption' 'psk2'
option 'key' 'kluczyk do interneta'
option 'macpolicy' 'none'
option 'hidden' '0'
option 'isolate' '0'
option 'bgscan' '0'
option 'wds' '0'
option 'macfilter' 'none'
[color=maroon]
config 'wifi-iface'
option 'device' 'radio0'
option 'mode' 'ap'
option 'hidden' '0'
option 'encryption' 'none'
option 'network' 'public_wifi'
option 'ssid' '2low.pl_public'
option 'isolate' '0'
option 'bgscan' '0'
option 'wds' '0'
option 'macfilter' 'none'[/color]
Następnie należy dodać nowy interfejs sieciowy z żądaną podsiecią, oraz utworzyć dla niej nowy vlan nie połączony z żadnym portem switcha.
root@Router:~# cat /etc/config/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.0.10'
config 'interface' 'wan'
option 'ifname' 'eth0.2'
option 'proto' 'dhcp'
[color=maroon]config 'interface' 'public_wifi'
option 'ifname' 'eth0.3'
option 'type' 'bridge'
option 'proto' 'static'
option 'netmask' '255.255.255.0'
option 'ipaddr' '192.168.2.10'
option gateway 192.168.2.10
option dns 192.168.2.10[/color]
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'
Następnie regułki firewala umożliwiające ruch free wifi > wan, oraz blokujące cały ruch z free wifi do routera za wyjątkiem wymaganych usług (dhcp, dns).
root@Router:~# cat /etc/config/firewall
config 'defaults'
option 'syn_flood' '1'
option 'input' 'ACCEPT'
option 'output' 'ACCEPT'
option 'forward' 'REJECT'
config 'zone'
option 'name' 'lan'
option 'input' 'ACCEPT'
option 'output' 'ACCEPT'
option 'forward' 'REJECT'
config 'zone'
option 'name' 'wan'
option 'input' 'REJECT'
option 'output' 'ACCEPT'
option 'forward' 'REJECT'
option 'masq' '1'
option 'mtu_fix' '1'
[color=maroon]config 'zone'
option 'name' 'public_wifi'
option 'input' 'REJECT'
option 'output' 'ACCEPT'
option 'forward' 'REJECT'[/color]
config 'forwarding'
option 'src' 'lan'
option 'dest' 'wan'
[color=maroon]config 'forwarding'
option 'src' 'public_wifi'
option 'dest' 'wan'
config 'rule'
option 'src' 'public_wifi'
option 'proto' 'tcpudp'
option 'dest_port' '50-68'
option 'target' 'ACCEPT'
[/color]
config 'rule'
option 'src' 'wan'
option 'proto' 'udp'
option 'dest_port' '68'
option 'target' 'ACCEPT'
config 'include'
option 'path' '/etc/firewall.user'
Na koniec konfiguracja dhcp dla nowo stworzonej podsieci (w przypadku błędów tutaj mogą wystąpić problemy z podłączeniem do sieci)
root@Router:~# cat /etc/config/dhcp
config dnsmasq
option domainneeded 1
option boguspriv 1
option filterwin2k '0' #enable for dial on demand
option localise_queries 1
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
config dhcp lan
option interface lan
option start 30
option limit 50
option leasetime 24h
config dhcp wan
option interface wan
option ignore 1
[color=maroon]config dhcp public_wifi
option interface public_wifi
option start 30
option limit 50
option leasetime 48h[/color]
Mile widziane wszelkie uwagi dotyczące błędów logicznych, bezpieczeństwa czy jakichś innych błędów. ;)
edit:
poprawki v1
Edytowany przez wol2 dnia 04-09-2010 15:39
|