echo "1" > /proc/sys/net/ipv4/ip_forward
hostapd -B /etc/hostapd/hostapd.conf
改
/etc/dhcp/dhcpd.conf:
subnet 192.168.0.0 netmask 255.255.255.0
{
range 192.168.0.2 192.168.0.10;
option routers 192.168.0.1;
}
wlan0配置地址:
ifconfig wlan0 192.168.0.1 netmask 255.255.255.0
开启dhcp:
dhcpd wlan0 -pf /var/run/dhcp-server/dhcpd.pid
现在无线网卡就可以当成ap了。
还需要修改
/etc/dhcp/dhcpd.conf,添加dns:
subnet 192.168.0.0 netmask 255.255.255.0
{
range 192.168.0.2 192.168.0.10;
option domain-name-servers 221.5.88.88;
option routers 192.168.0.1;
}
(Linux系统缺省并没有打开IP转发功能,要确认IP转发功能的状态,可以查看/proc文件系统,使用下面命令: cat /proc/sys/net/ipv4/ip_forward