2014年9月24日 星期三

將Intel Galileo當成WiFi AP使用

1. Galileo已經有包含WiFi driver
    看meta-clanton/meta-clanton-distro/recipes-kernel/linx-firmware/linux-firmware_git.bbappend

2. 在meta-clanton/meta-clanton-distro/recipes-core/images/image-full.bb
    增加hostap-daemon(AP mode)及dhcp-server(DHCP Server)支援

3. 增加iptable
    使用bitbake linux-yocto-clanton -c menuconfig
    選擇
    Networking support --->
         Networking options --->
              Network packet filtering framework (Netfilter) --->
                   Core Netfilter Configuration ---> *
                   IP: Netfilter Configuration ---> *

4. 修改/etc/network/interfaces
    # Wireless interface
    auto wlan0
    iface wlan0 inet static
    address 192.168.1.254

    netmask 255.255.255.0

5. 修改/etc/dhcp/dhcp.conf
    subnet 192,168.1.0 netmask 255.255.255.0{
    range 192.168.1.21 192.168.1.100;

    option routers 192.168.1.254;
    option broadcast-address 192.168.1.255;

    option domain-name-servers 8.8.8.8;
    }

6. 修改/etc/default/dhcp-server
    INTERFACE="wlan0"

7. 修改/etc/hostapd.conf
    interface=wlan0

8. 執行/etc/init.d/networking restart

9. 設定routing
    可先執行iptables -t nat -L看是否可正確執行
    iptables --flush
    iptables --table nat --flush
    iptables --delete-chain
    iptables --table nat --delete-chain
    iptables --table nat --append POSTROUTING --out-interface eth0
    -j MASQUERADE

    iptables --append FORWARD --in-interface wlan0 -j ACCEPT
    echo 1 > /proc/sys/net/ipv4/ip_forward
 

10. 執行/etc/init.d/dhcp-server restart

11. 執行hostapd -d /etc/hostapd.conf &

P.S.
如遇到SSID沒有出現的問題,要確認一下是否wlan0已連至其他AP Router

P.S.
遇到iptables: can't initialize iptables table `nat': Table does not exist
(do you need to insmod?)
問題
iptables: can't initialize iptables table `filter': Table does not exist
(do you need to insmod?)
問題

這是因為CONFIG_NF_NAT或是CONFIG_NF_NAT_IPV4並未添加
IP: Netfilter ConfigurationCore Netfilter Configuration設定不對

沒有留言:

張貼留言