腳本

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}

HOST_CONFIG=/etc/hostapd/hostapd.conf2
echo "interface=${DEV}" > ${HOST_CONFIG}
echo "driver=nl80211" >> ${HOST_CONFIG}
echo "ssid=test_ap" >> ${HOST_CONFIG}
echo "channel=6" >> ${HOST_CONFIG}
echo "hw_mode=g" >> ${HOST_CONFIG}
echo "ignore_broadcast_ssid=0" >> ${HOST_CONFIG}
echo "auth_algs=1" >> ${HOST_CONFIG}
#wpa=3
#wpa_passphrase=12345678
#wpa_key_mgmt=WPA-PSK
#wpa_pairwise=TKIP
#rsn_pairwise=CCMP

 


hostapd -d ${HOST_CONFIG} > /tmp/hostapd.log &
sleep 1

cat /tmp/hostapd.log | grep ${DEV}

arrow
arrow
    全站熱搜
    創作者介紹
    創作者 立你斯 的頭像
    立你斯

    立你斯學習記錄

    立你斯 發表在 痞客邦 留言(0) 人氣()