Raspberry Pi as a Wireless Router

  • Published on
    30-Aug-2014

  • View
    22.311

  • Download
    8

DESCRIPTION

 

Transcript

<ul><li> Raspberry Pi - Oct 28, 2013/Raspberry Pi #1 </li> <li> Raspberry Pi - Raspberry Pi - GPIO </li> <li> Raspberry Pi ? http://www.flickr.com/photos/fotero/7697063016/ </li> <li> Raspberry Pi (Model B) SoC Broadcom BCM2835 CPU: ARM11 family, 700 MHz GPU: Broadcom VideoCore IV, OpenGL ES 2.0, 1080p30 H.264/MPEG-4 AVC decoder Memory: 512 Mb SDRAM Video outputs: Composite, HDMI Audio outputs: 3.5 mm jack, HDMI Onboard storage: SD, MMC, SDIO card slot Onboard 10/100 Ethernet RJ45 </li> <li> + OS http://www.raspberrypi-tutorials.co.uk/starting-up-your-raspberry-pi-device/set-raspberry-pi/ </li> <li> Raspberry Pi ? </li> <li> Raspberry Pi ? </li> <li> Raspberry Pi </li> <li> Raspberry Pi - </li> <li> - wikipedia : + Linux+Driver+ </li> <li> &amp; &amp; </li> <li> (wireless) + (router) </li> <li> http://www.techiestate.com/how-to-set-up-a-wireless-router/ </li> <li> http://www.techiestate.com/how-to-set-up-a-wireless-router/ </li> <li> = / </li> <li> 3. 2. / 1. 5. 4. http://www.techiestate.com/how-to-set-up-a-wireless-router/ </li> <li> 3. 2. / 1. 5. + 4. http://www.techiestate.com/how-to-set-up-a-wireless-router/ </li> <li> &amp; </li> <li> / DHCP/Wireless Access Point CGI Python </li> <li> 1 - </li> <li> x86, ARM, MIPS, PowerPC ? ? ? 80386 PS2 Power Macintoshes ARM ARMv1, ARMv2..., ARMv8 ARM v6: Raspberry Pi Broadcom BCM2835 </li> <li> Porting( ) ( ) addressing space little endian/big endian alignment ( ) </li> <li> Toolchain + library Compiler Linker Assembler Debugger Libraries ... http://www.aboutdebian.com/compile.htm </li> <li> Cross Compile Ex: x86 ARM gcc foo.c -o foo arm-linux-gnueabi-gcc foo.c -o foo </li> <li> autotools ./configure --build --host --target --host: the architecture that you want the file to run on --build: the architecture of the build machine --target: the machine that GCC will produce code for build , host target Ex: ./configure --build=i686-pc-linux-gnu --host=arm-linux --target=mips-linux </li> <li> cross-compiling Raspberry Pi toolchain https://github.com/raspberrypi/tools arm-bcm2708-linux-gnueabi arm-bcm2708hardfp-linux-gnueabi gcc-linaro-arm-linux-gnueabihf-raspbian( ) echo 'export PATH=$PATH:/path/to/toolchain' &gt;&gt; ~/.bashrc </li> <li> 2 - </li> <li> iptables &amp; ip forwarding </li> <li> iptables </li> <li> Linux netfilter( ) iptables( ) </li> <li> http://linux.vbird.org/linux_server/0250simple_firewall.php </li> <li> iptables http://linux.vbird.org/linux_server/0250simple_firewall.php </li> <li> NAT Table NAT = Network Address Translation IP port POSTROUTING SNAT/MASQUERADE </li> <li> iptables -A INPUT -i wlan0 -j ACCEPT iptables -t nat -A POSTROUTING -s 192.168.77.0/24 -o eth0 -j MASQUERADE sysctl net.ipv4.ip_forward=1 </li> <li> iptables &amp; ip forwarding AP mode </li> <li> Station (STA) infrastructure mode AccessPoint (AP) infrastructure mode Monitor (MON) mode Ad-Hoc (IBSS) mode Wireless Distribution System (WDS) mode Mesh http://wireless.kernel.org/en/users/Documentation/modes </li> <li> AP AP(Master) mode Ralink rt2400 / rt2500 Broadcom 43xx Realtek RTL8180 Texas Instruments ACX100/ACX111 Intel PRO/Wireless (ipwXXXX) series ZyDAS ZD1211 ... https://help.ubuntu.com/community/WifiDocs/MasterMode </li> <li> hostapd User space daemon for access point Support IEEE 802.1X/WPA/WPA2/EAP + http://www.netzmafia.de/skripten/unix/linux-daemon-howto.html </li> <li> Cross Compile hostapd hostapd(RTL8188CUS) configure CC=arm-linux-gnueabihf-gcc ./configure --host=armlinux --prefix=/path/to/install make &amp;&amp; make install http://bit.ly/t0HWH1 </li> <li> iptables &amp; ip forwarding AP mode dhcp daemon </li> <li> DHCP Daemon IP, isc-dhcp-server http://linux.vbird.org/linux_server/0340dhcp.php </li> <li> Cross Compile dhcpd dhcpd configure wget ftp://ftp.isc.org/isc/dhcp/4.1-ESV-R8/dhcp-4.1-ESV-R8.tar.gz CC=arm-linux-gnueabihf-gcc ./configure --host=arm-linux --prefix=/path/to/install make &amp;&amp; make install </li> <li> iptables &amp; ip forwarding AP mode dhcp daemon </li> <li> 3 UI </li> <li> App ? Application GUI-ToolKit Framebuffer Hardware </li> <li> Native App vs. Browser Based App /dev/fb driver SoC </li> <li> Native App 1. toolkit ap 2. 3. IPC /dev/fb driver SoC </li> <li> Browser Based App 1. HTML5 CSS3 2. 3. plugin /dev/fb driver SoC </li> <li> Browser based = web server + </li> <li> 80/8080 port HTTP CGI module Apache, Nginx, Boa http://www.resultantsys.com/index.php/general/what-is-a-web-application-server/ </li> <li> Boa Web Server (~2005) , 25 C 6899 access control(authentication) chroot SSL GPLv2 License </li> <li> Cross Compile Boa boa configure wget http://www.boa.org/boa-0.94.13.tar.gz CC=arm-linux-gnueabihf-gcc ./configure --host=armlinux make &amp;&amp; make install </li> <li> web server </li> <li> Python Raspberry Pi Script web server CGI , </li> <li> CGI CGI = Common Gateway Interface web server C, Perl, Python, PHP... / Python CGI </li> <li> 4 - </li> <li> Python (GPIO) shell command AJAX </li> <li> General Purpose Input Output(GPIO) A generic pin on an IC http://raspberrypihobbyist.blogspot.tw/2012/09/so-many-inputs-so-few-gpio-pins.html </li> <li> Raspberry Pi GPIO SPI / I2C / UART / PWM http://elinux.org/RPi_Low-level_peripherals </li> <li> Python Code Flow Import module Define pin numbering Setup up a channel Input/Output Cleanup </li> <li> Python Code Example green = 26 , red = 24 # Define pin numbering try: import RPi.GPIO as GPIO # Import module except RuntimeError: print ("import RPi.GPIO error!!") GPIO.setmode(GPIO.BOARD) # Setup up a channel cmd = "sudo sysctl net.ipv4.ip_forward=1" result = commands.getstatusoutput(cmd) GPIO.output(green, GPIO.HIGH) # Input/Output GPIO.output(red, GPIO.LOW) # # Input/Output </li> <li> DEMO </li> <li> iptables ( ) hostapd( ) isc-dhcp-server( ) UI Boa( ) Python( ) , Python (GPIO) </li> <li> Raspberry Pi Rocks the World Thanks </li> </ul>

Recommended

View more >