emos group 3 組員:郭柏宏 郭建漢 蕭鼎亞 黃雍文 黃博奕. current status networking...

24
EMOS Group 3 組組 組組組 組組組 組組組 組組組 組組組

Upload: andre-smith

Post on 14-Dec-2015

273 views

Category:

Documents


12 download

TRANSCRIPT

Page 1: EMOS Group 3 組員:郭柏宏 郭建漢 蕭鼎亞 黃雍文 黃博奕. Current Status Networking Router User

EMOS Group 3

組員:郭柏宏 郭建漢 蕭鼎亞

黃雍文 黃博奕

Page 2: EMOS Group 3 組員:郭柏宏 郭建漢 蕭鼎亞 黃雍文 黃博奕. Current Status Networking Router User

  Current Status Networking

Router

Router

Router

User

User

User

User

User

User

Page 3: EMOS Group 3 組員:郭柏宏 郭建漢 蕭鼎亞 黃雍文 黃博奕. Current Status Networking Router User

Router

Router

Router

User

User

User

User

User

  Current Status of Crowded Networking

Page 4: EMOS Group 3 組員:郭柏宏 郭建漢 蕭鼎亞 黃雍文 黃博奕. Current Status Networking Router User

• 通訊 Bandwidth 浪費在重覆註冊連線上• 階層化 (Hierarchy) 的網路連線與頻寬分配• Web-Browser 的網路 UI• 頻寬分配之監控

Motivation

Page 5: EMOS Group 3 組員:郭柏宏 郭建漢 蕭鼎亞 黃雍文 黃博奕. Current Status Networking Router User

Concept

Router

Router

Router

User(M)

User

User

User

User

User

User(S)

User(S)

User

User

User

User

User

User

User

Page 6: EMOS Group 3 組員:郭柏宏 郭建漢 蕭鼎亞 黃雍文 黃博奕. Current Status Networking Router User

System BlocksRaspberry Pi

App. & Driver

( 含 Bandwidth monitoring)

Page 7: EMOS Group 3 組員:郭柏宏 郭建漢 蕭鼎亞 黃雍文 黃博奕. Current Status Networking Router User

HOW ?

Page 8: EMOS Group 3 組員:郭柏宏 郭建漢 蕭鼎亞 黃雍文 黃博奕. Current Status Networking Router User

技術與人力分工圖

資本主義之共產網路 Router

用 Raspberry Pi 接通網路

(Man X2)

UI & 頻寬監控

(Man x1)

頻寬分享Driver & 程式

(Man X2)

Page 9: EMOS Group 3 組員:郭柏宏 郭建漢 蕭鼎亞 黃雍文 黃博奕. Current Status Networking Router User

Boot Materials

Page 10: EMOS Group 3 組員:郭柏宏 郭建漢 蕭鼎亞 黃雍文 黃博奕. Current Status Networking Router User

Boot Materials

Page 11: EMOS Group 3 組員:郭柏宏 郭建漢 蕭鼎亞 黃雍文 黃博奕. Current Status Networking Router User

存取硬體資源 Driver- by Python

Page 12: EMOS Group 3 組員:郭柏宏 郭建漢 蕭鼎亞 黃雍文 黃博奕. Current Status Networking Router User

Python

Page 13: EMOS Group 3 組員:郭柏宏 郭建漢 蕭鼎亞 黃雍文 黃博奕. Current Status Networking Router User

Python

Page 14: EMOS Group 3 組員:郭柏宏 郭建漢 蕭鼎亞 黃雍文 黃博奕. Current Status Networking Router User

頻寬分配

Page 15: EMOS Group 3 組員:郭柏宏 郭建漢 蕭鼎亞 黃雍文 黃博奕. Current Status Networking Router User

UI

Page 16: EMOS Group 3 組員:郭柏宏 郭建漢 蕭鼎亞 黃雍文 黃博奕. Current Status Networking Router User

UI

Page 17: EMOS Group 3 組員:郭柏宏 郭建漢 蕭鼎亞 黃雍文 黃博奕. Current Status Networking Router User

UI

