我想在两个lop上运行一个ad hoc无线网络,这两个lop都有Linux操作系统。我用它来创建自组织网络(我已经在它之前停止了网络管理器)
sudo ifconfig wlan0 down
sudo iwconfig wlan0 mode ad-hoc essid test-adhoc channel 3
sudo ifconfig wlan0 up
sudo ifconfig wlan0 192.168.1.1 netmask 255.255.255.0
我的ifconfig:
ifconfig
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:65536 Metric:1
RX packets:25388 errors:0 dropped:0 overruns:0 frame:0
TX packets:25388 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:3916018 (3.9 MB) TX bytes:3916018 (3.9 MB)
vmnet1 Link encap:Ethernet HWaddr 00:50:56:c0:00:01
inet addr:192.168.237.1 Bcast:192.168.237.255 Mask:255.255.255.0
inet6 addr: fe80::250:56ff:fec0:1/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:505 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
vmnet8 Link encap:Ethernet HWaddr 00:50:56:c0:00:08
inet addr:172.16.62.1 Bcast:172.16.62.255 Mask:255.255.255.0
inet6 addr: fe80::250:56ff:fec0:8/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:504 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
wlan0 Link encap:Ethernet HWaddr ac:72:89:1b:19:76
inet addr:192.168.1.1 Bcast:192.168.1.255 Mask:255.255.255.0
inet6 addr: fe80::ae72:89ff:fe1b:1976/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:1543085 errors:0 dropped:27 overruns:0 frame:0
TX packets:19353 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:183406489 (183.4 MB) TX bytes:3741745 (3.7 MB)
和iwconfig
vmnet8 no wireless extensions.
eth0 no wireless extensions.
lo no wireless extensions.
wlan0 IEEE 802.11bgn ESSID:"test-adhoc"
Mode:Ad-Hoc Frequency:2.422 GHz Cell: A2:A3:E3:9B:6A:FA
Tx-Power=15 dBm
Retry long limit:7 RTS thr:off Fragment thr:off
Power Management:off
vmnet1 no wireless extensions.
第一个Lop top的IP值,第二个Lop top的IP值。我查过路线:
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
172.16.62.0 * 255.255.255.0 U 0 0 0 vmnet8
192.168.1.0 * 255.255.255.0 U 0 0 0 wlan0
192.168.237.0 * 255.255.255.0 U 0 0 0 vmnet1
但当我一个接一个地打电话时:
ping 192.168.1.2
PING 192.168.1.2 (192.168.1.2) 56(84) bytes of data.
From 192.168.1.1 icmp_seq=1 Destination Host Unreachable
From 192.168.1.1 icmp_seq=2 Destination Host Unreachable
From 192.168.1.1 icmp_seq=3 Destination Host Unreachable
From 192.168.1.1 icmp_seq=4 Destination Host Unreachable
From 192.168.1.1 icmp_seq=5 Destination Host Unreachable
From 192.168.1.1 icmp_seq=6 Destination Host Unreachable
我该怎么办?我的系统是Ubuntu 14.04。
最佳答案
我只是改变我的方法。在这种情况下,第二种方法不起作用。
在第一种方法中,不要使用“auto wlan0”。(如果你这样做了,你可能会连接到另一个网络)