3 พ.ย. 2553

How to configure CoovaChilli to support VLAN.

I got the new Switch Layer 3 and I want to setup Fresh Ubuntu on my old box .So I will be implement Coovachilli to support Vlans.

Requirement applications for Captive portal solution
Ubuntu Server 13.0
CoovaChilli 1.3.0

My scenario
-
------------------------------------------                           ╔╡192.168.10.0/24
------------------------------------------                           ╠╡192.168.20/24
[Router]192.168.1.1==192.168.1.3[Coova]==[Switch]==╬╡192.168.30/24
------------------------------------------                           ╚╡192.168.40/24


Configuration Procedure on Switch 3COM 4500 26 ports

# Create VLAN 10 for the marketing department and configure the IP address of VLAN-interface 10 as 192.168.10.40
system-view
[Sysname] vlan 10
[Sysname-vlan10] port Ethernet 1/0/1
[Sysname-vlan10] quit
[Sysname] interface Vlan-interface 10
[Sysname-Vlan-interface10] ip address 192.168.10.40 255.255.255.0
[Sysname-Vlan-interface10] quit

# Create VLAN 20 for the R&D department and configure the IP address of VLAN-interface 20 as 192.168.20.40
[Sysname] vlan 20
[Sysname-vlan20] port Ethernet 1/0/2
[Sysname-vlan20] quit
[Sysname] interface Vlan-interface 20
[Sysname-Vlan-interface20] ip address 192.168.20.40 255.255.255.0
[Sysname-Vlan-interface20] quit

# Create VLAN 30 for the administration department and configure the IP address of VLAN-interface 30 as 192.168.30.40
[Sysname] vlan 30
[Sysname-vlan30] port Ethernet 1/0/3
[Sysname-vlan30] quit
[Sysname] interface Vlan-interface 30
[Sysname-Vlan-interface30] ip address 192.168.30.40 255.255.255.0
[Sysname-Vlan-interface30] quit
# Create VLAN 40 for the Web cache server and configure the IP address of VLAN-interface 40 as 192.168.40.40
[Sysname] vlan 40
[Sysname-vlan40] port Ethernet 1/0/4
[Sysname-vlan40] quit
[Sysname] interface Vlan-interface 40
[Sysname-Vlan-interface40] ip address 192.168.40.40 255.255.255.0
[Sysname-Vlan-interface40] quit

[Sysname]interface GigabitEthernet 1/0/27
[Sysname-GigabitEthernet1/0/27]port link-type trunk
[Sysname-GigabitEthernet1/0/27]port trunk permit vlan all
[Sysname-GigabitEthernet1/0/27]undo shutdown

Plug the lan cable conectected with the internal interface of Coovachilli into port 27th

Install vlan support and create interface
apt-get install -y vlan
modprobe 8021q
echo "8021q" >> /etc/modules
vconfig add eth1 10
vconfig add eth1 20
vconfig add eth1 30
vconfig add eth1 40

Add vlan interface
nano /etc/network/interfaces

auto eth0
iface eth0 inet static
address 192.168.1.3
netmask 255.255.255.0
network 192.168.1.0
broadcast 10.10.10.255
gateway 192.168.1.1
# dns-* options are implemented by the resolvconf package, if installed
dns-nameservers 203.144.207.29
auto eth1

auto vlan40
iface vlan40 inet manual
vlan-raw-device eth1

auto vlan30
iface vlan20 inet manual
vlan-raw-device eth1

auto vlan20
iface vlan30 inet manual
vlan-raw-device eth1

auto vlan10
iface vlan10 inet manual
vlan-raw-device eth1


Build coova package
aptitude --assume-yes install dpkg-dev debhelper libssl-dev
cd /tmp
wget -c http://ap.coova.org/chilli/coova-chilli-1.3.0.tar.gz
tar xzf coova-chilli*.tar.gz
cd coova-chilli*
dpkg-buildpackage -rfakeroot

