一如之前的一系列我所問的問題,我想使用wifi-tether(bridge)功能
但是從
1.iptables:重編kernelOK,但是insmod wifi module,系統重新開機(bridge與iptables/netfilter相衝)
2.移植bridge-util :編譯錯誤,無法完成brctl
3.移植busybox:移植成功,但是brctl,需要kernel支持的,重編kernelOK,但是insmod wifi module,系統重新開機
(重新編譯kernel,,開啟bridge功能,並把 iptables/netfilter全部關閉)
4.開啟/res/res/values/config.xml,但僅有選單沒有功能:X
5.安裝wifi-tether:但需要iptables的,所以情形又同1.
我目前採用方法1. 確定可以分派IP(用iptables nat方式分享ethernet的訊號給wlan0)
1.重新編譯kernel,把 iptables/netfilter選項開啟
-> Networking support
-> Networking options
-> Network packet filtering framework(Netfilter)
-> Network packet filtering debugging
-> Advaned netfilter configuration
Core Netfilter Configuration
-> Netfilter NFQUEUE over NFNETLINK interface
-> Netfilter connection tracking support
-> Netbios name service protocal support(new)
-> Netfilter Xtables support (required for ip_tables)
-> multiport Multiple port match support
-> owner match support
-> state match support
IP: Netfilter Configuration
-> IPv4 connection tracking support (require for NAT)
-> proc/sysctl compatibility with old connection tracking
-> IP tables support (required for filtering/masq/NAT)
-> Packet filtering
-> REJECT target support
-> Full NAT
-> MASQUERADE target support
-> REDIRECT target support
2.編譯ar6000.ko
3.hostapd及dnsmasq
4.撰寫/data/misc/wifi/hostapd.conf 、 /etc/resolv.conf
/data/misc/wifi/hostapd.conf
interface=wlan0
ctrl_interface=wlan0
ssid=AR6003AP
channel=1
max_num_sta=8
beacon_int=100
dtim_period=1
#hw_mode=g
#bridge=br0
#driver=nl80211
#dtim_period=1
#rts_threshold=2347
#fragm_threshold=2346
#macaddr_acl=0
#auth_algs=3
#ieee80211n=0
#ignore_broadcast_ssid=0
wpa=2
wpa_passphrase=12345678
wpa_key_mgmt=WPA-PSK
wpa_pairwise=TKIP CCMP
/etc/resolv.conf
#nameserver 8.8.8.8
#nameserver 4.4.4.4
nameserver 218.30.19.50
nameserver 61.134.1.5
busybox ifconfig eh0 up //帶起eth0 接口
netcfg eth0 dhcp //獲取dhcp IP
busybox route -n //看路由表
insmod /system/wifi/ar6000.ko //insmod wifi module
busybox ifconfig wlan0 192.168.11.1 up //帶起 wlan0 接口,並直接給靜態IP
/system/bin/hostapd -B /data/misc/wifi/hostapd.conf //啟動hostapd 加密功能
sysctl -w net.ipv4.ip_forward=1 //啟動ip_forward功能
iptables --table nat --flush //清除nat tables
iptables --delete-chain
iptables --table nat --delete-chain
iptables --append FORWARD --in-interface wlan0 -o eth0 -j ACCEPT
iptables --table nat --append POSTROUTING --out-interface eth0 -j MASQUERADE
dnsmasq -z -i wlan0 -F 192.168.11.100,192.168.11.200,12h //啟動dnsmasq功能
圖片是我自己畫的,我是用iptables nat方式分享ethernet的訊號給wlan0)
[ 此帖被kazaya在2011-12-19 18:24重新编辑 ]