This shows you the differences between two versions of the page.
| Next revision | Previous revision | ||
|
technical:openvpn-bridges-prep-coova [2023/10/21 06:16] admin created |
technical:openvpn-bridges-prep-coova [2024/01/16 10:46] (current) admin [Test it out] |
||
|---|---|---|---|
| Line 1: | Line 1: | ||
| ====== OpenVPN Bridges ====== | ====== OpenVPN Bridges ====== | ||
| + | ===== Enable Packet forwarding for IPv4 ===== | ||
| + | * The machine running CoovaChilli will act as a router and thus needs to be configured as such. | ||
| + | * This means that the IP packets needs to be **forwarded** from one interface to the other. | ||
| + | * Edit the **/ | ||
| + | * Find and uncomment **net.ipv4.ip_forward=1** line. | ||
| + | |||
| ===== Building and Installing Coova Chilli ===== | ===== Building and Installing Coova Chilli ===== | ||
| * The version of CoovaChilli is 1.6 as of this writing. | * The version of CoovaChilli is 1.6 as of this writing. | ||
| Line 52: | Line 58: | ||
| Processing triggers for man-db (2.9.1-1) ... | Processing triggers for man-db (2.9.1-1) ... | ||
| </ | </ | ||
| + | |||
| + | ===== Configuring Coova Chilli ===== | ||
| + | ==== Enable CoovaChilli ==== | ||
| + | * Edit the following file | ||
| + | <code bash> | ||
| + | sudo vi / | ||
| + | </ | ||
| + | * Change it to look like this | ||
| + | <code bash> | ||
| + | START_CHILLI=1 | ||
| + | CONFFILE="/ | ||
| + | HS_USER=" | ||
| + | </ | ||
| + | * Save the file. | ||
| + | ==== Create the main config file ==== | ||
| + | * Create a file called **/ | ||
| + | <file bash / | ||
| + | HS_WANIF=eth0 | ||
| + | HS_DNS1=4.4.4.4 | ||
| + | HS_DNS2=8.8.8.8 | ||
| + | HS_RADIUS=164.160.89.129 | ||
| + | HS_RADIUS2=164.160.89.129 | ||
| + | HS_RADSECRET=testing123 | ||
| + | HS_UAMSECRET=greatsecret | ||
| + | HS_UAMALIASNAME=chilli | ||
| + | HS_UAMSERVER=$HS_UAMLISTEN | ||
| + | HS_UAMFORMAT=https:// | ||
| + | HS_UAMHOMEPAGE=http:// | ||
| + | HS_MODE=hotspot | ||
| + | HS_TYPE=coovachilli | ||
| + | HS_WWWDIR=/ | ||
| + | HS_WWWBIN=/ | ||
| + | HS_PROVIDER=Coova | ||
| + | HS_PROVIDER_LINK=http:// | ||
| + | HS_LOC_NAME=" | ||
| + | HS_UAMUISSL=on | ||
| + | HS_SSLKEYFILE=/ | ||
| + | HS_SSLCERTFILE=/ | ||
| + | HS_UAMALIASNAME=uam | ||
| + | HS_DNS_DOMAIN=mesh-manager.com | ||
| + | HS_UAMUIPORT=4990 | ||
| + | |||
| + | </ | ||
| + | * Make sure you include the **key.pem** and **cert.pem** in order for SSL to work correct. | ||
| + | * You can use these from the MESHdesk firmware | ||
| + | * https:// | ||
| + | * Create the VLAN config directories | ||
| + | < | ||
| + | #Here you will need **ifconfig** to be installed | ||
| + | sudo su | ||
| + | cd /etc/chilli | ||
| + | ./ | ||
| + | ./ | ||
| + | * Create the three VLAN configs | ||
| + | ./ | ||
| + | </ | ||
| + | * Create the three VLAN configs | ||
| + | <file bash / | ||
| + | HS_LANIF=br0.101 | ||
| + | HS_NETWORK=10.101.0.0 | ||
| + | HS_NETMASK=255.255.0.0 | ||
| + | HS_UAMLISTEN=10.101.0.1 | ||
| + | HS_UAMPORT=3990 | ||
| + | HS_UAMUIPORT=4990 | ||
| + | |||
| + | HS_DYNIP=10.101.1.1 | ||
| + | HS_DYNIP_MASK=255.255.0.0 | ||
| + | HS_STATIP=10.101.0.1 | ||
| + | HS_STATIP_MASK=255.255.255.0 | ||
| + | # HS_DNS_DOMAIN= | ||
| + | |||
| + | HS_NASID=rd-vlan101 | ||
| + | HS_SSID=rd-vlan101-ssid | ||
| + | </ | ||
| + | |||
| + | <file bash / | ||
| + | HS_LANIF=br0.102 | ||
| + | HS_NETWORK=10.102.0.0 | ||
| + | HS_NETMASK=255.255.0.0 | ||
| + | HS_UAMLISTEN=10.102.0.1 | ||
| + | HS_UAMPORT=3991 | ||
| + | HS_UAMUIPORT=4991 | ||
| + | |||
| + | HS_DYNIP=10.102.1.1 | ||
| + | HS_DYNIP_MASK=255.255.0.0 | ||
| + | HS_STATIP=10.102.0.1 | ||
| + | HS_STATIP_MASK=255.255.255.0 | ||
| + | # HS_DNS_DOMAIN= | ||
| + | |||
| + | HS_NASID=rd-vlan102 | ||
| + | HS_SSID=rd-vlan102-ssid | ||
| + | </ | ||
| + | |||
| + | <file bash / | ||
| + | HS_LANIF=br0.103 | ||
| + | HS_NETWORK=10.103.0.0 | ||
| + | HS_NETMASK=255.255.0.0 | ||
| + | HS_UAMLISTEN=10.103.0.1 | ||
| + | HS_UAMPORT=3992 | ||
| + | HS_UAMUIPORT=4992 | ||
| + | |||
| + | HS_DYNIP=10.103.1.1 | ||
| + | HS_DYNIP_MASK=255.255.0.0 | ||
| + | HS_STATIP=10.103.0.1 | ||
| + | HS_STATIP_MASK=255.255.255.0 | ||
| + | # HS_DNS_DOMAIN= | ||
| + | |||
| + | HS_NASID=rd-vlan103 | ||
| + | HS_SSID=rd-vlan103-ssid | ||
| + | </ | ||
| + | |||
| + | ===== Add NAT Support ===== | ||
| + | * By default CoovaChilli does not do NAT between the two interfaces. We have to add NAT support during start-up in order to have a working system. | ||
| + | <WRAP center round alert 90%> | ||
| + | Failing to do this step will leave you with a broken system. | ||
| + | </ | ||
| + | * Edit the / | ||
| + | <code bash> | ||
| + | test ${HS_ADMINTERVAL: | ||
| + | (crontab -l 2>&- | grep -v $0 | ||
| + | echo " | ||
| + | ) | crontab - 2>&- | ||
| + | } | ||
| + | |||
| + | #NAT mod | ||
| + | iptables -F POSTROUTING -t nat | ||
| + | iptables -I POSTROUTING -t nat -o $HS_WANIF -j MASQUERADE | ||
| + | # ---HEADS-UP-- | ||
| + | #NOTE The $HS_WANIF dit not populate for some unknown reason so I had to do | ||
| + | #iptables -I POSTROUTING -t nat -o eth0 -j MASQUERADE | ||
| + | #END NAT mod | ||
| + | |||
| + | ifconfig $HS_LANIF 0.0.0.0 | ||
| + | </ | ||
| + | ===== Test it out ===== | ||
| + | * Restart CoovaChilli for the latest changes to be effected. | ||
| + | <code bash> | ||
| + | #This is required | ||
| + | systemctl disable chilli | ||
| + | #Now issue the following | ||
| + | sudo systemctl stop chilli | ||
| + | sudo systemctl status chilli | ||
| + | sudo systemctl start chilli | ||
| + | </ | ||
| + | |||
| + | * Confirm it started fine | ||
| + | <code bash> | ||
| + | sudo systemctl status chilli | ||
| + | |||
| + | ....... | ||
| + | ● chilli.service - LSB: Start CoovaChilli daemon at boot time | ||
| + | | ||
| + | | ||
| + | Docs: man: | ||
| + | Process: 7619 ExecStart=/ | ||
| + | Tasks: 1 (limit: 1108) | ||
| + | | ||
| + | | ||
| + | |||
| + | Dec 21 03:05:26 osboxes systemd[1]: Started LSB: Start CoovaChilli daemon at boo | ||
| + | Dec 21 03:05:26 osboxes chilli[7706]: | ||
| + | Dec 21 03:05:26 osboxes chilli[7706]: | ||
| + | Dec 21 03:05:26 osboxes chilli[7706]: | ||
| + | Dec 21 03:05:26 osboxes chilli[7706]: | ||
| + | Dec 21 03:05:26 osboxes chilli[7706]: | ||
| + | Dec 21 03:05:26 osboxes coova-chilli[7713]: | ||
| + | Dec 21 03:05:26 osboxes coova-chilli[7713]: | ||
| + | Dec 21 03:05:26 osboxes coova-chilli[7713]: | ||
| + | Dec 21 03:05:26 osboxes coova-chilli[7713]: | ||
| + | ....... | ||
| + | </ | ||
| + | * Reboot the system and make sure CoovaChilli started up fine | ||
| + | |||
| + | ===== Startup sequence ===== | ||
| + | * We need to make sure that CoovaChilli starts at the right time. | ||
| + | * The right time will be: | ||
| + | * First we configure the bridges. | ||
| + | * Then we start up OpenVPN tunnels. | ||
| + | * Then we start up CoovaChilli. | ||
| + | * Disable the normal startup sequence of CoovaChilli | ||
| + | <code bash> | ||
| + | systemctl disable chilli | ||
| + | </ | ||
| + | * Edit the **/ | ||
| + | <code bash> | ||
| + | #Add the startup of OpenVPN | ||
| + | systemctl start openvpn@server_vlan_101 | ||
| + | systemctl start openvpn@server_vlan_102 | ||
| + | systemctl start openvpn@server_vlan_103 | ||
| + | |||
| + | #Add the startup of CoovaChilli | ||
| + | systemctl start chilli | ||
| + | |||
| + | exit 0 | ||
| + | </ | ||
| + | * Reboot the system and make sure everything is up and running after the reboot. | ||
| + | |||
| + | ===== System Checks ===== | ||
| + | * To confirm the bridges are up along with the OpenVPN tunnels | ||
| + | <code bash> | ||
| + | root@localhost:/ | ||
| + | bridge name bridge id STP enabled interfaces | ||
| + | br0.101 8000.002222ffffff no eth1.101 | ||
| + | tap0 | ||
| + | br0.102 8000.002222ffffff no eth1.102 | ||
| + | tap1 | ||
| + | br0.103 8000.002222ffffff no eth1.103 | ||
| + | tap2 | ||
| + | </ | ||
| + | * To check if CoovaChilli started up fine: | ||
| + | <code bash> | ||
| + | ifconfig | ||
| + | |||
| + | .... | ||
| + | tun0: flags=81< | ||
| + | inet 10.101.0.1 | ||
| + | inet6 fe80:: | ||
| + | unspec 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00 | ||
| + | RX packets 0 bytes 0 (0.0 B) | ||
| + | RX errors 0 dropped 0 overruns 0 frame 0 | ||
| + | TX packets 10 bytes 592 (592.0 B) | ||
| + | TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 | ||
| + | |||
| + | tun1: flags=81< | ||
| + | inet 10.1.0.1 | ||
| + | inet6 fe80:: | ||
| + | unspec 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00 | ||
| + | RX packets 0 bytes 0 (0.0 B) | ||
| + | RX errors 0 dropped 0 overruns 0 frame 0 | ||
| + | TX packets 10 bytes 592 (592.0 B) | ||
| + | TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 | ||
| + | |||
| + | tun2: flags=81< | ||
| + | inet 10.1.0.1 | ||
| + | inet6 fe80:: | ||
| + | unspec 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00 | ||
| + | RX packets 0 bytes 0 (0.0 B) | ||
| + | RX errors 0 dropped 0 overruns 0 frame 0 | ||
| + | TX packets 10 bytes 592 (592.0 B) | ||
| + | TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 | ||
| + | |||
| + | .... | ||
| + | |||
| + | </ | ||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||