To get the hardware-version (“Model”):
cat /proc/cpuinfo cat /proc/cpuinfo | grep Model
Run on raspian the following command to start a gui-based configuration tool:
raspi-config
System time and language:
dpkg-reconfigure tzdata #timezone set dpkg-reconfigure locales #system language dpkg-reconfigure keyboard-configuration #Change keyboard
Keyboard language (/etc/default/keyboard):
# KEYBOARD CONFIGURATION FILE # Consult the keyboard(5) manual page. XKBMODEL="pc105" XKBLAYOUT="de" XKBVARIANT="" XKBOPTIONS="" BACKSPACE="guess"
Note: Reboot required to take effect!
alias ls='ls --color=auto' alias ll='ls -alh' alias ..='cd ..' alias ...='cd ../..' alias ss='sudo su -'
vcgencmd measure_temp #show cpu temperature
Create aditional custom partition:
fdisk -u -c /dev/mmcblk0
Aferwards format new partitions:
mkfs.ext4 -Ltmp /dev/mmcblk0p3 mkfs.ext4 -Ldata /dev/mmcblk0p4
Reisize “/” (on /dev/mmcblk0p2) to 8GB:
Old size:
root@raspberry-test:~# df -h Filesystem Size Used Avail Use% Mounted on rootfs 2.9G 2.3G 433M 85% / /dev/root 2.9G 2.3G 433M 85% / devtmpfs 215M 0 215M 0% /dev tmpfs 44M 224K 44M 1% /run tmpfs 5.0M 0 5.0M 0% /run/lock tmpfs 88M 0 88M 0% /run/shm /dev/mmcblk0p1 56M 9.7M 47M 18% /boot
Prepare to enlarge:
root@raspberry-test:~# fdisk -u -c /dev/mmcblk0 Command (m for help): p Disk /dev/mmcblk0: 32.1 GB, 32127320064 bytes 4 heads, 16 sectors/track, 980448 cylinders, total 62748672 sectors Units = sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x00090806 Device Boot Start End Blocks Id System /dev/mmcblk0p1 8192 122879 57344 c W95 FAT32 (LBA) /dev/mmcblk0p2 122880 6399999 3138560 83 Linux Command (m for help): d Partition number (1-4): 2 Command (m for help): n Partition type: p primary (1 primary, 0 extended, 3 free) e extended Select (default p): p Partition number (1-4, default 2): Using default value 2 First sector (2048-62748671, default 2048): 122880 Last sector, +sectors or +size{K,M,G} (122880-62748671, default 62748671): +8G Command (m for help): p Disk /dev/mmcblk0: 32.1 GB, 32127320064 bytes 4 heads, 16 sectors/track, 980448 cylinders, total 62748672 sectors Units = sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x00090806 Device Boot Start End Blocks Id System /dev/mmcblk0p1 8192 122879 57344 c W95 FAT32 (LBA) /dev/mmcblk0p2 122880 16900095 8388608 83 Linux Command (m for help): w The partition table has been altered! Calling ioctl() to re-read partition table. WARNING: Re-reading the partition table failed with error 16: Device or resource busy. The kernel still uses the old table. The new table will be used at the next reboot or after you run partprobe(8) or kpartx(8) Syncing disks.
Reboot System:
root@raspberry-test:~# init 6
Check filesystem and partitions:
root@raspberry-test:~# cat /proc/partitions major minor #blocks name 179 0 31374336 mmcblk0 179 1 57344 mmcblk0p1 179 2 8388608 mmcblk0p2 root@raspberry-test:~# df -h Filesystem Size Used Avail Use% Mounted on rootfs 2.9G 2.3G 433M 85% / /dev/root 2.9G 2.3G 433M 85% / devtmpfs 215M 0 215M 0% /dev tmpfs 44M 224K 44M 1% /run tmpfs 5.0M 0 5.0M 0% /run/lock tmpfs 88M 0 88M 0% /run/shm /dev/mmcblk0p1 56M 9.7M 47M 18% /boot
Enlarge root-fs:
root@raspberry-test:~# resize2fs /dev/mmcblk0p mmcblk0p1 mmcblk0p2 root@raspberry-test:~# resize2fs /dev/mmcblk0p2 resize2fs 1.42.5 (29-Jul-2012) Filesystem at /dev/mmcblk0p2 is mounted on /; on-line resizing required old_desc_blocks = 1, new_desc_blocks = 1 The filesystem on /dev/mmcblk0p2 is now 2097152 blocks long. root@raspberry-test:~# df -h Filesystem Size Used Avail Use% Mounted on rootfs 7.9G 2.3G 5.2G 31% / /dev/root 7.9G 2.3G 5.2G 31% / devtmpfs 215M 0 215M 0% /dev tmpfs 44M 224K 44M 1% /run tmpfs 5.0M 0 5.0M 0% /run/lock tmpfs 88M 0 88M 0% /run/shm /dev/mmcblk0p1 56M 9.7M 47M 18% /boot
Now you are able to add partitions to the disk or other device with “fdisk” and “mkfs.(ext4)”:
fdisk -u -c /dev/mmcblk0
Aferwards format new partitions:
mkfs.ext4 -Ltmp /dev/mmcblk0p3 mkfs.ext4 -Ldata /dev/mmcblk0p4
Check maximum CPU frequence (e.g. when your CPU is under load):
sudo cat /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_max_freq
Check minimum CPU frequence (when your CPU is idle):
sudo cat /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_min_freq
Check current CPU frequence:
sudo cat /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_cur_freq
Sync time via ntpdate:
Uninstall ntp (ressources!).
apt-get purge ntp
Install ntpdate
apt-get install ntpdate #timeserver
Create a file
vi /etc/cron.d/general
and add content (or similar):
*/20 * * * * root /usr/sbin/ntpdate -s 0.de.pool.ntp.org
The cronjob now syncs the system-time.
Routing wlan0 (inside) and eth1 (inside) to eth0 (outside):
Change “/etc/sysctl.conf”
#net.ipv4.ip_forward=1
to
net.ipv4.ip_forward=1
and save it.
To update the setting:
sysctl -p /etc/sysctl.conf
The following command will check forwarding:
sysctl net.ipv4.ip_forward
Temporary for testing isues and not permanent:
echo "1" > /proc/sys/net/ipv4/ip_forward
Switch of forwarding:
echo "0" > /proc/sys/net/ipv4/ip_forward
Much better way concering security
Don´t set “net.ipv4.ip_forward=1” inside “/etc/sysctl.conf” and load it instead a (init)script with command:
echo "1" > /proc/sys/net/ipv4/ip_forward
Hint: Check “restore-iptables” and “iptables initscript” below. Make sure to load iptables first!
Iptables:
sudo iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE sudo iptables -A FORWARD -i eth0 -o wlan0 -m state --state RELATED,ESTABLISHED -j ACCEPT sudo iptables -A FORWARD -i eth0 -o eth1 -m state --state RELATED,ESTABLISHED -j ACCEPT sudo iptables -A FORWARD -i wlan0 -o eth0 -j ACCEPT sudo iptables -A FORWARD -i eth1 -o eth0 -j ACCEPT
Block icmp (ping) on eth0:
iptables -A INPUT -i eth0 -p ICMP --icmp-type 8 -j DROP
NAT:
sudo iptables -t nat -A POSTROUTING ! -d 192.168.0.0/16 -o wlan0 -j SNAT --to-source 192.168.1.2 sudo iptables -t nat -A POSTROUTING ! -d 192.168.0.0/16 -o eth1 -j SNAT --to-source 192.168.1.2
Check also: http://www.thegeekstuff.com/scripts/iptables-rules
iptables-save:
iptables-save > /etc/iptables
iptables-restore:
Create a executable file (e.g. 700) such as “/etc/network/if-pre-up.d/iptables” with following content:
#!/bin/sh iptables-restore < /etc/iptables echo "1" > /proc/sys/net/ipv4/ip_forward
#! /bin/bash ### BEGIN INIT INFO # Provides: iptables # Required-Start: mountkernfs $local_fs # Required-Stop: mountkernfs $local_fs # X-Start-Before: networking # X-Stop-After: networking # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Short-Description: Iptables # Description: Init script for iptables ### END INIT INFO . /lib/lsb/init-functions CONFIG_FILE=/etc/iptables #CONFIG_FILE=/etc/iptables.conf function do_start { if [ -e "${CONFIG_FILE}" ]; then log_daemon_msg "Starting iptables service" "iptables" /sbin/iptables-restore < ${CONFIG_FILE} echo "1" > /proc/sys/net/ipv4/ip_forward log_end_msg $? else log_action_msg "No rules saved for iptables" fi } function do_stop { log_daemon_msg "Stopping iptables service" "iptables" echo "0" > /proc/sys/net/ipv4/ip_forward /sbin/iptables -F /sbin/iptables -X /sbin/iptables -t nat -F /sbin/iptables -t nat -X /sbin/iptables -t mangle -F /sbin/iptables -t mangle -X /sbin/iptables -P INPUT ACCEPT /sbin/iptables -P FORWARD ACCEPT /sbin/iptables -P OUTPUT ACCEPT log_end_msg $? } function do_save { log_daemon_msg "Saving iptables rules" "iptables" /sbin/iptables-save > ${CONFIG_FILE} log_end_msg $? } function do_status { log_daemon_msg "Running iptables rules" "iptables" /sbin/iptables -L log_end_msg $? } case "$1" in start) do_start ;; stop) do_stop ;; status) do_status ;; save) do_save ;; restart) do_stop do_start ;; *) echo "Usage: /etc/init.d/iptables {start|stop|status|restart|save}" exit 1 ;; esac exit 0
Sakis/ Keepalive:
umtskeeper:
Great Tutorial:
https://boundarydevices.com/cellular-modems-on-i-mx6-boards/
Related:
http://www.freedesktop.org/wiki/Software/ModemManager/Debugging/
apt-get install modemmanager network-manager uuid apt-get remove modemmanager network-manager uuid
mmcli -L #lists devices sudo mmcli -m 0 #show information about the specific modem mmcli -m 0 --simple-connect="user=eplus,apn=internet.eplus.de" #connect
http://blog.unixweb.de/usb-stick-lte-telekom-magenta-eins-huawei-e398-modem-raspberry-pi/
Config wvdial:
http://nvdcstuff.blogspot.de/2015/04/huawei-e3372-in-linux-raspberry-pi.html
Test:
Die Ursache für den Absturz des /dev/ttyUSB* Devices war die zu geringe Stromleistung von 600mA an dem USB-Port. Für die Einwahl wird richtig Saft aus dem USB-Port gezogen. Umgehen kann man das Problem, wenn man in der Datei “/boot/config.txt” einen zusätzlichen Parameter einträgt. Achtung geht nur bei Raspberry PI Modell B+ und PI2 !
max_usb_current=1
This commands adds a loadable kernel module to recognize your device. Straight after you run it, your system should automatically detect your device and you can proceed with configuring your internet dongle:
modprobe usbserial vendor=0x0b3c product=0xc005
This commands adds a loadable kernel module to recognize your device. Straight after you run it, your system should automatically detect your device and you can proceed with configuring your internet dongle.
http://jankarres.de/2012/08/raspberry-pi-raspbian-installieren/
http://www.raspberrypi.org/phpBB3/viewtopic.php?f=38&t=46255
http://www.karesyk.de/webcam-server-einrichten/
http://elinux.org/R-Pi_Troubleshooting#Troubleshooting_power_problems
http://elinux.org/R-Pi_Troubleshooting
https://elinux.org/RPi_Hardware#How_can_I_tell_if_the_power_supply_is_inadequate.3F
#ifplugd:
http://www.raspberrypi.org/forums/viewtopic.php?f=63&t=28335
#ifplugd problem wlan0:
http://sirlagz.net/2013/02/10/how-to-use-the-raspberry-pi-as-a-wireless-access-pointrouter-part-3b/
#Convert HiLink to Modem-Mode/ Firmwareupdate:
http://blog.asiantuntijakaveri.fi/2015/07/convert-huawei-e3372h-153-from.html
#nmcli:
http://elviskapllaj.jimdo.com/tutorials/raspberry-pi/raspberry-pi-3g-and-wi-fi-based-on-nmcli/
#libqmi
https://guytp.wordpress.com/2015/05/01/using-raspberry-pi-as-a-carputer-and-wifi-4g-hotspot/
sudo su - echo "CONF_SWAPSIZE=1024" > /etc/dphys-swapfile dphys-swapfile setup dphys-swapfile swapon
Static configuration example.
“wlan0” is primary NIC (also loaded without link on eth0):
auto lo iface lo inet loopback auto wlan0 allow-hotplug wlan0 iface wlan0 inet static address 192.168.1.77 netmask 255.255.255.0 network 192.168.1.0 broadcast 192.168.1.255 #gateway 192.168.1.1 # dns-* options are implemented by the resolvconf package, if installed dns-nameservers 192.168.1.1 #wpa-ap-scan 1 #wpa-scan-ssid 1 wpa-ssid "ssid_name" wpa-psk "password" auto eth0 iface eth0 inet static #iface eth0 inet dhcp address 192.168.1.66 netmask 255.255.255.0 network 192.168.1.0 broadcast 192.168.1.255 gateway 192.168.1.1 # dns-* options are implemented by the resolvconf package, if installed dns-nameservers 192.168.1.1 #dns-search my-domain.local
The priority of networkadapters can be setup/ changed in
/etc/udev/rules.d/70-persistent-net.rules
This file isn´t created on default. To create the file edit:
/lib/udev/rules.d/75-persistent-net-generator.rules
Change
# device name whitelist KERNEL!="ath*|msh*|ra*|sta*|ctc*|lcs*|hsi*", \ GOTO="persistent_net_generator_end"
to
# device name whitelist KERNEL!="eth*|ath*|wlan*[0-9]|msh*|ra*|sta*|ctc*|lcs*|hsi*", \ GOTO="persistent_net_generator_end"
The file
/etc/udev/rules.d/70-persistent-net.rules
has been created after a reboot.
iwlist wlan0 scan iw list
Get wlan-configuration info:
iwconfig
Generate WLAN-Key (to avoid plain-text password):
test@raspberrypi ~ $ wpa_passphrase MY_SSID MY_WPA_KEY network={ ssid="MY_SSID" #psk="MY_WPA_KEY" psk=aebd5aac8952e0ed73f797b9bfe074bcc008e045a5a7028a6dec342f9c }
Afterwards you have to replace “wpa-psk” within “/etc/network/interfaces”:
wpa-psk "aebd5aac8952e0ed73f797b9bfe074bcc008e045a5a7028a6dec342f9c"
Config-file:
/etc/network/interfaces
Config (DHCP):
auto lo iface lo inet loopback iface eth0 inet dhcp auto wlan0 allow-hotplug wlan0 iface wlan0 inet dhcp wpa-ap-scan 1 wpa-scan-ssid 1 wpa-ssid "YOUR-SSID" wpa-psk "YOUR-PASSWORD"
Config (static):
auto lo iface lo inet loopback auto wlan0 allow-hotplug wlan0 iface wlan0 inet static address 192.168.1.X netmask 255.255.255.0 network 192.168.1.0 gateway 192.168.1.1 wireless-power off broadcast 192.168.1.255 dns-nameservers 192.168.1.1 dns-search HOME #auto wlan0 #allow-hotplug wlan0 #iface wlan0 inet dhcp wpa-ap-scan 1 wpa-scan-ssid 1 wpa-ssid "YOUR-SSID" wpa-psk "YOUR-PASSWORD"
Add
wireless-power off
to
/etc/network/interfaces
and reboot your system.
Check wlan adapter and driver with:
/sbin/iwconfig
and
cat /sys/module/8192cu/parameters/rtw_power_mgnt
Fix problems with power saving for 8192cu wireless chip (e. g. TP-Link TL-WN823N WLAN USB-Adapter Mini , 300Mbit/s, WPS, which is quite fast and recomandable for raspberry pi):
dmesg | grep "usbcore: registered new interface driver*"
Output (or similar):
usbcore: registered new interface driver rtl8192cu
Create a file (containing “8192cu”) such as:
/etc/modprobe.d/8192cu.conf
with following content
# Disable power saving and USB autosuspend options 8192cu rtw_power_mgnt=0 rtw_enusbss=0
Reboot your system and check settings:
/sbin/iwconfig Power Management:off
Edit
/boot/config.txt
or
/boot/firmware/config.txt #on newer raspis such as raspi 4
and add:
[all] # turn wifi and bluetooth off dtoverlay=pi3-disable-wifi dtoverlay=pi3-disable-bt
or
[all] # turn wifi and bluetooth off dtoverlay=disable-wifi dtoverlay=disable-bt
on Rapberry Pi 4.
Cronjob examples:
*/2 * * * * root /scripts/check_wlan0.sh >/dev/null 2>&1 */20 * * * * root /scripts/ping_gw.sh >/dev/null 2>&1
Script to check adapter status (“/scripts/check_wlan0.sh”):
Add a script like the following to “/etc/init.d/script.sh”
#! /bin/sh ### BEGIN INIT INFO # Provides: mjpg_streamer # Required-Start: $network $local_fs $remote_fs # Required-Stop: $network $local_fs $remote_fs # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Should-Start: # Should-Stop: # Short-Description: start mjpg_streamer ### END INIT INFO # /etc/init.d/mjpg_streamer # # Carry out specific functions when asked to by the system case "$1" in start) export LD_LIBRARY_PATH="/usr/local/lib" #### option "-b" = background/ deamon mode#### /usr/local/bin/mjpg_streamer -b -i "input_raspicam.so -fps 25 -ex night -x 640 -y 480" -o "output_http.so -p 8082 -w /srv/www -c user:password" >> /var/log/mjpg_streamer.log 2>&1 echo "Starting mjpg_streamer" ;; stop) pkill mjpg_streamer echo "mjpg_streamer has been stopped (didn't double check though)" ;; restart) #PID=`ps -ef |grep mjpg_streamer | cut -d " " -f6 | sed -n "1"p` #kill $PID kill -9 `pidof mjpg_streamer` echo "mjpg_streamer has been stopped" sleep 2 echo "Starting mjpg_streamer" export LD_LIBRARY_PATH="/usr/local/lib" /usr/local/bin/mjpg_streamer -b -i "input_raspicam.so -fps 25 -ex night -x 640 -y 480" -o "output_http.so -p 8082 -w /srv/www -c user:password" >> /var/log/mjpg_streamer.log 2>&1 ;; *) echo "Usage: /etc/init.d/mjpg_streamer {start|stop|restart}" exit 1 ;; esac exit 0
To add the service “script.sh” to system autostart:
sudo update-rc.d script.sh defaults
To remove the service/script.sh from autostart:
update-rc.d -f script.sh remove
sudo apt-get update sudo apt-get upgrade -y sudo apt-get install git-core -y sudo wget http://goo.gl/1BOfJ -O /usr/bin/rpi-update sudo chmod +x /usr/bin/rpi-update sudo rpi-update sudo raspi-config
https://wiki.ubuntuusers.de/Dnsmasq/
sudo dnsmasq --test #check config /usr/sbin/dnsmasq --test
Leases are stored in:
/var/lib/misc/dnsmasq.leases
Config:
/etc/dnsmasq.conf
Konfigure dnsmasq to use another DNS-Server:
localise-queries server=/test.local/10.20.1.94 server=/test.local/10.20.1.98
Reverse-DNS:
# Example of routing PTR queries to nameservers: this will send all # address->name queries for 192.168.3/24 to nameserver 10.1.2.3 #server=/3.168.192.in-addr.arpa/10.1.2.3 server=/0.168.192.in-addr.arpa/10.1.2.3
Request from e. g. “192.168.0.x” will be forwarded to Nameserver 10.1.2.3. Check it with
nslookup IP
Logrotate:
Add
log-facility=/var/log/dnsmasq.log
to
/etc/dnsmasq.conf
Add
/etc/logrotate.d/dnsmasq
with content
/var/log/dnsmasq.log { size 100M weekly rotate 7 compress missingok notifempty postrotate systemctl restart dnsmasq.service endscript }
Install isc-dhcp-server:
apt-get install isc-dhcp-server
Run it/ status:
service isc-dhcp-server start systemctl status isc-dhcp-server.service
Configuration files:
/etc/dhcp/dhcpd.conf /etc/default/isc-dhcp-server
Example “/etc/dhcp/dhcpd.conf”:
# Sample configuration file for ISC dhcpd for Debian # # # The ddns-updates-style parameter controls whether or not the server will # attempt to do a DNS update when a lease is confirmed. We default to the # behavior of the version 2 packages ('none', since DHCP v2 didn't # have support for DDNS.) ddns-update-style none; # option definitions common to all supported networks... #option domain-name "example.org"; #option domain-name-servers ns1.example.org, ns2.example.org; default-lease-time 600; max-lease-time 7200; # If this DHCP server is the official DHCP server for the local # network, the authoritative directive should be uncommented. authoritative; # Use this to send dhcp log messages to a different log file (you also # have to hack syslog.conf to complete the redirection). log-facility local7; #wlan0: subnet 192.168.2.0 netmask 255.255.255.0 { range 192.168.2.2 192.168.2.10; range 192.168.2.150 192.168.2.200; option broadcast-address 192.168.2.255; option routers 192.168.2.254; option domain-name "local"; #option domain-name-servers 8.8.8.8, 8.8.4.4; option domain-name-servers 192.168.1.1; # host hostname { # hardware ethernet 00:22:5D:2H:E2:F9; # fixed-address 192.168.2.5; # server-name "hostname"; # } } #eth1: subnet 192.168.3.0 netmask 255.255.255.0 { default-lease-time 600; max-lease-time 7200; range 192.168.3.2 192.168.3.10; range 192.168.3.150 192.168.3.200; option broadcast-address 192.168.3.255; option routers 192.168.3.254; #option subnet-mask 255.255.255.0; option domain-name "local"; option domain-name-servers 192.168.1.1; host hostname { hardware ethernet 01:22:16:92:A2:C5; fixed-address 192.168.3.4; server-name "hostname"; } }
Example “/etc/default/isc-dhcp-server”:
# Defaults for isc-dhcp-server initscript # sourced by /etc/init.d/isc-dhcp-server # installed at /etc/default/isc-dhcp-server by the maintainer scripts # # This is a POSIX shell fragment # # Path to dhcpd's config file (default: /etc/dhcp/dhcpd.conf). #DHCPD_CONF=/etc/dhcp/dhcpd.conf # Path to dhcpd's PID file (default: /var/run/dhcpd.pid). #DHCPD_PID=/var/run/dhcpd.pid # Additional options to start dhcpd with. # Don't use options -cf or -pf here; use DHCPD_CONF/ DHCPD_PID instead #OPTIONS="" # On what interfaces should the DHCP server (dhcpd) serve DHCP requests? # Separate multiple interfaces with spaces, e.g. "eth0 eth1". INTERFACES="wlan0 eth1"
sudo touch /var/log/dhcpd.log
In “/etc/rsyslog.conf” edit as follows:
*.*;auth,authpriv.none;
to
*.*;auth,authpriv.none;local7.none -/var/log/syslog
Finally
service isc-dhcp-server restart
Show leases:
cat /var/lib/dhcp/dhcpd.leases
Install:
apt-get install hostapd
Start, stop, restart hostapd:
/etc/init.d/hostapd start
Check if interface works in AP mode and which channels:
apt-get install iw iw list | grep AP iwlist chan
Example “/etc/default/hostapd”:
# Defaults for hostapd initscript # # See /usr/share/doc/hostapd/README.Debian for information about alternative # methods of managing hostapd. # # Uncomment and set DAEMON_CONF to the absolute path of a hostapd configuration # file and hostapd will be started during system boot. An example configuration # file can be found at /usr/share/doc/hostapd/examples/hostapd.conf.gz # RUN_DAEMON=yes DAEMON_CONF="/etc/hostapd/hostapd.conf" #DAEMON_CONF="" # Additional daemon options to be appended to hostapd command:- # -d show more debug messages (-dd for even more) # -K include key data in debug messages # -t include timestamps in some debug messages # # Note that -B (daemon mode) and -P (pidfile) options are automatically # configured by the init.d script and must not be added to DAEMON_OPTS. # #DAEMON_OPTS=""
Configuration example “hostapd.conf”:
# Nur fuer den Bridge-Betrieb, fuer AP auskommentieren #bridge=br0 # # Schnittstelle und Treiber interface=wlan0 #driver=rtl8192cu #works for rtl8192cu: driver=rtl871xdrv #driver=nl80211 #driver=rtl871xdrv # # WLAN-Konfiguration ssid=RaspberryAPi channel=11 # # ESSID sichtbar ignore_broadcast_ssid=0 # # Läereinstellungen country_code=DE ieee80211d=1 # # Üertragungsmodus hw_mode=g # # Optionale Einstellungen # supported_rates=10 20 55 110 60 90 120 180 240 360 480 540 # # Draft-N Modus aktivieren / optional nur füsprechende Karten ieee80211n=1 # # wmm-Funktionalitä(fuer draft-n) wmm_enabled=1 # # Üertragungsmodus / Bandbreite 40MHz / siehe iw list # ht_capab=[HT40+][SHORT-GI-40][DSSS_CCK-40] # # Beacons beacon_int=100 dtim_period=2 # # MAC-Authentifizierung macaddr_acl=0 # # max. Anzahl der Clients max_num_sta=20 # # Gröder Datenpakete/Begrenzung rts_threshold=2347 fragm_threshold=2346 # # hostapd Log Einstellungen logger_syslog=-1 logger_syslog_level=2 logger_stdout=-1 logger_stdout_level=2 # # temporary configurationsfile dump_file=/tmp/hostapd.dump ctrl_interface=/var/run/hostapd ctrl_interface_group=0 # # Authentifizierungsoptionen auth_algs=3 # # Verschlüng / hier rein WPA2 wpa=2 #rsn_preauth=1 #rsn_preauth_interfaces=wlan0 wpa_key_mgmt=WPA-PSK rsn_pairwise=CCMP # # Schlüntervalle / Standardkonfiguration wpa_group_rekey=600 wpa_ptk_rekey=600 wpa_gmk_rekey=86400 # # Zugangsschlü(PSK) / hier in Klartext (ASCII) wpa_passphrase=xxxxxxxx
Go to the Realtek downloads page:
#! /bin/sh ### BEGIN INIT INFO # Provides: hostapd # Required-Start: $isc-dhcp-server # Required-Stop: # X-Start-Before: rmnologin # Default-Start: 2 3 4 5 # Default-Stop: 1 6 # Short-Description: Provide limited super user privileges to specific users # Description: Provide limited super user privileges to specific users. ### END INIT INFO start() { /usr/sbin/hostapd -dd -B -P /var/run/hostapd.pid /etc/hostapd/hostapd.conf } stop() { PID=`cat /var/run/hostapd.pid` kill $PID } case "$1" in start) start ;; stop) stop ;; restart) stop start ;; stop|reload|restart|force-reload|status) ;; *) echo "Usage: $N {start|stop|restart|force-reload|status}" >&2 exit 1 ;; esac exit 0
Interesting:
http://www.lavrsen.dk/foswiki/bin/view/Motion/LoopbackDevice
http://www.afraidofsunlight.co.uk/weather/index.php?page=trailcam #python!
raspistill -o test.jpg #create image "test.jpg" raspivid -o testvideo.h264 -t 10000 #create 10 sec. video "testvideo.h264"
Convert file “testvideo.h264” to *.mp4:
sudo apt-get update sudo apt-get install gpac
MP4Box -add testvideo.h264 testvideo.mp4
To disable the raspi-cam LED edit “/boot/config.txt”:
disable_camera_led=1
Enable raspicam, if you get “Failed to open video device /dev/video0: No such file or directory” in motion:
echo "bcm2835-v4l2" | tee -a /etc/modules sudo modprobe bcm2835-v4l2
Init-Script “/etc/init.d/motion”:
#!/bin/sh -e # # /etc/init.d/motion: Start the motion detection # ### BEGIN INIT INFO # Provides: motion # Required-Start: $local_fs $syslog $remote_fs # Required-Stop: $remote_fs # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Short-Description: Start Motion detection # Description: loads motion and assigns privileges ### END INIT INFO # Ported to new debian way using sh and /lib/lsb/init-functions # by Angel Carpintero <ack@telefonica.net> # Modified by : Juan Angulo Moreno <juan@apuntale.com> # Eddy Petrisor <eddy.petrisor@gmail.com> # ArAge <ArAge@gmx.co.uk> NAME=motion PATH_BIN=/bin:/usr/bin:/sbin:/usr/sbin DAEMON=/usr/bin/motion #DAEMON_OPTS='-n' DAEMON_OPTS="-c /etc/motion/motion.conf" PIDFILE=/var/run/$NAME.pid DEFAULTS=/etc/default/$NAME DESC="motion detection daemon" ENV="env -i LANG=C PATH=$PATH_BIN" . /lib/lsb/init-functions test -x $DAEMON || exit 0 RET=0 [ -r "$DEFAULTS" ] && . "$DEFAULTS" || start_motion_daemon=yes check_daemon_enabled () { if [ "$start_motion_daemon" = "yes" ] ; then return 0 else log_warning_msg "Not starting $NAME daemon, disabled via /etc/default/$NAME" return 1 fi } case "$1" in start) if check_daemon_enabled ; then if ! [ -d /var/run/motion ]; then mkdir /var/run/motion fi chown motion:motion /var/run/motion log_daemon_msg "Starting $DESC" "$NAME" if start-stop-daemon --start --oknodo --exec $DAEMON -b --chuid motion -- $DAEMON_OPTS; then #if start-stop-daemon --start --oknodo --exec $DAEMON $DAEMON_OPTS -b --chuid motion ; then log_end_msg 0 else log_end_msg 1 RET=1 fi fi ;; stop) log_daemon_msg "Stopping $DESC" "$NAME" if start-stop-daemon --stop --oknodo --exec $DAEMON --retry 30 ; then log_end_msg 0 else log_end_msg 1 RET=1 fi ;; reload|force-reload) log_daemon_msg "Reloading $NAME configuration" if start-stop-daemon --stop --signal HUP --exec $DAEMON ; then log_end_msg 0 else log_end_msg 1 RET=1 fi ;; restart-motion) if check_daemon_enabled ; then log_action_begin_msg "Restarting $NAME" if $0 stop && $0 start ; then log_action_end_msg 0 else log_action_cont_msg "(failed)" RET=1 fi fi ;; restart) $0 restart-motion ;; *) echo "Usage: /etc/init.d/$NAME {start|stop|restart|reload}" RET=1 ;; esac exit $RET
SSH login user:
pi
Default password:
raspberry
“/boot/config.txt” settings:
http://raspberrypi.stackexchange.com/tags/config.txt/info
Backup: