PJI11104-2016-1
Revisão de 17h01min de 15 de agosto de 2016 por Simara.sonaglio (discussão | contribs) (Criou página com '==Totem== * Referência: Imagem:TCC_MuriloBauer.pdf * Script <tt>/etc/init.d/gourmet</tt> com permissões 755: <syntaxhighlight lang=bash> #!/bin/bash if [ "${3}" = "" ] then echo "Use: ...')
Totem
- Referência: Arquivo:TCC MuriloBauer.pdf
- Script /etc/init.d/gourmet com permissões 755:
#!/bin/bash
if [ "${3}" = "" ]
then
echo "Use: ${0} map <interface_mesh> <interface_ap>"
echo " ${0} mpp <interface_mesh> <interface_internet>"
exit 1
else
TIPO=${1}
MESH=${2}
AP=${3}
INTERNET=${3}
fi
function basico(){
service network-manager stop
ip link set ${1} down
iw dev ${1} interface add mesh0 type mp mesh_id Gourmet-Backhaul
# iw dev mesh0 set channel 9
iw dev mesh0 set freq 5190 HT40+
ip link set mesh0 up
}
function map(){
brctl addbr br0
brctl addif br0 mesh0
ip link set br0 up
ip -4 address add 10.0.0.X/8 dev br0
ip -4 route add 0.0.0.0/0 via 10.0.0.1
killall -TERM hostapd
sleep 1
killall -KILL hostapd
echo "interface=${2}" > /etc/hostapd.conf
echo "bridge=br0" >> /etc/hostapd.conf
echo "driver=nl80211" >> /etc/hostapd.conf
echo "ssid=Gourmet" >> /etc/hostapd.conf
echo "channel=3" >> /etc/hostapd.conf
echo "ctrl_interface=/var/run/hostapd" >> /etc/hostapd.conf
hostapd -B /etc/hostapd.conf
}
function mpp(){
ip link set mesh0 up
ip -4 address add 10.0.0.1/8 dev mesh0
iw mesh0 set mesh_param mesh_gate_announcements 1
iw mesh0 set mesh_param mesh_hwmp_rootmode 1
restart isc-dhcp-server
ip link set ${2} up
dhclient ${2}
sysctl -w net.ipv4.conf.all.forwarding=1
iptables -t nat -F
iptables -t nat -A POSTROUTING -o ${2} -j MASQUERADE
}
case ${TIPO} in
"map")
basico ${MESH}
map ${MESH} ${AP}
;;
"mpp")
basico ${MESH}
mpp ${MESH} ${INTERNET}
;;
esac
- Para usar no servidor: adicionar a seguinte linha no começo do arquivo /etc/rc.local:
/etc/init.d/gourmet mpp wlan2 eth0
- Para usar no totem: adicionar a seguinte linha no começo do arquivo /etc/rc.local:
/etc/init.d/gourmet map wlan2 wlan0
para verificar o funcionamento da rede sem fio:
watch -n1 'iw dev mesh0 station dump | egrep "(Station|inactive|rx|tx)"; echo; iw dev mesh0 mpath dump; echo; hostapd_cli all_sta | egrep "(:|connected_time)"'