我的路由器坏了,所以我试图临时设置一些东西,以便通过自组织网络从我的主计算机(互联网直接来自与以太网卡直接相连的调制解调器)共享互联网连接到其他设备,因为我有一个使用zd1211rw的wifi适配器驱动程序(我也有alfa rtl8187,但是该适配器在ubuntu 12.04上根本无法工作)。
我遇到的问题是我无法连接到我创建的wifi AP,它只是停留在“获取网络地址”,而从未完成连接。
我的主要计算机操作系统是Ubuntu 12.04,这就是我正在做的事情。首先,我使用以下命令将wifi适配器置于监视模式:
airmon-ng start wlan2
这将创建一个mon0接口,然后使用:
airbase-ng -e MyNetName -c 11 -v mon0
从这里我已经可以使用笔记本电脑(带有Windows)看到MyNetName网络,但是如果我尝试连接,它将停留在“获取网络地址”。我遵循的教程将继续执行以下命令:
ifconfig at0 up
ifconfig at0 192.168.1.254 netmask 255.255.255.0
route add -net 192.168.1.0 netmask 255.255.255.0 gw 192.168.1.254
iptables --flush
iptables --table nat --flush
iptables --delete-chain
iptables --table nat --delete-chain
iptables -P FORWARD ACCEPT
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
echo > '/var/lib/dhcp/dhcpd.leases'
然后我用启动dhcp服务器
dhcpd -d -f -cf /etc/dhcp/dhcpd.conf at0
dhcpd.conf文件如下所示:
ddns-update-style interim; <- also tried ad-hoc instead of interim
default-lease-time 600;
max-lease-time 7200;
authoritative;
subnet 192.168.1.0 netmask 255.255.255.0 {
option subnet-mask 255.255.255.0;
option broadcast-address 198.168.1.255;
option routers 192.168.1.254;
option domain-name-servers 8.8.8.8;
range 192.168.1.1 192.168.1.253;
}
输出如下:
Internet Systems Consortium DHCP Server 4.1-ESV-R4
Copyright 2004-2011 Internet Systems Consortium.
All rights reserved.
For info, please visit https://www.isc.org/software/dhcp/
Not searching LDAP since ldap-server, ldap-port and ldap-base-dn were not specified in the config file
Wrote 0 leases to leases file.
Listening on LPF/at0/00:02:72:69:28:c8/192.168.2.128/25
Sending on LPF/at0/00:02:72:69:28:c8/192.168.2.128/25
Sending on Socket/fallback/fallback-net
Can't create PID file /var/run/dhcpd.pid: Permission denied.
最后一条命令:
echo "1" > /proc/sys/net/ipv4/ip_forward
airbase-ng命令输出如下所示:
11:34:03 Created tap interface at0
11:34:03 Trying to set MTU on at0 to 1500
11:34:03 Trying to set MTU on mon0 to 1800
11:34:03 Access Point with BSSID 00:02:72:69:28:C8 started.
11:34:10 Client 70:F3:95:B3:27:76 associated (unencrypted) to ESSID: "MyNetName"
11:34:13 Client 70:F3:95:B3:27:76 reassociated (unencrypted) to ESSID: "MyNetName"
11:34:17 Client 70:F3:95:B3:27:76 reassociated (unencrypted) to ESSID: "MyNetName"
11:34:21 Client 70:F3:95:B3:27:76 reassociated (unencrypted) to ESSID: "MyNetName"
所以我的问题是,我无法在尝试连接的笔记本电脑上获取内部ip,Windows wifi管理器仅停留在“获取网络地址”,空军基地在笔记本电脑尝试连接时通过显示更多这些重新关联的消息做出反应。另一个问题是,在iptables --flush
主PC上运行Internet 后,Internet会停止工作,但是一旦我能够完全连接到MyNetName,我想解决该问题。
有人知道我在做什么错吗?