Difference between revisions of "Hout Bay"

From CTWUG Wiki
Jump to: navigation, search
m
 
(74 intermediate revisions by 3 users not shown)
Line 1: Line 1:
 
=Hout Bay WUG=
 
=Hout Bay WUG=
  
The Hout Bay WUG is a small subWUG within Cape Town.  It is not yet connected to CTWUG due to geographic difficulties, but as we gain more people we hope to eventually find a path out the valley and onto CTWUGIn the mean time we have established a small but very enthusiastic group of wuggers connected amongst each other with an extension to Kommetjie.  This Wiki entry is simply a knowledge base specific to our area.
+
The Hout Bay WUG is a historic name for what is now the Hout Bay area on CTWUG.  It started life in March 2010 as a Hout Bay specific WUG, disconnected from CTWUG due to geographic hurdles in connectingOn 23 December 2010 it was connected to CTWUG via Kommetjie, Noordhoek and Fishoek areas.  This Wiki entry is just a knowledge base specific to our area.
  
  
Line 8: Line 8:
 
{|border="1" cellpadding="3" cellspacing="1" style="text-align:center;"
 
{|border="1" cellpadding="3" cellspacing="1" style="text-align:center;"
 
!Name
 
!Name
!colspan="3"|Nodes
+
!Nick
|-
+
!colspan="2"|Nodes
|Albert
 
|colspan="3"|[http://wind.ctwug.za.net/wind/?page=nodes&node=1500 earthling42]
 
|-
 
|Alistair
 
|colspan="3"|[http://wind.ctwug.za.net/wind/?page=nodes&node=1715 HB3-Ali]
 
 
|-
 
|-
 
|Aragon
 
|Aragon
|[http://wind.ctwug.za.net/wind/?page=nodes&node=1682 Kush]
+
|Aragon
|[http://wind.ctwug.za.net/wind/?page=nodes&node=1802 Vertex]
+
|[http://wind.ctwug.za.net/wind/?page=nodes&node=1682 Kush] [http://wind.ctwug.za.net/wind/?page=nodes&node=1985 Vertex] [http://wind.ctwug.za.net/wind/?page=nodes&node=1803 Aragon]
|[http://wind.ctwug.za.net/wind/?page=nodes&node=1805 Republic]
 
 
|-
 
|-
 
|Armand
 
|Armand
|[http://wind.ctwug.za.net/wind/?page=nodes&node=1268 DarkStar]
+
|armthedark
|colspan="2"|[http://wind.ctwug.za.net/wind/?page=nodes&node=1089 DeathStarCanteen]
+
|[http://wind.ctwug.za.net/wind/?page=nodes&node=5700 TheBrotherhood] [http://wind.ctwug.za.net/wind/?page=nodes&node=1089 DeathStarCanteen]
 +
|-
 +
|Chris
 +
|Monty
 +
|[http://wind.ctwug.za.net/wind/?page=nodes&node=5337 Dungeon]
 
|-
 
|-
 
|Cobus
 
|Cobus
|colspan="3"|[http://wind.ctwug.za.net/wind/?page=nodes&node=1725 TROPiX]
+
|ObiCanobi
 +
|[http://wind.ctwug.za.net/wind/?page=nodes&node=1725 TROPiX]
 +
|-
 +
|Csaba
 +
|Csaba
 +
|[http://wind.ctwug.za.net/wind/?page=nodes&node=6054 CyberValley]
 
|-
 
|-
 
|David
 
|David
|[http://wind.ctwug.za.net/wind/?page=nodes&node=1767 HitmanV-S]
+
|HitmanV
|colspan="2"|[http://wind.ctwug.za.net/wind/?page=nodes&node=1906 HitmanV-AP]
+
|[http://wind.ctwug.za.net/wind/?page=nodes&node=1767 HitmanV] [http://wind.ctwug.za.net/wind/?page=nodes&node=2813 Spike]
 
|-
 
|-
 
|Denis
 
|Denis
|colspan="3"|[http://wind.ctwug.za.net/wind/?page=nodes&node=2187 d3nis]
+
|d3nis
 +
|[http://wind.ctwug.za.net/wind/?page=nodes&node=2187 d3nis]
 
|-
 
|-
 
|Georg
 
|Georg
|[http://wind.ctwug.za.net/wind/?page=nodes&node=1905 Slangkop]
 
|[http://wind.ctwug.za.net/wind/?page=nodes&node=2222 Slangkop-AP]
 
|[http://wind.ctwug.za.net/wind/?page=nodes&node=1847 Riverside]
 
|-
 
|James
 
|colspan="3"|[http://wind.ctwug.za.net/wind/?page=nodes&node=1683 Komskom]
 
|-
 
|Luke
 
|colspan="3"|[http://wind.ctwug.za.net/wind/?page=nodes&node=1823 FinkNode]
 
|-
 
|Myles
 
|colspan="3"|[http://wind.ctwug.za.net/wind/?page=nodes&node=1247 MiloNode]
 
|-
 
|Richard
 
|colspan="3"|[http://wind.ctwug.za.net/wind/?page=nodes&node=2861 ClearV]
 
|-
 
|Ruald
 
|colspan="3"|[http://wind.ctwug.za.net/wind/?page=nodes&node=2121 Psypher1]
 
|}
 
 
 
==IP Addresses==
 
 
{|border="1" cellpadding="2" cellspacing="1"
 
!Network
 
!Status
 
!Allocated To
 
!Function
 
|-
 
|172.18.87.0/28
 
|Active
 
|Aragon
 
|Backbone
 
|-
 
|172.18.87.16/28
 
|Reserved
 
|Aragon
 
|Future growth or new allocations
 
|-
 
|172.18.87.32/29
 
|Active
 
|David
 
|Backbone
 
|-
 
|172.18.87.40/29
 
|Reserved
 
|David
 
|Future growth or new allocations
 
|-
 
|172.18.87.48/29
 
|Active
 
|Georg
 
|Backbone
 
|-
 
|172.18.87.56/29
 
|Reserved
 
|Georg
 
|Future growth or new allocations
 
|-
 
|172.18.87.64/27
 
|Active
 
 
|Georg
 
|Georg
|Home LAN
+
|[http://wind.ctwug.za.net/wind/?page=nodes&node=1905 Slangkop] [http://wind.ctwug.za.net/wind/?page=nodes&node=1847 Riverside]
|-
 
|172.18.87.96/28
 
|Active
 
|Luke
 
|Home LAN
 
|-
 
|172.18.87.112/28
 
|Active
 
|Ruald
 
|Home LAN
 
 
|-
 
|-
|172.18.87.128/28
+
|Grant
|Active
+
|McDuck
|Aragon
+
|[http://wind.ctwug.za.net/wind/?page=nodes&node=5226 Talon]
|Home LAN
 
 
|-
 
|-
|172.18.87.144/28
 
|Active
 
|Armand
 
|Second Home LAN
 
|-
 
|172.18.87.160/28
 
|Active
 
 
|James
 
|James
|Home LAN
+
|flamer
 +
|[http://wind.ctwug.za.net/wind/?page=nodes&node=1683 Komskom]
 
|-
 
|-
|172.18.87.176/28
+
|Jamie
|Unallocated
+
|Johjam
|
+
|[http://wind.ctwug.za.net/wind/?page=nodes&node=6016 Johjam02]
|
 
 
|-
 
|-
|172.18.87.192/28
+
|Johan
|Active
+
|Blik
|Myles
+
|[http://wind.ctwug.za.net/wind/?page=nodes&node=5240 Blik]
|Home LAN
 
 
|-
 
|-
|172.18.87.208/28
+
|Jonathan
|Active
+
|Lazyant
|Armand
+
|[http://wind.ctwug.za.net/wind/index.php?page=nodes&node=4340 Lazyant]
|Home LAN
 
 
|-
 
|-
|172.18.87.224/28
+
|Juan
|Active
+
|JuanH
|David
+
|[http://wind.ctwug.za.net/wind/?page=nodes&node=3772 dizzy]
|Home LAN
 
 
|-
 
|-
|172.18.87.240/28
+
|Luke
|Active
+
|InHumaN
|Cobus
+
|[http://wind.ctwug.za.net/wind/?page=nodes&node=1823 FinkNode]
|Home LAN
 
 
|-
 
|-
|172.18.88.0/24
+
|Nicolaas
|Unallocated
+
|saalocin
|
+
|[http://wind.ctwug.za.net/wind/?page=nodes&node=5425 saalocin]
|
 
|}
 
 
 
 
 
==Frequency Usage==
 
{|border="1" cellpadding="2" cellspacing="1" style="text-align:center;"
 
!Access Point
 
!Frequency
 
!Width
 
!Polarisation
 
!TX Level
 
!Ant Gain
 
!Function
 
 
|-
 
|-
|[http://wind.ctwug.za.net/wind/?page=nodes&node=1805 Republic]
+
|Richard
|5220 MHz
+
|Richard
|40 MHz (+)
+
|[http://wind.ctwug.za.net/wind/?page=nodes&node=3367 Joy]
|Horizontal
 
|14 dBm
 
|31 dBi
 
|PtP
 
|-
 
|[http://wind.ctwug.za.net/wind/?page=nodes&node=1802 Vertex]
 
|5620 MHz
 
|40 MHz (+)
 
|Hor. + Vert.
 
|15 dBm
 
|17 dBi
 
|PtMP
 
|-
 
|[http://wind.ctwug.za.net/wind/?page=mynodes&node=1682 Kush]
 
|5540 MHz
 
|40 MHz (+)
 
|Hor. + Vert.
 
|12 dBm
 
|16 dBi
 
|PtMP
 
 
|-
 
|-
|[http://wind.ctwug.za.net/wind/?page=nodes&node=1906 HitmanV-AP]
 
|5805 MHz
 
|40 MHz (-)
 
|Hor. + Vert.
 
|9 dBm
 
|22 dBi
 
|PtMP
 
|-
 
|[http://wind.ctwug.za.net/wind/?page=nodes&node=2222 Slangkop-AP]
 
|5500 MHz
 
|40 MHz (+)
 
|Hor. + Vert.
 
|18 dBm
 
|16 dBi
 
|PtMP
 
 
|}
 
|}
 
 
==Network Diagram==
 
Unfortunately I'm not able to upload the original Dia source file here, but I'll make this available via another means.  Contact me (Aragon) directly if you want a copy in the mean time.  Below is a PNG rendering of the diagram.
 
 
[[Image:Hbwug.png|600px]]
 
  
  
Line 226: Line 93:
 
|Aragon
 
|Aragon
 
|-
 
|-
|adc://hub.hbwug:1511
+
|adc://hub.aragon.ctwug.za.net:1511
 
|ADC
 
|ADC
 
|Aragon
 
|Aragon
 
|-
 
|-
|mumble.hbwug
+
|mumble://mumble.aragon.ctwug.za.net
 
|Mumble
 
|Mumble
 
|Aragon
 
|Aragon
Line 236: Line 103:
  
  
==AirOS Custom Firewall Script==
+
==File Sharing==
 +
 
 +
We use [http://en.wikipedia.org/wiki/Advanced_Direct_Connect ADC] for sharing files on HBWUG.  You will need an ADC 1.0 compliant client to participate.  CTWUG's [http://dchub.ctwug.za.net/dc/ WugDC++] is compatible, but [http://eiskaltdc.sourceforge.net/ EiskaltDC] is another recommended option.  If using EiskaltDC, configure the connection settings as follows:
 +
 
 +
* '''Mode:''' Active
 +
* '''TCP Port:''' 2222
 +
* '''UDP Port:''' 2222
 +
* '''TLS Port:''' 2223
 +
 
 +
Make sure those ports are open on your respective firewalls, especially the Windows firewall and any anti-virus firewalls.
 +
 
 +
Then just add the ADC hub listed in [[#Network_Services|Network Services]] above to your favourites.
 +
 
 +
 
 +
==Ubiquiti Customisations==
 +
 
 +
We use a number of Ubiquiti customisations to make things run smoother on HBWUG.  The following instructions are intended for wuggers with some networking and Unix knowledge.  Most of the changes below need to be done on the command line of your device via SSH.
 +
 
 +
===Step 1: Load OSPF firmware===
 +
This requires custom Ubiquiti firmware.  Either obtain a precompiled image from Aragon or build one yourself by following: [[Adding OSPF support to Ubiquiti devices]].
 +
 
 +
Load the firmware to your device using the "Update" function in the web interface.  Once its loaded and your device has rebooted with the new firmware, continue to the next step.
 +
 
 +
===Step 2: Setup shell profile===
 +
From this point on do NOT reboot your device again until you've completed step 5.
 +
 
 +
Create '''/etc/persistent/profile''' with contents:
 +
 
 +
<pre>
 +
PS1='\[\e]1;\h-term\a\e]2;\h:\w\a\]\h\$ '
 +
alias reload='/etc/persistent/rc.ctwug reload'
 +
</pre>
 +
 
 +
===Step 3: Setup BIRD===
 +
Create a BIRD configuration script in '''/etc/persistent/bird4.conf.sh''' with contents:
 +
 
 +
<pre>
 +
mkbirdconf () {
 +
cat >${BIRDCONF} <<_EOF
 +
log stderr all;
 +
router id ${ROUTERID};
  
Ubiquiti devices run Linux and use [http://linux.die.net/man/8/iptables iptables] for firewalling. Unfortunately their web interface to iptables is very limited, so in order to run a more advanced ruleset one needs to create a linux shell script that adds firewall rules manually. This is done by SSH'ing to the device and following [http://www.ubnt.com/wiki/index.php?title=Manual_Routes these instructions] to create a /etc/persistent/rc.poststart file. Here is a sample of what I use on a few devices:
+
filter ospfin
 +
prefix set hbwug;
 +
ip set hbwuggw;
 +
{
 +
hbwug = [ 172.18.87.0/24+, 172.18.88.0/24+, 172.18.102.0/23+ ];
 +
hbwuggw = [ 172.18.87.0, 172.18.102.0 ];
 +
if net ~ hbwug then {
 +
if gw.mask(26) ~ hbwuggw then accept;
 +
reject;
 +
}
 +
if net ~ 172.16.0.0/12 then accept;
 +
reject;
 +
}
  
#!/bin/sh
+
protocol kernel {
+
persist;
PATH=${PATH}:/sbin
+
learn;
LOCALNET="172.18.87.96/28"
+
description "kernel";
WLANIP="172.18.87.36/32"
+
scan time 60;
DCPORT="52000"
+
import none;
+
export all;
iptables -F FIREWALL
+
}
iptables -A FIREWALL --protocol icmp -j ACCEPT
 
iptables -A FIREWALL -m state --state ESTABLISHED,RELATED -j ACCEPT
 
iptables -A FIREWALL -i ath0 --dst ${WLANIP} -m state --state NEW -j ACCEPT
 
iptables -A FIREWALL -i ath0 --dst ${LOCALNET} --protocol tcp --dport ${DCPORT} -m state --state NEW -j ACCEPT
 
iptables -A FIREWALL -i ath0 --dst ${LOCALNET} --protocol tcp --dport $((${DCPORT}+1)) -m state --state NEW -j ACCEPT
 
iptables -A FIREWALL -i ath0 --dst ${LOCALNET} --protocol udp --dport ${DCPORT} -m state --state NEW -j ACCEPT
 
iptables -A FIREWALL -i ath0 --dst ${LOCALNET} --protocol udp --dport 33434:65535 -m state --state NEW -j ACCEPT
 
iptables -A FIREWALL -i ath0 --protocol tcp -j REJECT --reject-with tcp-reset
 
iptables -A FIREWALL -i ath0 -j REJECT
 
  
To complete things you must:
+
protocol device {
 +
scan time 60;
 +
}
  
* Edit LOCALNET to be the subnet address of your LAN listed in the [[#IP_Addresses|allocations table]] above.
+
_EOF
* Edit WLANIP to be the IP address of your WLAN IP address as configured in your device.
 
* Enable the firewall in the web interface of your device.
 
* Configure your DC client as shown [[#File_Sharing|below]].
 
  
This basic ruleset essentially creates a stateful firewall that allows all outgoing connections, all ICMP in both directions, and all incoming DC connections.  Any non-DC incoming traffic is blocked, so if you're going to be gaming or doing something that requires incoming connections, you will need to add additional rules for it. Contact Aragon if you need any help.
+
if [ -e ${BIRDCONF}.local ]; then
 +
cat ${BIRDCONF}.local >>${BIRDCONF}
 +
fi
  
==File Sharing==
+
cat >>${BIRDCONF} <<"_EOF"
 +
 
 +
protocol ospf wug {
 +
tick 1;
 +
description "WUG";
 +
import filter ospfin;
 +
_EOF
 +
case ${NETMODE} in
 +
router)
 +
cat >>${BIRDCONF} <<"_EOF"
 +
export all;
 +
area 0.0.0.0 {
 +
interface "ath0" {
 +
cost 10;
 +
hello 10;
 +
retransmit 20;
 +
type broadcast;
 +
authentication none;
 +
};
 +
interface "eth0" {
 +
cost 10;
 +
type broadcast;
 +
stub;
 +
};
 +
};
 +
_EOF
 +
;;
 +
bridge)
 +
cat >>${BIRDCONF} <<"_EOF"
 +
export none;
 +
area 0.0.0.0 {
 +
interface "br0" {
 +
cost 10;
 +
priority 0;
 +
hello 10;
 +
retransmit 20;
 +
type broadcast;
 +
authentication none;
 +
};
 +
};
 +
_EOF
 +
;;
 +
esac
 +
cat >>${BIRDCONF} <<"_EOF"
 +
}
 +
_EOF
 +
}
 +
</pre>
 +
 
 +
===Step 4: Create firewall script===
 +
Ubiquiti devices run Linux and use [http://linux.die.net/man/8/iptables iptables] for firewalling.  Unfortunately Ubiquiti's web interface to iptables is very limited, so in order to run a more advanced firewall we add a custom firewall script.
 +
 
 +
Create '''/etc/persistent/rc.firewall''' with contents:
 +
 
 +
<pre>
 +
DCPORT="2222"
 +
TORRENTPORT="7000"
 +
 
 +
iptables -F FIREWALL
 +
iptables -A FIREWALL --protocol icmp -j ACCEPT
 +
iptables -A FIREWALL -m state --state ESTABLISHED,RELATED -j ACCEPT
 +
iptables -A FIREWALL -i ath0 --dst ${WLANIP} -m state --state NEW -j ACCEPT
 +
iptables -A FIREWALL -i ath0 --dst ${WLANIP} --protocol ospf -m state --state NEW -j ACCEPT
 +
iptables -A FIREWALL -i ath0 --dst 224.0.0.5/32 --protocol ospf -m state --state NEW -j ACCEPT
 +
iptables -A FIREWALL -i ath0 --dst 224.0.0.6/32 --protocol ospf -m state --state NEW -j ACCEPT
 +
iptables -A FIREWALL -i ath0 --dst 224.0.0.22/32 --protocol igmp -m state --state NEW -j ACCEPT
 +
iptables -A FIREWALL -i ath0 --dst ${LOCALNET} --protocol tcp --dport ${DCPORT} -m state --state NEW -j ACCEPT
 +
iptables -A FIREWALL -i ath0 --dst ${LOCALNET} --protocol tcp --dport $((${DCPORT}+1)) -m state --state NEW -j ACCEPT
 +
iptables -A FIREWALL -i ath0 --dst ${LOCALNET} --protocol udp --dport ${DCPORT} -m state --state NEW -j ACCEPT
 +
iptables -A FIREWALL -i ath0 --dst ${LOCALNET} --protocol udp --dport ${TORRENTPORT} -m state --state NEW -j ACCEPT
 +
iptables -A FIREWALL -i ath0 --dst ${LOCALNET} --protocol udp --dport 33434:65535 -m state --state NEW -j ACCEPT
 +
iptables -A FIREWALL -i ath0 --protocol tcp -j REJECT --reject-with tcp-reset
 +
iptables -A FIREWALL -i ath0 --dst 255.255.255.255 --protocol udp --dport 5678 -j DROP
 +
iptables -A FIREWALL -i ath0 -j REJECT
 +
</pre>
 +
 
 +
The above is a starting point that will work for most wuggers.  Modify it as you need if you understand [http://linux.die.net/man/8/iptables iptables].
 +
 
 +
Also remember to:
 +
 
 +
* Enable the firewall in the web interface of your device. (''after'' step 6)
 +
* Configure your DC client as shown [[#File_Sharing|above]].
 +
 
 +
===Step 5: Create boot time HBWUG scripts===
 +
This step creates the necessary boot time code that allows steps 2 and 3 to work.  Create the following files:
 +
 
 +
'''/etc/persistent/config.php''':
 +
<pre>
 +
#!/bin/cgi -q
 +
<?
 +
chdir("/usr/www");
 +
include("lib/settings.inc");
 +
$cfg = @cfg_load($cfg_file);
 +
if ($cfg == -1) { exit; }
 +
$netmode = cfg_get($cfg, "netmode");
 +
$fwstatus = cfg_get($cfg, "iptables.status");
 +
$lannet = cfg_get($cfg, "netconf.1.ip") + "/" + cfg_get($cfg, "netconf.1.netmask");
 +
$wlanip = cfg_get($cfg, "netconf.2.ip");
 +
$bridgeip = cfg_get($cfg, "netconf.3.ip");
 +
echo("NETMODE=\"$netmode\"\n");
 +
echo("FWSTATUS=\"$fwstatus\"\n");
 +
echo("LOCALNET=\"$lannet\"\n");
 +
echo("WLANIP=\"$wlanip\"\n");
 +
echo("BRIDGEIP=\"$bridgeip\"\n");
 +
?>
 +
BIRDENABLE=1
 +
</pre>
 +
 
 +
 
 +
'''/etc/persistent/rc.ctwug''':
 +
<pre>
 +
#!/bin/sh
 +
 
 +
eval "$(/etc/persistent/config.php)"
 +
. /etc/persistent/bird4.conf.sh
 +
PATH=${PATH}:/sbin
 +
BIRDCONF=/etc/persistent/bird4.conf
 +
FWCONF=/etc/persistent/rc.firewall
 +
[ -z "${BIRDENABLE}" ] && BIRDENABLE=0
 +
 
 +
case "$1" in
 +
start|reload)
 +
STARTBIRD=0
 +
STARTFW=0
 +
if [ "${NETMODE}" = "router" ]; then
 +
for f in /proc/sys/net/ipv4/conf/*; do
 +
echo 1 >${f}/accept_redirects
 +
echo 1 >${f}/send_redirects
 +
done
 +
if [ "${FWSTATUS}" = "enabled" -a -e ${FWCONF} ]; then
 +
STARTFW=1
 +
fi
 +
if [ ${BIRDENABLE} -eq 1 -a -n "${WLANIP}" ]; then
 +
ROUTERID=${WLANIP}
 +
STARTBIRD=1
 +
fi
 +
elif [ "${NETMODE}" = "bridge" ]; then
 +
if [ ${BIRDENABLE} -eq 1 -a -n "${BRIDGEIP}" ]; then
 +
ROUTERID=${BRIDGEIP}
 +
STARTBIRD=1
 +
fi
 +
fi
 +
case "$1" in
 +
start)
 +
echo "CTWUG starting"
 +
;;
 +
reload)
 +
echo "CTWUG reloading:"
 +
case "$2" in
 +
fw)
 +
STARTBIRD=0
 +
;;
 +
ospf)
 +
STARTFW=0
 +
;;
 +
esac
 +
;;
 +
esac
 +
if [ ${STARTFW} -eq 1 ]; then
 +
if [ "${1}" = "reload" ]; then
 +
if [ "${2}" = "fw" -o -z "${2}" ]; then
 +
echo "  firewall"
 +
fi
 +
fi
 +
. ${FWCONF}
 +
fi
 +
if [ ${STARTBIRD} -eq 1 ]; then
 +
if [ "${1}" = "reload" ]; then
 +
if [ "${2}" = "ospf" -o -z "${2}" ]; then
 +
echo "  OSPF"
 +
/usr/bin/bird4.init stop
 +
fi
 +
fi
 +
mkbirdconf
 +
sleep 1
 +
/usr/bin/bird4.init start
 +
fi
 +
;;
 +
stop)
 +
echo "CTWUG shutdown"
 +
/usr/bin/bird4.init stop
 +
iptables -F FIREWALL
 +
;;
 +
esac
 +
</pre>
 +
 
 +
 
 +
'''/etc/persistent/rc.poststart''':
 +
<pre>
 +
/etc/persistent/rc.ctwug start
 +
</pre>
 +
 
 +
 
 +
'''/etc/persistent/rc.prestop''':
 +
<pre>
 +
/etc/persistent/rc.ctwug stop
 +
</pre>
 +
 
 +
===Step 6: Finishing touches===
 +
Run the following commands from within '''/etc/persistent''':
 +
 
 +
<pre>
 +
chmod +x config.php rc.ctwug
 +
save
 +
</pre>
 +
 
 +
All done!  When you reboot your router the changes you made should take effect.
 +
 
 +
===Extra: Making changes===
 +
If changes need to be made to '''bird4.conf.sh''' or '''rc.firewall''', either or both must be reloaded for the changes to take effect.
  
We use [http://en.wikipedia.org/wiki/Advanced_Direct_Connect ADC] for sharing files on the WUG.  You will need an ADC 1.0 compliant client to participate, and we recommend [http://eiskaltdc.sourceforge.net/ EisKaltDC].  Once installed use the following connection settings:
+
To reload the firewall ruleset:
 +
<pre>
 +
reload fw
 +
</pre>
  
* '''Mode:''' Active
+
To reload the OSPF configuration:
* '''TCP Port:''' 52000
+
<pre>
* '''UDP Port:''' 52000
+
reload ospf
* '''TLS Port:''' 52001
+
</pre>
  
Make sure those ports are open on your respective firewalls (the above AirOS firewall script leaves those ports open).
+
Or to reload both:
 +
<pre>
 +
reload
 +
</pre>
  
Then just add the ADC hub listed in [[#Network_Services|Network Services]] above to your favourites.
+
Once you've tested the changes and are happy, don't forget to save your changes:
 +
<pre>
 +
save
 +
</pre>

Latest revision as of 17:41, 7 July 2012

Hout Bay WUG

The Hout Bay WUG is a historic name for what is now the Hout Bay area on CTWUG. It started life in March 2010 as a Hout Bay specific WUG, disconnected from CTWUG due to geographic hurdles in connecting. On 23 December 2010 it was connected to CTWUG via Kommetjie, Noordhoek and Fishoek areas. This Wiki entry is just a knowledge base specific to our area.


Meet the Hout Bay Wuggers

Name Nick Nodes
Aragon Aragon Kush Vertex Aragon
Armand armthedark TheBrotherhood DeathStarCanteen
Chris Monty Dungeon
Cobus ObiCanobi TROPiX
Csaba Csaba CyberValley
David HitmanV HitmanV Spike
Denis d3nis d3nis
Georg Georg Slangkop Riverside
Grant McDuck Talon
James flamer Komskom
Jamie Johjam Johjam02
Johan Blik Blik
Jonathan Lazyant Lazyant
Juan JuanH dizzy
Luke InHumaN FinkNode
Nicolaas saalocin saalocin
Richard Richard Joy


Network Services

Address Protocol Admin
172.18.87.1 DNS Aragon
adc://hub.aragon.ctwug.za.net:1511 ADC Aragon
mumble://mumble.aragon.ctwug.za.net Mumble Aragon


File Sharing

We use ADC for sharing files on HBWUG. You will need an ADC 1.0 compliant client to participate. CTWUG's WugDC++ is compatible, but EiskaltDC is another recommended option. If using EiskaltDC, configure the connection settings as follows:

  • Mode: Active
  • TCP Port: 2222
  • UDP Port: 2222
  • TLS Port: 2223

Make sure those ports are open on your respective firewalls, especially the Windows firewall and any anti-virus firewalls.

Then just add the ADC hub listed in Network Services above to your favourites.


Ubiquiti Customisations

We use a number of Ubiquiti customisations to make things run smoother on HBWUG. The following instructions are intended for wuggers with some networking and Unix knowledge. Most of the changes below need to be done on the command line of your device via SSH.

Step 1: Load OSPF firmware

This requires custom Ubiquiti firmware. Either obtain a precompiled image from Aragon or build one yourself by following: Adding OSPF support to Ubiquiti devices.

Load the firmware to your device using the "Update" function in the web interface. Once its loaded and your device has rebooted with the new firmware, continue to the next step.

Step 2: Setup shell profile

From this point on do NOT reboot your device again until you've completed step 5.

Create /etc/persistent/profile with contents:

PS1='\[\e]1;\h-term\a\e]2;\h:\w\a\]\h\$ '
alias reload='/etc/persistent/rc.ctwug reload'

Step 3: Setup BIRD

Create a BIRD configuration script in /etc/persistent/bird4.conf.sh with contents:

mkbirdconf () {
	cat >${BIRDCONF} <<_EOF
log stderr all;
router id ${ROUTERID};

filter ospfin
prefix set hbwug;
ip set hbwuggw;
{
	hbwug = [ 172.18.87.0/24+, 172.18.88.0/24+, 172.18.102.0/23+ ];
	hbwuggw = [ 172.18.87.0, 172.18.102.0 ];
	if net ~ hbwug then {
		if gw.mask(26) ~ hbwuggw then accept;
		reject;
	}
	if net ~ 172.16.0.0/12 then accept;
	reject;
}

protocol kernel {
	persist;
	learn;
	description "kernel";
	scan time 60;
	import none;
	export all;
}

protocol device {
	scan time 60;
}

_EOF

if [ -e ${BIRDCONF}.local ]; then
	cat ${BIRDCONF}.local >>${BIRDCONF}
fi

cat >>${BIRDCONF} <<"_EOF"

protocol ospf wug {
	tick 1;
	description "WUG";
	import filter ospfin;
_EOF
	case ${NETMODE} in
	router)
		cat >>${BIRDCONF} <<"_EOF"
	export all;
	area 0.0.0.0 {
		interface "ath0" {
			cost 10;
			hello 10;
			retransmit 20;
			type broadcast;
			authentication none;
		};
		interface "eth0" {
			cost 10;
			type broadcast;
			stub;
		};
	};
_EOF
		;;
	bridge)
		cat >>${BIRDCONF} <<"_EOF"
	export none;
	area 0.0.0.0 {
		interface "br0" {
			cost 10;
			priority 0;
			hello 10;
			retransmit 20;
			type broadcast;
			authentication none;
		};
	};
_EOF
		;;
	esac
	cat >>${BIRDCONF} <<"_EOF"
}
_EOF
}

Step 4: Create firewall script

Ubiquiti devices run Linux and use iptables for firewalling. Unfortunately Ubiquiti's web interface to iptables is very limited, so in order to run a more advanced firewall we add a custom firewall script.

Create /etc/persistent/rc.firewall with contents:

DCPORT="2222"
TORRENTPORT="7000"

iptables -F FIREWALL
iptables -A FIREWALL --protocol icmp -j ACCEPT
iptables -A FIREWALL -m state --state ESTABLISHED,RELATED -j ACCEPT
iptables -A FIREWALL -i ath0 --dst ${WLANIP} -m state --state NEW -j ACCEPT
iptables -A FIREWALL -i ath0 --dst ${WLANIP} --protocol ospf -m state --state NEW -j ACCEPT
iptables -A FIREWALL -i ath0 --dst 224.0.0.5/32 --protocol ospf -m state --state NEW -j ACCEPT
iptables -A FIREWALL -i ath0 --dst 224.0.0.6/32 --protocol ospf -m state --state NEW -j ACCEPT
iptables -A FIREWALL -i ath0 --dst 224.0.0.22/32 --protocol igmp -m state --state NEW -j ACCEPT
iptables -A FIREWALL -i ath0 --dst ${LOCALNET} --protocol tcp --dport ${DCPORT} -m state --state NEW -j ACCEPT
iptables -A FIREWALL -i ath0 --dst ${LOCALNET} --protocol tcp --dport $((${DCPORT}+1)) -m state --state NEW -j ACCEPT
iptables -A FIREWALL -i ath0 --dst ${LOCALNET} --protocol udp --dport ${DCPORT} -m state --state NEW -j ACCEPT
iptables -A FIREWALL -i ath0 --dst ${LOCALNET} --protocol udp --dport ${TORRENTPORT} -m state --state NEW -j ACCEPT
iptables -A FIREWALL -i ath0 --dst ${LOCALNET} --protocol udp --dport 33434:65535 -m state --state NEW -j ACCEPT
iptables -A FIREWALL -i ath0 --protocol tcp -j REJECT --reject-with tcp-reset
iptables -A FIREWALL -i ath0 --dst 255.255.255.255 --protocol udp --dport 5678 -j DROP
iptables -A FIREWALL -i ath0 -j REJECT

The above is a starting point that will work for most wuggers. Modify it as you need if you understand iptables.

Also remember to:

  • Enable the firewall in the web interface of your device. (after step 6)
  • Configure your DC client as shown above.

Step 5: Create boot time HBWUG scripts

This step creates the necessary boot time code that allows steps 2 and 3 to work. Create the following files:

/etc/persistent/config.php:

#!/bin/cgi -q
<?
chdir("/usr/www");
include("lib/settings.inc");
$cfg = @cfg_load($cfg_file);
if ($cfg == -1) { exit; }
$netmode = cfg_get($cfg, "netmode");
$fwstatus = cfg_get($cfg, "iptables.status");
$lannet = cfg_get($cfg, "netconf.1.ip") + "/" + cfg_get($cfg, "netconf.1.netmask");
$wlanip = cfg_get($cfg, "netconf.2.ip");
$bridgeip = cfg_get($cfg, "netconf.3.ip");
echo("NETMODE=\"$netmode\"\n");
echo("FWSTATUS=\"$fwstatus\"\n");
echo("LOCALNET=\"$lannet\"\n");
echo("WLANIP=\"$wlanip\"\n");
echo("BRIDGEIP=\"$bridgeip\"\n");
?>
BIRDENABLE=1


/etc/persistent/rc.ctwug:

#!/bin/sh

eval "$(/etc/persistent/config.php)"
. /etc/persistent/bird4.conf.sh
PATH=${PATH}:/sbin
BIRDCONF=/etc/persistent/bird4.conf
FWCONF=/etc/persistent/rc.firewall
[ -z "${BIRDENABLE}" ] && BIRDENABLE=0

case "$1" in
start|reload)
	STARTBIRD=0
	STARTFW=0
	if [ "${NETMODE}" = "router" ]; then
		for f in /proc/sys/net/ipv4/conf/*; do
			echo 1 >${f}/accept_redirects
			echo 1 >${f}/send_redirects
		done
		if [ "${FWSTATUS}" = "enabled" -a -e ${FWCONF} ]; then
			STARTFW=1
		fi
		if [ ${BIRDENABLE} -eq 1 -a -n "${WLANIP}" ]; then
			ROUTERID=${WLANIP}
			STARTBIRD=1
		fi
	elif [ "${NETMODE}" = "bridge" ]; then
		if [ ${BIRDENABLE} -eq 1 -a -n "${BRIDGEIP}" ]; then
			ROUTERID=${BRIDGEIP}
			STARTBIRD=1
		fi
	fi
	case "$1" in
	start)
		echo "CTWUG starting"
		;;
	reload)
		echo "CTWUG reloading:"
		case "$2" in
		fw)
			STARTBIRD=0
			;;
		ospf)
			STARTFW=0
			;;
		esac
		;;
	esac
	if [ ${STARTFW} -eq 1 ]; then
		if [ "${1}" = "reload" ]; then
			if [ "${2}" = "fw" -o -z "${2}" ]; then
				echo "  firewall"
			fi
		fi
		. ${FWCONF}
	fi
	if [ ${STARTBIRD} -eq 1 ]; then
		if [ "${1}" = "reload" ]; then
			if [ "${2}" = "ospf" -o -z "${2}" ]; then
				echo "  OSPF"
				/usr/bin/bird4.init stop
			fi
		fi
		mkbirdconf
		sleep 1
		/usr/bin/bird4.init start
	fi
	;;
stop)
	echo "CTWUG shutdown"
	/usr/bin/bird4.init stop
	iptables -F FIREWALL
	;;
esac


/etc/persistent/rc.poststart:

/etc/persistent/rc.ctwug start


/etc/persistent/rc.prestop:

/etc/persistent/rc.ctwug stop

Step 6: Finishing touches

Run the following commands from within /etc/persistent:

chmod +x config.php rc.ctwug
save

All done! When you reboot your router the changes you made should take effect.

Extra: Making changes

If changes need to be made to bird4.conf.sh or rc.firewall, either or both must be reloaded for the changes to take effect.

To reload the firewall ruleset:

reload fw

To reload the OSPF configuration:

reload ospf

Or to reload both:

reload

Once you've tested the changes and are happy, don't forget to save your changes:

save