F2 MgtConsole tweaks
From FON Wiki Beta
This page intends to document advanced usage of La Fonera 2.0
Contents |
Mark La Fonera 2.0 icon as registered
- launch a SSH session to 192.168.10.1
uci set registered.fonreg.registered=1 uci commit registered
- (refresh) your webbrowser for 192.168.10.1 :-)
FreeWLAN skin for La Fonera 2
wget http://www.fonera.be/extras/freewlan/fonera_20-logo.gif -O /www/images/table/logo.gif wget http://www.fonera.be/extras/freewlan/register_alert.gif -O /www/images/register_alert.gif wget http://www.fonera.be/extras/freewlan/register_ok.gif -O /www/images/register_ok.gif
Firewall
How to enable ssh access on the WAN interface
Run the following:
iptables -A input_daemon -p tcp --dport 22 -j zone_wan_ACCEPT
If you want to make it more permanent edit
- /etc/fonstated/FWALLDaemon (beta2) -> Will become a Queueing daemon
- or /etc/firewall.daemon (beta)
- to reload the firewall with the new settings:
/etc/init.d/firewall restart
Remark : you can do thesame for port 80 (Managment Website) Remark2 : it's not necessary to do this for the following ports 139/445/tcp for fileshares, 21/20/tcp for FTP ... hence when enabling these "services" you are asked if they should be opened up from the WAN as well... a "netstat -an | grep "LISTEN" will tell you the other interesting ports that you might want to open up towards the WAN
allow access from WAN to LAN/Myplace
- edit /etc/config/firewall
- find : config zone option name wan option input REJECT option output ACCEPT option forward REJECT option masq 1
- replace Option input REJECT should be replaced with option input ACCEPT
- Add make forward ACCEPT and add option masq 1
firewall.user
- By default there is only a /etc/firewall.fon which is active/restarted very often when the FONhotspot is restarted
- You can create a firewall.user which is used without this issues:
uci add firewall include; uci set firewall.@include[-1].path=/etc/firewall.user; uci commit firewall
- then just create /etc/firewall.user with iptables rules
Forward port 80 to another server
echo "iptables -t nat -I PREROUTING -p tcp -i eth0.1 --dport 80 -j DNAT --to serverip:80" >> /etc/firewall.user echo "iptables -I FORWARD -p tcp -i eth0.1 -d serverip --dport 80 -j ACCEPT" >> /etc/firewall.user
QOS
- if you are doing VOIP you might add your SIP & RTP ports to the "express" section (currently reserved for 5190 port)
- The hotspot speed section can be maintained centrally in www.fon.com -> MyFon
- The WAN section needs to be configured using SSH access at the moment. If you are connected at a 15mbit speed (most cable docsis 2.0 users) you will have to augment the 6144 limitation to get the full speed again of your isp
- config can be found here : /etc/config/qos
config 'interface' 'hotspot' option 'classgroup' 'Default' option 'enabled' '0' option 'overhead' '1' option 'upload' '512' option 'download' '128'
config 'interface' 'wan' option 'classgroup' 'Default' option 'enabled' '0' option 'overhead' '1' option 'upload' '6144' option 'download' '1024'
- Command line configuration :
uci set qos.wan.upload=192 # Upload speed in KB uci set qos.wan.download=2048 # Download speed in KB uci commit qos
- Start QoS and enable on next boot
/etc/init.d/qos start /etc/init.d/qos enable
SAMBA
- GUI
- enable samba
- enter a password for the user "fonero"
- using linux :
smbclient //192.168.10.1/usb-disc/ -U fonero
- using windows :
ssh to 192.168.10.1
vi /etc/config/samba
add (normally it's added automatically if you connect an usb stick)
config 'sambashare' 'sambashare1'
option 'name' 'myshare'
option 'path' '/tmp'
option 'read_only' 'no'
option 'guest_ok' 'yes'
option 'create_mask' '0700'
option 'dir_mask' '0700'
by default "fonero" has no password; you can enter it by GUI or ....
smbpasswd fonero fonero
let's see that the changes are found&executed? cd /etc/init.d ./samba stop ./samba start
now let's try to connect from Windows XP SP2: net use * //192.168.10.1/myshare /user:fonero give password : fonero Y: has been shared successfully dir y: ...... nice we see the contents of the /tmp of the La Fonera 2 beware that you can only create files/folders in /tmp/mounts ; the rest is ro I believe the above can be done with "UCI" commands as well
FTP
- I can't seem to be able to connect
Did you surf to 192.168.10.1 , check services -> ftp, enable the FTP service? Don't forget to give him a password!
- I can only change the password; which user should I use? root nor admin works?
Try the user "fonero"
- Only 1 user can connect?
Yes. SSH to your La Fonera 2.0. vi /etc/config/pureftpd Edit "maxclientsperip" and "maxclientsnumber" and augment the numer 1 into something higher to your likings
- I'm connected but when i do a "ls" i notice there is nothing there
You probably didn't connect any usb harddisk or memory stick to the fonera2. It's showing the contents of /tmp/mounts This folder is empty if you didn't add a memory stick
- I try to upload a file to it but I get 553 Disk Full - please upload later
Yes you are not allowed to upload something directly in /tmp/mounts
- I try to create a subfolder but I get a 550 Quota exceeded: %s won't be saved
Create a test folder using a SSH session. Beware that /tmp/mounts is deleted after a powerrecycle ssh towards 192.168.10.1 cd /tmp/mounts mkdir test ftp towards 192.168.10.1 and connect with user fonero ls you should see a folder test cd test put test.txt this should succeed now
opkg
By default there is no ipkg/opkg installed to install .ipk packages
- A solution is:
cd /tmp wget http:// ...madplay_0.15.2b-1_mips.ipk tar xzvf madplay_0.15.2b-1_mips.ipk tar xzvf data.tar.gz -C /
- Another solution is to install OPKG
ssh to your fonera 2 wget -q http://www.fonera.be/rep/FON2202/data.tar.gz -O /tmp/data.tar.gz cd / tar xzvf /tmp/data.tar.gz echo src fon2202 http://www.fonera.be/rep/FON2202 >>/etc/opkg.conf opkg update expected errors : some GPG error on fon2202 some opkg_Download error on openwrt
- Another installation method is :
cd /;wget -O- http://downloads.openwrt.org/snapshots/atheros/packages/opkg_4564-1_mips.ipk|tar -xzvf- |tar -xzvf ./data.tar.gz;rm control.tar.gz data.tar.gz debian-binary
- Not installing in F2 memory but on an usb memory stick, harddisk or sd card?
Make sure the destination has EXT2/EXT3 filesystem in place. We need support for linux Symbolic Links which is not possible on eg NTFS/FAT filesystems.
echo dest usb /tmp/mounts/stick >> /etc/opkg.config
- When trying to install to a non-root destination:
opkg -dest usb install kmod-fs-cifs
- Let's try to install "cifs" support
opkg install kmod-fs-cifs
- Let's try to mount a Cifs share on the remote pc 192.168.10.2 with sharename "terrabyte-share"
mkdir /mnt/cifs mount -t cifs //192.168.10.2/terrabyte-share /mnt/cifs -o user=fonero,password=fonero ls /mnt/cifs
Fonstated
/etc/init.d
- /etc/init.d/ is gone mostly in the new firmware
- we use /etc/fonstated/ now
- much easier and nicer
- faster, smaller
- and you can write the handlers in lua
- reference : lua is used in world of warcraft and many other games
/etc/crontab/root
- fonstated basically takes events as an input
- to queue and event do fs -l <EVENT>
- fonstated processes 1 event at a time
- event map directly to /etc/fonstated/
- currently use a shell script, but it will support lua in the final version
- next, look in /usr/lib/fonstate/*.so these are all plugins running inside or forked by fonstated (hence several processes)
- a fonstated plugin is written in c and can
- use the internal timer apis
- queue evente
- register events
- the watchdog is controlled via "fs -l" without the need for a script in /etc/fonstated
- there are 2 special events Online and Offline
- these are triggered by fonstate_online.so
- so the idea is that do write a plugin, you need
- a uci file (the confgi files used by openwrt, really simple)
- a uvl file (optional) (validation scheme for uci file)
- luci pages - to configure your daemon, app, ...
- fonstated script, that handles how, when, where, ... the plugin does something or not
that was the very quick howto :) more to come when i am ready (c) Blogic
HELP my DISK IS FULL
- Please verify with : df -k
- You can use du -h / to check which folders are taking so much ram
- please perform "rm -R /jffs/*" which should help without the need to reflash
Transmitting Power
ath0 = Public ath1 = Private
- Display current transmitting power:
iwconfig ath0 | grep Tx-Power
- List available transmit-powers:
iwlist ath0 tx
- Change the transmitting power for example to 10dbm (10mw):
iwconfig ath0 txpower 10 iwconfig ath1 txpower 10
Usb stick operations
Formatting usb stick to ext2 to install software on
Help my usb stick is corrupt
- dmesg reports that an e2fsck is required due to possible corruption of my disc
root@Fonera:~# dmesg EXT3-fs: Unrecognized mount option "uid=1000" or missing value EXT2-fs warning: mounting unchecked fs, running e2fsck is recommended
- Execute :
cd /tmp wget http://ipkg.nslu2-linux.org/feeds/openwrt/fon-ng/mips/e2fsprogs_1.40.11-1_mips.ipk wget http://ipkg.nslu2-linux.org/feeds/openwrt/fon-ng/mips/libblkid_1.40.11-1_mips.ipk wget http://ipkg.nslu2-linux.org/feeds/openwrt/fon-ng/mips/libuuid_1.40.11-1_mips.ipk opkg install libuuid_1.40.11-1_mips.ipk libblkid_1.40.11-1_mips.ipk e2fsprogs_1.40.11-1_mips.ipk
- Output (it can take upto 1,5 minutes to install)
Installing libuuid (1.40.11-1) to root... Installing libblkid (1.40.11-1) to root... Installing e2fsprogs (1.40.11-1) to root... Configuring e2fsprogs Configuring libblkid Configuring libuuid
- You can now perform :
root@Fonera:~# e2fsck /dev/sda1 e2fsck 1.40.11 (17-June-2008) 2GB was not cleanly unmounted, check forced. Pass 1: Checking inodes, blocks, and sizes Inode 23529, i_size is 1376256, should be 1384448. Fix<y>? yes Inode 23529, i_blocks is 2696, should be 2712. Fix<y>? yes Inode 54883, i_blocks is 1432832, should be 1432872. Fix<y>? yes Pass 2: Checking directory structure Entry 'amule.conf' in /amule/.aMule (109764) has deleted/unused inode 109785. Clear<y>? yes Pass 3: Checking directory connectivity Pass 4: Checking reference counts Pass 5: Checking group summary information Block bitmap differences: -(276780--276787) -466954 Fix<y>? yes Free blocks count wrong for group #3 (26568, counted=26578). Fix<y>? yes Free blocks count wrong for group #8 (3, counted=9). Fix<y>? yes Free blocks count wrong for group #14 (530, counted=531). Fix<y>? yes Free blocks count wrong (123940, counted=123957). Fix<y>? yes Inode bitmap differences: -109785 Fix<y>? yes Free inodes count wrong for group #14 (7619, counted=7620). Fix<y>? yes Free inodes count wrong (124563, counted=124564). Fix<y>? yes 2GB: ***** FILE SYSTEM WAS MODIFIED ***** 2GB: 876/125440 files (0.7% non-contiguous), 375980/499937 blocks
- Issue :
-> cd /tmp/mounts/Disc-A1 : -ash: cd: can't cd to Disc-A1 -> mount /dev/sda1 : mount: mounting /dev/sda1 on /home failed: Device or resource busy -> umount : identical
enable / disable developer mode
the difference between the normal firmware and the developer firmware is a simple setting.
- enable:
to enable the developer mode you may need a serial cable.
uci set registered.fonreg.dev=1 uci commit registered
- disable:
uci set registered.fonreg.dev=0 uci commit registered
Projects
- Use your UMTS/3G stick of your operator to give Free FON Wifi where no broadband connection exists.
- Turn your Fonera 2 into a security webcam using a cheap usb webcam
- Turn your Fonera 2 into a Streaming Internet Radio using a cheap usb audiocard stick available on ebay
<math>Insert formula here</math>
- Adding F2-USB internal USB to your Fonera

