安裝相關程式
#apt-get install -y isc-dhcp-server
#apt-get install -y hostapd bridge-utils uml-utilities
腳本!
DEV=$(iw dev | awk '/Interface/ {print $2}')
ifconfig ${DEV} up 10.0.0.1 netmask 255.255.255.0
DHCP_CONF=/etc/dhcp/dhcpd.conf
echo "default-lease-time 1209600;" > ${DHCP_CONF}
echo "max-lease-time 1814400;" >> ${DHCP_CONF}
echo "ddns-update-style none;" >> ${DHCP_CONF}
echo "ignore client-updates;" >> ${DHCP_CONF}
echo "authoritative;" >> ${DHCP_CONF}
echo "option local-wpad code 252 = text;" >> ${DHCP_CONF}
echo "subnet 10.0.0.0 netmask 255.255.255.0 {" >> ${DHCP_CONF}
echo "option routers 10.0.0.1;" >> ${DHCP_CONF}
echo "option subnet-mask 255.255.255.0;" >> ${DHCP_CONF}
echo "option broadcast-address 10.0.0.255;" >> ${DHCP_CONF}
echo "option domain-name-servers 10.0.0.1, 8.8.8.8, 8.8.4.4;" >> ${DHCP_CONF}
echo "option time-offset 0;" >> ${DHCP_CONF}
echo "range 10.0.0.3 10.0.0.13;" >> ${DHCP_CONF}
echo "}" >> ${DHCP_CONF}
dhcpd ${DEV}
ifconfig
HOST_CONFIG=/etc/hostapd/hostapd.conf5
echo "interface=${DEV}" > ${HOST_CONFIG}
echo "ssid=test_ap_5g" >> ${HOST_CONFIG}
echo "auth_algs=1 # 1=wpa, 2=wep, 3=both" >> ${HOST_CONFIG}
echo "wmm_enabled=1" >> ${HOST_CONFIG}
echo "ieee80211d=1" >> ${HOST_CONFIG}
#echo "vht_capab=[MAX-MPDU-11454][RXLDPC][SHORT-GI-160][VHT160-80PLUS80][SHORT-GI-80][TX-STBC-2BY1][RX-STBC-1][MAX-A-MPDU-LEN-EXP7][RX-ANTENNA-PATTERN][TX-ANTENNA-PATTERN][SU-BEAMFORMER][SU-BEAMFORMEE][MU-BEAMFORMER][MU-BEAMFORMEE][BF-ANTENNA-4][SOUNDING-DIMENSION-4]" >> ${HOST_CONFIG}
echo "vht_capab=[MAX-MPDU-11454][SHORT-GI-40][RXLDPC][TX-STBC-2BY1][RX-STBC-1]" >> ${HOST_CONFIG}
echo "rsn_pairwise=CCMP" >> ${HOST_CONFIG}
echo "ieee80211n=1" >> ${HOST_CONFIG}
echo "vht_oper_chwidth=1" >> ${HOST_CONFIG}
echo "driver=nl80211" >> ${HOST_CONFIG}
echo "wpa_key_mgmt=WPA-PSK" >> ${HOST_CONFIG}
echo "ieee80211ac=1" >> ${HOST_CONFIG}
echo "ht_capab=[HT40+][SHORT-GI-20][SHORT-GI-40][RX-STBC1][DSSS_CCK-40][MAX-AMSDU-3839]" >> ${HOST_CONFIG}
echo "hw_mode=a" >> ${HOST_CONFIG}
echo "country_code=TW" >> ${HOST_CONFIG}
echo "uapsd_advertisement_enabled=1" >> ${HOST_CONFIG}
echo "preamble=1" >> ${HOST_CONFIG}
echo "channel=0" >> ${HOST_CONFIG}
#wpa=2 # WPA2 only
#wpa_key_mgmt=WPA-PSK
#rsn_pairwise=CCMP
#wpa_passphrase=12345678
hostapd -d ${HOST_CONFIG} > /tmp/hostapd.log &
service isc-dhcp-server restart
留言列表