Page 18: EMOS Group 3 組員:郭柏宏 郭建漢 蕭鼎亞 黃雍文 黃博奕. Current Status Networking Router User

To monitor the network usage

1. A web server - apache

2. A program language build in Pi - Python

Page 19: EMOS Group 3 組員:郭柏宏 郭建漢 蕭鼎亞 黃雍文 黃博奕. Current Status Networking Router User

web server

GPIO

Common Gateway

interface

To access the hardware resources, we should use GPIO on Pi to get the information. Then we can monitor the usage of wifi and manage the bandwidth which is shared with users.

Page 21: EMOS Group 3 組員:郭柏宏 郭建漢 蕭鼎亞 黃雍文 黃博奕. Current Status Networking Router User

Source Code: Configure the wireless adapter

• auto lo• • iface lo inet loopback• iface eth0 inet dhcp• • allow-hotplug wlan0• iface wlan0 inet manual• address 192.168.0.100• netmask 255.255.255.0• gateway 192.168.0.1• wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf

sudo nano /etc/network/interfaces

Page 22: EMOS Group 3 組員:郭柏宏 郭建漢 蕭鼎亞 黃雍文 黃博奕. Current Status Networking Router User

Source Code: Install and configure a DHCP server

• subnet 192.168.42.0 netmask 255.255.255.0 {• range 192.168.42.10 192.168.42.50;• option broadcast-address 192.168.42.255;• option routers 192.168.42.1;• default-lease-time 600;• max-lease-time 7200;• option domain-name "local";• option domain-name-servers 8.8.8.8, 8.8.4.4;• }

sudo apt-get install isc-dhcp-serversudo nano /etc/dhcp/dhcpd.conf

sudo nano /etc/default/isc-dhcp-serverChange “INTERFACES=""” to “INTERFACES="wlan0"”

sudo service isc-dhcp-server restart

Page 23: EMOS Group 3 組員:郭柏宏 郭建漢 蕭鼎亞 黃雍文 黃博奕. Current Status Networking Router User

Source Code: Install and configure the access point daemon

• interface=wlan0• driver=nl80211• #driver=rtl871xdrv• ssid=MyPi• hw_mode=g• channel=6• macaddr_acl=0• auth_algs=1• ignore_broadcast_ssid=0• wpa=2• wpa_passphrase=raspberry• wpa_key_mgmt=WPA-PSK• wpa_pairwise=TKIP• rsn_pairwise=CCMP

sudo apt-get install hostapdsudo nano /etc/hostapd/hostapd.conf

sudo nano /etc/default/hostapdRemove the “#” in front of “DAEMON_CONF” and alter the line to read:DAEMON_CONF="/etc/hostapd/hostapd.conf"

Page 24: EMOS Group 3 組員:郭柏宏 郭建漢 蕭鼎亞 黃雍文 黃博奕. Current Status Networking Router User

Source Code: Configure IP routing between the wireless and Ethernet (or 2 Wireless Adapters)

sudo nano /etc/sysctl.confFind the line which reads “Uncomment the next line to enable packet forwarding for IPv4” and uncomment the next line like this:# Uncomment the next line to enable packet forwarding for IPv4net.ipv4.ip_forward=1

Run the following command to activate forwarding now:sudo sh -c "echo 1 > /proc/sys/net/ipv4/ip_forward"Now turn the Pi into a router with the follow commands:sudo iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADEsudo iptables -A FORWARD -i eth0 -o wlan0 -m state --state RELATED,ESTABLISHED -j ACCEPTsudo iptables -A FORWARD -i wlan0 -o eth0 -j ACCEPT( 如果要用兩張網卡一收一發 , 就把 eth0 & wlan0 改成 wlan0 & wlan1)And save the routing tables into the file “/etc/iptables.ipv4.nat”sudo sh -c "iptables-save > /etc/iptables.ipv4.nat”

Edit “/etc/network/interfaces“:sudo nano /etc/network/interfaces

And add the following line to the end of the file. This line will restore the routing table whenever the Pi is booted:pre-up iptables-restore < /etc/iptables.ipv4.nat