diff --git a/SunFounder/SmartVideoCar/README.md b/SunFounder/SmartVideoCar/README.md index 2dbf706..38c2712 100644 --- a/SunFounder/SmartVideoCar/README.md +++ b/SunFounder/SmartVideoCar/README.md @@ -16,6 +16,7 @@ 5. Now you can ping 192.168.1.10 and hopefully you can connect to it (for the debugging purpose) # Setup wireless networks +Run `sudo apt-get install hostapd isc-dhcp-server` Run `sudo nano /etc/hostapd/hostapd.conf` and use the following as an example ``` interface=wlan0 diff --git a/SunFounder/SmartVideoCar/files/etc.default.hostapd.patch b/SunFounder/SmartVideoCar/files/etc.default.hostapd.patch new file mode 100644 index 0000000..45e8401 --- /dev/null +++ b/SunFounder/SmartVideoCar/files/etc.default.hostapd.patch @@ -0,0 +1,11 @@ +--- etc/default/hostapd.orig 2017-11-13 12:12:16.060855052 -0600 ++++ etc/default/hostapd 2017-11-13 12:12:43.106038459 -0600 +@@ -7,7 +7,7 @@ + # 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 + # +-#DAEMON_CONF="" ++DAEMON_CONF="/etc/hostapd/hostapd.conf" + + # Additional daemon options to be appended to hostapd command:- + # -d show more debug messages (-dd for even more) diff --git a/SunFounder/SmartVideoCar/files/etc.default.isc-dhcp-server.patch b/SunFounder/SmartVideoCar/files/etc.default.isc-dhcp-server.patch new file mode 100644 index 0000000..c0b0945 --- /dev/null +++ b/SunFounder/SmartVideoCar/files/etc.default.isc-dhcp-server.patch @@ -0,0 +1,9 @@ +--- etc/default/isc-dhcp-server.orig 2017-11-13 12:14:05.785333905 -0600 ++++ etc/default/isc-dhcp-server 2017-11-13 12:14:21.615655554 -0600 +@@ -14,5 +14,5 @@ + + # On what interfaces should the DHCP server (dhcpd) serve DHCP requests? + # Separate multiple interfaces with spaces, e.g. "eth0 eth1". +-INTERFACESv4="" ++INTERFACESv4="wlan0" + INTERFACESv6="" diff --git a/SunFounder/SmartVideoCar/files/etc.dhcp.dhcpd.conf.patch b/SunFounder/SmartVideoCar/files/etc.dhcp.dhcpd.conf.patch new file mode 100644 index 0000000..e34623e --- /dev/null +++ b/SunFounder/SmartVideoCar/files/etc.dhcp.dhcpd.conf.patch @@ -0,0 +1,25 @@ +--- etc/dhcp/dhcpd.conf.orig 2017-11-13 12:09:52.895262089 -0600 ++++ etc/dhcp/dhcpd.conf 2017-11-13 12:10:21.012527807 -0600 +@@ -18,7 +18,7 @@ + + # If this DHCP server is the official DHCP server for the local + # network, the authoritative directive should be uncommented. +-#authoritative; ++authoritative; + + # Use this to send dhcp log messages to a different log file (you also + # have to hack syslog.conf to complete the redirection). +@@ -105,3 +105,13 @@ + # range 10.0.29.10 10.0.29.230; + # } + #} ++ ++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; ++} diff --git a/SunFounder/SmartVideoCar/files/etc.hostapd.dynamicconf.sh b/SunFounder/SmartVideoCar/files/etc.hostapd.dynamicconf.sh new file mode 100755 index 0000000..e568263 --- /dev/null +++ b/SunFounder/SmartVideoCar/files/etc.hostapd.dynamicconf.sh @@ -0,0 +1,4 @@ +#!/bin/bash + +serial=$(cat /proc/cpuinfo | grep Serial | md5sum | cut -c 1-4) +sed -i "s/^ssid=.*$/ssid=Pi_AP-$serial/" /etc/hostapd/hostapd.conf diff --git a/SunFounder/SmartVideoCar/files/etc.hostapd.hostapd.conf b/SunFounder/SmartVideoCar/files/etc.hostapd.hostapd.conf new file mode 100644 index 0000000..5e6d914 --- /dev/null +++ b/SunFounder/SmartVideoCar/files/etc.hostapd.hostapd.conf @@ -0,0 +1,16 @@ +interface=wlan0 +#driver=nl80211 +ssid=Pi_AP-1c54 +country_code=US +hw_mode=g +channel=11 +macaddr_acl=0 +auth_algs=1 +ignore_broadcast_ssid=0 +wpa=2 +wpa_passphrase=Raspberry +wpa_key_mgmt=WPA-PSK +wpa_pairwise=CCMP +wpa_group_rekey=86400 +ieee80211n=1 +wme_enabled=1 diff --git a/SunFounder/SmartVideoCar/files/etc.init.d.hostapd.patch b/SunFounder/SmartVideoCar/files/etc.init.d.hostapd.patch new file mode 100644 index 0000000..a6aba74 --- /dev/null +++ b/SunFounder/SmartVideoCar/files/etc.init.d.hostapd.patch @@ -0,0 +1,11 @@ +--- etc/init.d/hostapd.orig 2017-11-13 12:16:34.849449204 -0600 ++++ etc/init.d/hostapd 2017-11-13 12:16:53.695431527 -0600 +@@ -25,6 +25,8 @@ + [ -s "$DAEMON_DEFS" ] && . /etc/default/hostapd + [ -n "$DAEMON_CONF" ] || exit 0 + ++/etc/hostapd/dynamicconf.sh ++ + DAEMON_OPTS="-B -P $PIDFILE $DAEMON_OPTS $DAEMON_CONF" + + . /lib/lsb/init-functions diff --git a/SunFounder/SmartVideoCar/files/etc.network.interfaces.d.wlan0.cfg.patch b/SunFounder/SmartVideoCar/files/etc.network.interfaces.d.wlan0.cfg.patch new file mode 100644 index 0000000..d322040 --- /dev/null +++ b/SunFounder/SmartVideoCar/files/etc.network.interfaces.d.wlan0.cfg.patch @@ -0,0 +1,10 @@ +--- etc/network/interfaces.d/wlan0.cfg.orig 2017-11-13 12:19:11.676636013 -0600 ++++ etc/network/interfaces.d/wlan0.cfg 2017-11-13 12:20:35.673604078 -0600 +@@ -1,3 +1,4 @@ +-allow-hotplug wlan0 +-iface wlan0 inet dhcp +-wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf ++auto wlan0 ++iface wlan0 inet static ++ address 192.168.42.1 ++ netmask 255.255.255.0