#!/bin/sh ### Network Configure. ### # SSID1 RPi-SSID1 # wpa_passphrase1 YourPassPhrase1 # SSID2 RPi-SSID2 # wpa_passphrase2 YourPassPhrase2 # SSID3 RPi-SSID3 # wpa_passphrase3 YourPassPhrase3 ############################### ## EXEC fstrim. sync /sbin/fstrim / sync ## Create ifcfg-wlan1. cat < /etc/sysconfig/network-scripts/ifcfg-wlan1 # wlan1 DEVICE="wlan1" NAME="wlan1" TYPE="Wireless" MODE="Auto" NM_CONTROLLED="no" BOOTPROTO="none" DEFROUTE="no" ONBOOT="yes" #HWADDR="`cat /sys/class/net/wlan1/address`" UUID="`uuidgen`" EOF ## Create ifcfg-wlan2. cat < /etc/sysconfig/network-scripts/ifcfg-wlan2 # wlan2 DEVICE="wlan2" NAME="wlan2" TYPE="Wireless" MODE="Auto" NM_CONTROLLED="no" BOOTPROTO="none" DEFROUTE="no" ONBOOT="yes" #HWADDR="`cat /sys/class/net/wlan2/address`" UUID="`uuidgen`" EOF ## Restart wlan1, wlan2. ifdown wlan1 ifdown wlan2 ifup wlan1 ifup wlan2 ## Modify hostapd config. cp -piav /etc/hostapd/hostapd.conf /etc/hostapd/hostapd_wlan0.conf cp -piav /etc/hostapd/hostapd.conf /etc/hostapd/hostapd_wlan1.conf cp -piav /etc/hostapd/hostapd.conf /etc/hostapd/hostapd_wlan2.conf cat < /etc/hostapd/hostapd_wlan0.conf # # This will give you a minimal, insecure wireless network. # # DO NOT BE SATISFIED WITH THAT!!! # # A complete, well commented example configuration file is # available here: # # /usr/share/doc/hostapd/hostapd.conf # # For more information, look here: # # http://wireless.kernel.org/en/users/Documentation/hostapd # ctrl_interface=/var/run/hostapd ctrl_interface_group=wheel # Some usable default settings... macaddr_acl=0 auth_algs=1 ignore_broadcast_ssid=0 # Uncomment these for base WPA & WPA2 support with a pre-shared key #wpa=3 #wpa_key_mgmt=WPA-PSK #wpa_pairwise=TKIP #rsn_pairwise=CCMP wpa=2 wpa_key_mgmt=WPA-PSK rsn_pairwise=CCMP # DO NOT FORGET TO SET A WPA PASSPHRASE!! #wpa_passphrase=YourPassPhrase wpa_passphrase=YourPassPhrase1 # Most modern wireless drivers in the kernel need driver=nl80211 driver=nl80211 # Customize these for your local configuration... interface=wlan0 hw_mode=g channel=1 #hw_mode=a #channel=36 ssid=RPi-SSID1 country_code=JP ieee80211d=1 ieee80211n=1 wmm_enabled=1 ht_capab=[SHORT-GI-20][DSSS_CCK-40] logger_syslog=-1 logger_syslog_level=3 EOF cat < /etc/hostapd/hostapd_wlan1.conf # # This will give you a minimal, insecure wireless network. # # DO NOT BE SATISFIED WITH THAT!!! # # A complete, well commented example configuration file is # available here: # # /usr/share/doc/hostapd/hostapd.conf # # For more information, look here: # # http://wireless.kernel.org/en/users/Documentation/hostapd # ctrl_interface=/var/run/hostapd ctrl_interface_group=wheel # Some usable default settings... macaddr_acl=0 auth_algs=1 ignore_broadcast_ssid=0 # Uncomment these for base WPA & WPA2 support with a pre-shared key #wpa=3 #wpa_key_mgmt=WPA-PSK #wpa_pairwise=TKIP #rsn_pairwise=CCMP wpa=2 wpa_key_mgmt=WPA-PSK rsn_pairwise=CCMP # DO NOT FORGET TO SET A WPA PASSPHRASE!! #wpa_passphrase=YourPassPhrase wpa_passphrase=YourPassPhrase2 # Most modern wireless drivers in the kernel need driver=nl80211 driver=nl80211 # Customize these for your local configuration... interface=wlan1 hw_mode=g channel=7 #hw_mode=a #channel=36 ssid=RPi-SSID2 country_code=JP ieee80211d=1 ieee80211n=1 wmm_enabled=1 ht_capab=[SHORT-GI-20][SHORT-GI-40][RX-STBC1] logger_syslog=-1 logger_syslog_level=3 EOF cat < /etc/hostapd/hostapd_wlan2.conf # # This will give you a minimal, insecure wireless network. # # DO NOT BE SATISFIED WITH THAT!!! # # A complete, well commented example configuration file is # available here: # # /usr/share/doc/hostapd/hostapd.conf # # For more information, look here: # # http://wireless.kernel.org/en/users/Documentation/hostapd # ctrl_interface=/var/run/hostapd ctrl_interface_group=wheel # Some usable default settings... macaddr_acl=0 auth_algs=1 ignore_broadcast_ssid=0 # Uncomment these for base WPA & WPA2 support with a pre-shared key #wpa=3 #wpa_key_mgmt=WPA-PSK #wpa_pairwise=TKIP #rsn_pairwise=CCMP wpa=2 wpa_key_mgmt=WPA-PSK rsn_pairwise=CCMP # DO NOT FORGET TO SET A WPA PASSPHRASE!! #wpa_passphrase=YourPassPhrase wpa_passphrase=YourPassPhrase3 # Most modern wireless drivers in the kernel need driver=nl80211 driver=nl80211 # Customize these for your local configuration... interface=wlan2 #hw_mode=g #channel=1 hw_mode=a channel=36 ssid=RPi-SSID3 country_code=JP ieee80211d=1 ieee80211n=1 wmm_enabled=1 ht_capab=[HT40+][SHORT-GI-20][SHORT-GI-40][TX-STBC][RX-STBC12] logger_syslog=-1 logger_syslog_level=3 EOF ## Modify hostapd boot script. sed -i -e '/^ExecStart/c\ExecStart=/usr/sbin/hostapd /etc/hostapd/hostapd_wlan0.conf /etc/hostapd/hostapd_wlan1.conf /etc/hostapd/hostapd_wlan2.conf -P /run/hostapd.pid -B' /usr/lib/systemd/system/hostapd.service systemctl daemon-reload systemctl restart hostapd.service ## Install SoftEther VPN Bridge. cd /usr/local/src/ wget -N http://jp.softether-download.com/files/softether/v4.20-9608-rtm-2016.04.17-tree/Linux/SoftEther_VPN_Bridge/32bit_-_ARM_EABI/softether-vpnbridge-v4.20-9608-rtm-2016.04.17-linux-arm_eabi-32bit.tar.gz tar zxvf softether-vpnbridge-v4.20-9608-rtm-2016.04.17-linux-arm_eabi-32bit.tar.gz mv ./vpnbridge ./softether-vpnbridge-v4.20-9608-rtm-2016.04.17-linux-arm_eabi-32bit cd ./softether-vpnbridge-v4.20-9608-rtm-2016.04.17-linux-arm_eabi-32bit/ make cd /usr/local/ ln -s /usr/local/src/softether-vpnbridge-v4.20-9608-rtm-2016.04.17-linux-arm_eabi-32bit vpnbridge cat < /etc/rc.d/init.d/vpnbridge #!/bin/sh # chkconfig: 2345 99 01 # description: SoftEther VPN Bridge DAEMON=/usr/local/vpnbridge/vpnbridge LOCK=/var/lock/subsys/vpnbridge test -x \$DAEMON || exit 0 case "\$1" in start) \$DAEMON start touch \$LOCK ;; stop) \$DAEMON stop rm \$LOCK ;; restart) \$DAEMON stop sleep 3 \$DAEMON start ;; *) echo "Usage: \$0 {start|stop|restart}" exit 1 esac exit 0 EOF chmod 755 /etc/rc.d/init.d/vpnbridge chkconfig --add vpnbridge chkconfig vpnbridge on service vpnbridge start chkconfig --list vpnbridge