User Tools

Site Tools


openwrt

OpenWRT

Beschreibung

Freie Router Firmware auf Linux-Basis. Mit kompletter Weboberfläche ( LuCi ) zur Administration.

Bisher verwendete Router:

  • Fon 2100
  • Linksys WRT54GL
  • Linksys WRT350N v2

Selbst kompiliert für Linksys WRT350N v2: http://openwrt.knallimall.org/

Befehle

mtd

mtd unlock rootfs_data

Beschreibung

Macht das root-Filesystem beschreibbar

iftop

iftop -i eth0.1

Beschreibung

Zeigt den Netzwerktraffic hübsch im Terminal an

Setup IPtables

redirect VPN

Beschreibung

Leitet Anfragen auf den port 1194 auf den VPN-Server weiter.

Folgendes in die /etc/config/firewall eintragen. Am Besten ganz am Schluss.

## VPN                                    
config 'redirect'                         
        option 'src' 'wan'                
        option 'proto' 'udp'              
        option 'src_ip' ''                
        option 'src_dport' '1194'         
        option 'dest_ip' '***** IP *****'    
        option 'dest_port' '1194'         
                                        
config 'rule'                             
        option 'src' 'wan'                
        option 'target' 'ACCEPT'          
        option 'proto' 'udp'              
        option dest_ip ''                 
        option 'dest_port' '1194'
    

ICMP freischalten (erlaube ping von extern/internet)

config 'rule'                             
      option 'src' 'wan'                
      option 'target' 'ACCEPT'          
      option 'proto' 'icmp'              
      option dest_ip ''                 
      option 'dest_port' ''

USB Extend Memory

Install required packages

opkg update
opkg install kmod-usb2 kmod-usb-storage block-mount block-hotplug kmod-fs-ext4 block-extroot fdisk e2fsprogs

Creating partitions with following command and follow the instroctions shown:

fdisk /dev/sda

Afterwards the partition table should look like this:

fdisk -l
Device Boot      Start         End      Blocks   Id  System
/dev/sda1               1          32      257008+  82  Linux swap / Solaris
/dev/sda2              33         243     1694857+  83  Linux

Create filesystem:

mkswap /dev/sda1 
mkfs.ext3 /dev/sda2

mount swap:

swapon /dev/sda1

Create folder to mount USB Stick

mkdir -p /mnt/shares

Mount Partition:

mount -t ext3 /dev/sda1 /mnt/shares -o rw,sync

edit /etc/config/fstab

config 'mount'
	option 'device' '/dev/sda1'
	option 'options' 'rw,sync'
	option 'enabled_fsck' '0'
	option 'enabled' '1' 
	option 'target' '/mnt/shares'

Copy root to /mnt/shares

tar -C /overlay -cvf - . | tar -C /mnt/sda2 -xf -

Install BackupPC

Prepare for install

opkg install perl
opkg list | grep -o -E perlbase-\\w+ | xargs opkg install

Configure and Install

Download BackupPC and untar it

Configure BackupPC

./configure.pl --batch --backuppc-user=root --html-dir-url=/backuppc/ --html-dir=/www/backuppc/ --cgi-dir=/www/cgi-bin/

Set permissions

chmod +x /www/cgi-bin/BackupPC_Admin
chmod 775 /etc/init.d/backuppc

vi /etc/init.d/backuppc

#!/bin/sh /etc/rc.common    
# Startup init script for BackupPC for OpenWrt        
 
START=95                 
STOP=10                     
 
start() {                              
/usr/local/BackupPC/bin/BackupPC -d                                      
}                                          
 
stop() {                                                   
/usr/bin/pkill -f "/usr/local/BackupPC/bin/BackupPC -d"                                                           
}                                                               
 
restart() {                                                                        
stop                                                                                
start                                                                                        
}                                                                                            
 
reload() {                                                                                                     
/usr/bin/pkill -f -HUP "/usr/local/BackupPC/bin/BackupPC -d"                                                                
}

ssh key exchange

dropbearkey -t rsa -f ~/.ssh/id_rsa

mdadm

http://www.ducea.com/2009/03/08/mdadm-cheat-sheet/

openvpn

http://wiki.openwrt.org/doc/howto/vpn.openvpn?s[]=openvpn

Failsafe

Damit man im Failsafe auch was machen kann muss zuerst die root partition gemounted werden.

Das geschieht mit diesem Befehl:

mount_root

Anwendungsbeispiel: Kein Zugriff per Telnet und das Passwort vergessen. AUch gut zum resetten usw.

openwrt.txt · Last modified: 2015/04/30 22:30 by admin