============ Installation ============ .. highlight:: guess Flash OpenWrt firmware ====================== Attach your router and connect via webbrowser at http://192.168.1.1 with user "admin" and password "admin". Go to :menuselection:`SystemTools --> Firmware Upgrade` and flash with OpenWrt firmware image downloaded from http://lightrouter.googlecode.com/files/openwrt-lightrouter-final-10-factory.bin Basic Configuration =================== Password -------- After reboot set password login via telnet and set password to kuffner12568 (in Windows use `Putty`_):: telnet 192.168.1.1 root@OpenWrt:/# passwd Changing password for root New password: Retype password: Password for root changed by root Logout & Login via ssh root@192.168.1.1 (in Windows use `Putty`_). Login via webbrowser at http://192.168.1.1 with user "root" and password "kuffner12568". .. _Putty: http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html System Settings --------------- Set hostname in :menuselection:`System --> System` Led configuration :menuselection:`System --> LED Configuration` .. image:: images/LEDConfiguration.png Or change /etc/config/system to: .. literalinclude:: config/generic/etc/config/system Storage ======= Attach USB-Stick and check connection:: root@OpenWrt:~# lsusb Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub Bus 001 Device 002: ID 05e3:0608 Genesys Logic, Inc. USB-2.0 4-Port HUB Bus 001 Device 004: ID 19d2:0117 ONDA Communication S.p.A. root@OpenWrt:~# dmesg usb-storage: device found at 4 usb-storage: waiting for device to settle before scanning scsi 1:0:0:0: Direct-Access ZTE MMC Storage 2.31 PQ: 0 ANSI: 2 usb-storage: device scan complete sd 1:0:0:0: [sda] 3866624 512-byte logical blocks: (1.97 GB/1.84 GiB) sd 1:0:0:0: [sda] Write Protect is off sd 1:0:0:0: [sda] Mode Sense: 0f 0e 00 00 sd 1:0:0:0: [sda] Assuming drive cache: write through sd 1:0:0:0: [sda] Assuming drive cache: write through sda: sda1 sd 1:0:0:0: [sda] Assuming drive cache: write through sd 1:0:0:0: [sda] Attached SCSI removable disk root@OpenWrt:~# fdisk -l Disk /dev/sda: 1979 MB, 1979711488 bytes 1 heads, 62 sectors/track, 62364 cylinders Units = cylinders of 62 * 512 = 31744 bytes Device Boot Start End Blocks Id System /dev/sda1 * 3 62365 1933247+ c Win95 FAT32 (LBA) Create partition:: root@OpenWrt:~# fdisk /dev/sda The number of cylinders for this disk is set to 5139. There is nothing wrong with that, but this is larger than 1024, and could in certain setups cause problems with: 1) software that runs at boot time (e.g., old versions of LILO) 2) booting and partitioning software from other OSs (e.g., DOS FDISK, OS/2 FDISK) Command (m for help): d Selected partition 1 Command (m for help): n Command action e extended p primary partition (1-4) p Partition number (1-4): 1 First cylinder (1-1322, default 1): Using default value 1 Last cylinder or +size or +sizeM or +sizeK (1-1322, default 1322): +1G Command (m for help): n Command action e extended p primary partition (1-4) p Partition number (1-4): 2 First cylinder (332-1322, default 332): Using default value 332 Last cylinder or +size or +sizeM or +sizeK (332-1322, default 1322): +64M Command (m for help): n Command action e extended p primary partition (1-4) p Partition number (1-4): 3 First cylinder (354-1322, default 354): Using default value 354 Last cylinder or +size or +sizeM or +sizeK (354-1322, default 1322): Using default value 1322 Command (m for help): t Partition number (1-4): 2 Hex code (type L to list codes): 82 Changed system type of partition 2 to 82 (Linux swap) Command (m for help): p Disk /dev/sda: 4004 MB, 4004511744 bytes 116 heads, 51 sectors/track, 1322 cylinders Units = cylinders of 5916 * 512 = 3028992 bytes Device Boot Start End Blocks Id System /dev/sda1 1 331 979072+ 83 Linux /dev/sda2 332 353 65076 82 Linux swap /dev/sda3 354 1322 2866302 83 Linux Command (m for help): w The partition table has been altered! Calling ioctl() to re-read partition table Create Filesystem:: root@OpenWrt:~# mkfs.ext4 -L lroot /dev/sda1 mke2fs 1.41.11 (14-Mar-2010) Filesystem label=lroot OS type: Linux Block size=1024 (log=0) Fragment size=1024 (log=0) Stride=0 blocks, Stripe width=0 blocks 62744 inodes, 250044 blocks 12502 blocks (5.00%) reserved for the super user First data block=1 Maximum filesystem blocks=67371008 31 block groups 8192 blocks per group, 8192 fragments per group 2024 inodes per group Superblock backups stored on blocks: 8193, 24577, 40961, 57345, 73729, 204801, 221185 Writing inode tables: done Creating journal (4096 blocks): done Writing superblocks and filesystem accounting information: done This filesystem will be automatically checked every 28 mounts or 180 days, whichever comes first. Use tune2fs -c or -i to override. root@OpenWrt:~# mkfs.ext4 -L lhome /dev/sda3 mke2fs 1.41.11 (14-Mar-2010) Filesystem label=lhome OS type: Linux Block size=4096 (log=2) Fragment size=4096 (log=2) Stride=0 blocks, Stripe width=0 blocks 97536 inodes, 389546 blocks 19477 blocks (5.00%) reserved for the super user First data block=0 Maximum filesystem blocks=402653184 12 block groups 32768 blocks per group, 32768 fragments per group 8128 inodes per group Superblock backups stored on blocks: 32768, 98304, 163840, 229376, 294912 Writing inode tables: done Creating journal (8192 blocks): done Writing superblocks and filesystem accounting information: done This filesystem will be automatically checked every 24 mounts or 180 days, whichever comes first. Use tune2fs -c or -i to override.s first. Use tune2fs -c or -i to override. root@OpenWrt:~# mkswap /dev/sda2 Setting up swapspace version 1, size = 79609856 bytes UUID=0f10c589-fce3-4f20-9c99-5ec49b4c23f2 root@lightkuffner:~# Edit mount points in Luci :menuselection:`System --> Mountpoints` .. image:: images/MountPoints10.png Or change /etc/config/fstab to: .. literalinclude:: config/generic/etc/config/fstab Create new root filesystem on usb-stick:: umount /dev/sda1 mount /dev/sda1 /mnt rm -rf /mnt/* mkdir /tmp/root mount -o bind / /tmp/root cp -a /tmp/root/* /mnt umount /tmp/root umount /mnt mkdir /home Reboot System:: root@OpenWrt:~# reboot Check mount points:: root@atkuffner:/home/light# mount rootfs on / type rootfs (rw) /dev/root on /rom type squashfs (ro,relatime) proc on /proc type proc (rw,relatime) sysfs on /sys type sysfs (rw,relatime) tmpfs on /tmp type tmpfs (rw,nosuid,nodev,relatime) tmpfs on /dev type tmpfs (rw,relatime,size=512k,mode=755) devpts on /dev/pts type devpts (rw,relatime,mode=600) /dev/sda1 on /overlay type ext4 (rw,relatime,barrier=1,data=ordered) mini_fo:/overlay on / type mini_fo (rw,relatime) debugfs on /sys/kernel/debug type debugfs (rw,relatime) /dev/sda3 on /home type ext4 (rw,relatime,barrier=1,data=ordered) none on /proc/bus/usb type usbfs (rw,relatime) root@atkuffner:/home/light# df -h Filesystem Size Used Available Use% Mounted on /dev/root 6.1M 6.1M 0 100% /rom tmpfs 14.4M 296.0K 14.1M 2% /tmp tmpfs 512.0K 0 512.0K 0% /dev /dev/sda1 3.8G 99.7M 3.5G 3% /overlay mini_fo:/overlay 6.1M 6.1M 0 100% / /dev/sda3 3.5G 263.6M 3.0G 8% /home Create directories:: mkdir /home/down UMTS ==== Add UMTS Interface in :menuselection:`Network --> Interfaces` .. image:: images/InterfacesUwanCreate.png .. image:: images/InterfacesUwanSetup.png .. image:: images/InterfacesUwanFirewall.png Or change /etc/config/network to: .. literalinclude:: config/umts/etc/config/network Update usb_modswitch script:: cd /home/down/ wget http://lightrouter.googlecode.com/files/usb_modswitch_19d2_0117 cp usb_modswitch_19d2_0117 /etc/usb_modeswitch.d/19d2\:0117 GPSD ==== Change /etc/init.d/gpsd to: .. literalinclude:: config/gps/etc/init.d/gpsd Change /etc/ntp.conf to: .. literalinclude:: config/gps/etc/ntp.conf Get gpstimesync:: mkdir /home/down cd /home/down wget https://bitbucket.org/Atrawog/gpstimesync/src/7a5842ac6031/gpstimesync.tar.gz tar -xvzf gpstimesync.tar.gz mv gpstimesync /home Change /etc/crontabs/root to: .. literalinclude:: config/gps/etc/crontabs/root FixTime ======= Update Fixtime script:: cd /home/down/ wget http://lightrouter.googlecode.com/files/luci_fixtime cp luci_fixtime /etc/init.d chmod 755 /etc/init.d/luci_fixtime Statistics ========== Create directory for statistics:: mkdir /home/rrd mkdir /home/rrd/image mkdir /home/rrd/data Change output directory in :menuselection:`Statistics --> Collectd --> Output plugins --> RRDTools` .. image:: images/CollectdRRD.png Or change /etc/config/luci_statistics to: .. literalinclude:: config/generic/etc/config/luci_statistics SSH-Keys ======== Create SSH keys (leave passphrase empty):: ssh-keygen -t dsa Generating public/private dsa key pair. Enter file in which to save the key (/root/.ssh/id_dsa): Created directory '/root/.ssh'. Enter passphrase (empty for no passphrase): Enter same passphrase again: Your identification has been saved in /root/.ssh/id_dsa. Your public key has been saved in /root/.ssh/id_dsa.pub. Enable key authentification with datenscheibe.org:: scp /root/.ssh/id_dsa.pub light@datenscheibe.org:~/.ssh/atkuffner_id_dsa.pub ssh light@datenscheibe.org "cat ~/.ssh/atkuffner_id_dsa.pub >> ~/.ssh/authorized_keys" ssh light@datenscheibe.org "chmod 700 ~/.ssh/authorized_keys" SSH-Tunnnel =========== Change /etc/config/sshtunnel to: .. literalinclude:: config/umts/etc/config/sshtunnel Lightmeter ========== Install lightmeter software:: mkdir /home/down mkdir /home/light mkdir /home/log cd /home/down wget http://lightrouter.googlecode.com/files/lightmeter-mini-0.5.2.tar.gz tar -xvzf lightmeter-mini-0.5.2.tar.gz cp -r /home/down/lightmeter-mini-0.5.2 /home/lightmeter Lightmeter check for version Mark 2.3:: /home/lightmeter/lightmeter23.py -cv Lightmeter check for Version Mark 2.3l:: /home/lightmeter/lightmeter23l.py -cv Local Startup ============= Configure local startup in :menuselection:`Services --> Initscripts --> LocalStartup` .. image:: images/LocalStartup10.png For UMTS change /etc/rc.local to: .. literalinclude:: config/umts/etc/rc.local Scheduled Task ============== Configure scheduled task in :menuselection:`Services --> Scheduled Tasks` .. image:: images/ScheduledTasks10.png Or change /etc/crontabs/root to: .. literalinclude:: config/umts/etc/crontabs/root Sysupgrade ========== Change /etc/sysupgrade.conf to: .. literalinclude:: config/umts/etc/sysupgrade.conf Save configuration ================== Copy config to USB-Stick:: mkdir /home/backup mkdir /home/backup/uci rsync -av --delete /etc /home/backup rsync -av --delete /root /home/backup uci export > /home/backup/uci/uci.export Restore configuration ===================== Restore config and lightmeter files:: cp /home/backup/etc/rc.local /etc cp /home/backup/etc/init.d/luci_fixtime /etc/init.d cp /home/backup/etc/crontabs/root /etc/crontabs cp -r /home/down/lightmeter-mini-0.5.2 /lightmeter cp /home/backup/etc/usb_modeswitch.d/19d2:0117 /etc/usb_modeswitch.d