Install CoovaChilli:
cd ..
dpkg -i coova-chilli_*_i386.deb

Configure coova
cp etc/chilli/defaults /etc/chilli/config
nano /etc/chilli/config

HS_HS_RADSECRET=XXXX (Up to you)
HS_UAMSECRET=uamsecret
HS_UAMALLOW=www.coova.org,www.google.com,192.168.10.0/24
HS_UAMSERVER=192.168.10.1
HS_UAMFORMAT=https://\$HS_UAMSERVER/hotspot/uam/
HS_UAMSERVICE=https://
\$HS_UAMSERVER/cgi-bin/hotspotlogin.cgi

Create hotspot site for more detail you can sarch from my old article
mkdir /var/www/hotspot
cd /var/www/hotspot
cp /etc/chilli/www/* /var/www/hotspot
sed -i 's/1.0.0.1/10.1.1.1/g' /etc/chilli/www/ChilliLibrary.js
sed -i 's/1.0.0.1/10.1.1.1/g' /var/www/hotspot/ChilliLibrary.js

Configuration process
mkdir /etc/chilli/eth1.10
mkdir /etc/chilli/eth1.20
mkdir /etc/chilli/eth1.30
mkdir /etc/chilli/eth1.40

cp /etc/chilli/config /etc/chilli/eth1.10/config
cp /etc/chilli/config /etc/chilli/eth1.20/config
cp /etc/chilli/config /etc/chilli/eth1.30/config
cp /etc/chilli/config /etc/chilli/eth1.40/config

Edit value for vlan 10
nano /etc/chilli/eth1.10/config

# Settings only for eth1.10 network
HS_LANIF=vlan10
HS_NASID=nas-10
HS_NETWORK=10.10.1.0
HS_NETMASK=255.255.255.128
HS_UAMLISTEN=10.10.1.1
HS_UAMPORT=3100
HS_UAMUIPORT=4100
HS_UAMSERVER=10.10.1.1
HS_UAMFORMAT=https://\$HS_UAMSERVER/hotspot/uam/
HS_UAMHOMEPAGE=http://\$HS_UAMLISTEN:\$HS_UAMPORT/www/coova.html

nano /etc/chilli/eth1.10/chilli.conf

include /etc/chilli/eth1.10/main.conf
include /etc/chilli/eth1.10/hs.conf
include /etc/chilli/eth1.10/local.conf
ipup /etc/chilli/up.sh
ipdown /etc/chilli/down.sh

nano /etc/chilli/eth1.20/config

# Settings only for eth1.20 network
HS_LANIF=vlan20
HS_NASID=nas-20
HS_NETWORK=10.20.1.0
HS_NETMASK=255.255.255.128
HS_UAMLISTEN=10.20.1.1
HS_UAMPORT=3200
HS_UAMUIPORT=4200
HS_UAMSERVER=10.20.1.1
HS_UAMFORMAT=https://\$HS_UAMSERVER/hotspot/uam/
HS_UAMHOMEPAGE=http://\$HS_UAMLISTEN:\$HS_UAMPORT/www/coova.html


nano /etc/chilli/eth1.20/chilli.conf

include /etc/chilli/eth1.20/main.conf
include /etc/chilli/eth1.20/hs.conf
include /etc/chilli/eth1.20/local.conf
ipup /etc/chilli/up.sh
ipdown /etc/chilli/down.sh


nano /etc/chilli/eth1.30/config

# Settings only for eth1.30 network
HS_LANIF=vlan30
HS_NASID=nas-30
HS_NETWORK=10.3.3.0
HS_NETMASK=255.255.255.128
HS_UAMLISTEN=10.3.3.1
HS_UAMPORT=3300
HS_UAMUIPORT=4300
HS_UAMSERVER=10.3.3.1
HS_UAMFORMAT=https://\$HS_UAMSERVER/hotspot/uam/
HS_UAMHOMEPAGE=http://\$HS_UAMLISTEN:\$HS_UAMPORT/www/coova.html

Create inclouding file of Vlan 30
nano /etc/chilli/eth1.30/chilli.conf

include /etc/chilli/eth1.30/main.conf
include /etc/chilli/eth1.30/hs.conf
include /etc/chilli/eth1.30/local.conf
ipup /etc/chilli/up.sh
ipdown /etc/chilli/down.sh

Configure Vlan 40
nano /etc/chilli/eth1.40/config

# Settings only for eth1.40 network
HS_LANIF=vlan40
HS_NASID=nas-40
HS_NETWORK=10.40.1.0
HS_NETMASK=255.255.255.128
HS_UAMLISTEN=10.40.1.1
HS_UAMPORT=3400
HS_UAMUIPORT=4400
HS_UAMSERVER=10.40.1.1
HS_UAMFORMAT=https://\$HS_UAMSERVER/hotspot/uam/
HS_UAMHOMEPAGE=http://\$HS_UAMLISTEN:\$HS_UAMPORT/www/coova.html


Create inclouding file
nano /etc/chilli/eth1.40/chilli.conf

include /etc/chilli/eth1.40/main.conf
include /etc/chilli/eth1.40/hs.conf
include /etc/chilli/eth1.40/local.conf
ipup /etc/chilli/up.sh
ipdown /etc/chilli/down.sh

If you got the message"[error] [client 10.4.4.31] Invalid method in request \x16\x03\x01 " in apache log, try to input this command.
sudo ln -s /etc/apache2/sites-available/default-ssl /etc/apache2/sites-enabled/000-default-ssl
sudo /etc/init.d/apache2 restart


Finally, This is my configuration Coova file.
=========================================

HS_LANIF=vlan20 # Subscriber Interface for client devices
HS_NETWORK=192.168.20.0 # HotSpot Network (must include HS_UAMLISTEN)
HS_NETMASK=255.255.255.0 # HotSpot Network Netmask
HS_UAMLISTEN=192.168.20.1 # HotSpot IP Address (on subscriber network)
HS_UAMPORT=3200 # HotSpot UAM Port (on subscriber network)
HS_UAMUIPORT=4200 # HotSpot UAM "UI" Port (on subscriber network, for embedded portal)

HS_DYNIP=192.168.20.130
HS_DYNIP_MASK=255.255.255.0
HS_STATIP=192.168.20.3
HS_STATIP_MASK=255.255.255.0
# HS_DNS_DOMAIN=192.168.20.101

# OpenDNS Servers
HS_DNS1=192.168.20.1
HS_DNS2=192.168.20.102

HS_NASID=nas-20
HS_RADIUS=localhost
HS_RADIUS2=localhost
HS_UAMALLOW=192.168.20.0/24,192.168.0.0/24,10.10.10.0/27
HS_RADSECRET=Chitlada # Set to be your RADIUS shared secret
HS_UAMSECRET=Luamsecret # Set to be your UAM secret
HS_UAMALIASNAME=chilli

HS_UAMSERVER=192.168.20.1

HS_UAMFORMAT=https://\$HS_UAMSERVER/hotspot/uam/

HS_UAMHOMEPAGE=http://\$HS_UAMLISTEN:\$HS_UAMPORT/www/coova.html


HS_MODE=hotspot
HS_TYPE=chillispot
HS_WWWDIR=/etc/chilli/www

HS_WWWBIN=/etc/chilli/wwwsh

HS_PROVIDER=Coova
HS_PROVIDER_LINK=http://www.coova.org/

HS_LOC_NAME="My HotSpot"
=========== End of file ================


Reference
http://ubuntuforums.org/showthread.php?t=703387
http://www.sptc.ac.th/webboard/viewtopic.php?f=5&t=4

1 ความคิดเห็น:

  1. Thanks, saved me a massive amount of reading "books".

    I am sure some really nice light of luck will shine your way :)

    //Mike

    ตอบลบ