adhoc 如何使用?

atyu30 发布于 2012/10/05 15:56
阅读 1K+
收藏 0

运行环境

CentOS 6.3 X86-64 Thinkpad 

 

[root@ns158 ~]#  adhoc interface wlan0 essid openbsd key 1234567890123 start

             Wifi Ad-hoc Control

 

Usage:

    /usr/local/bin/adhoc interface [essid X] [key K] [start|stop|restart]

 

Description:

    essid    The name of your network, default "WiFi-Network".

    key      The encryption key of your network,

             you can use any ASCII string(only 13 characters),

             if not set, your network will be non-encrypted.

    start    Start creating Wifi Ad-hoc Network.

    stop     Stop Wifi Ad-hoc Network.

    restart  Restart creating Wifi Ad-hoc Network.

[root@ns158 ~]#  adhoc interface wlan0 essid openbsd key 1234567890123 start^C

[root@ns158 ~]# adhoc start

Starting Ad-hoc...

/etc/adhoc/dnsmasq.conf is not exist, now building.

Setting start gateway[192.168.2.254] and netmask[255.255.255.0]...    [ FAILED ]

Setting down start...    [ FAILED ]

Setting start mode[ad-hoc]...    [ FAILED ]

Setting start essid[WiFi-Network]...    [ FAILED ]

Setting start cannel[auto]...    [ FAILED ]

Setting start key type[off]...    [ WARNING, non-encrypted network ]

Setting up start...    [ FAILED ]

Setting iptable...iptables: Chain already exists.

    [ GOOD ]

Completed!^^


加载中
0
晕dows
晕dows
adhoc wlan0 essid openbsd key 1234567890123 start

试试这个

0
a
atyu30
[root@ns158 ~]# adhoc wlan0 essid openbsd key 1234567890123 start
             Wifi Ad-hoc Control

Usage:
    /usr/local/bin/adhoc interface [essid X] [key K] [start|stop|restart]

Description:
    essid    The name of your network, default "openbsd".
    key      The encryption key of your network,
             you can use any ASCII string(only 13 characters),
             if not set, your network will be non-encrypted.
    start    Start creating Wifi Ad-hoc Network.
    stop     Stop Wifi Ad-hoc Network.
    restart  Restart creating Wifi Ad-hoc Network.

crazydan
crazydan
这个是在对start参数的处理上出现了bug,现在已经修复,你可以下载最新的代码试试
0
a
atyu30
# ifconfig
eth0      Link encap:Ethernet  HWaddr F2:3E:F1:6C:5C:6F  
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:0 (0.0 b)  TX bytes:0 (0.0 b)
          Interrupt:20 Memory:f2600000-f2620000 

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:16436  Metric:1
          RX packets:7137 errors:0 dropped:0 overruns:0 frame:0
          TX packets:7137 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:820384 (801.1 KiB)  TX bytes:820384 (801.1 KiB)

vboxnet0  Link encap:Ethernet  HWaddr 0A:00:27:00:00:00  
          inet addr:172.16.110.1  Bcast:172.16.110.255  Mask:255.255.255.0
          inet6 addr: fe80::800:27ff:fe00:0/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:43 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:0 (0.0 b)  TX bytes:5285 (5.1 KiB)

wlan0     Link encap:Ethernet  HWaddr A0:88:B4:75:C5:10  
          inet addr:192.168.1.100  Bcast:192.168.1.255  Mask:255.255.255.0
          inet6 addr: fe80::a288:b4ff:fe75:c510/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:115436 errors:0 dropped:0 overruns:0 frame:0
          TX packets:99676 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:87307054 (83.2 MiB)  TX bytes:13977250 (13.3 MiB)

0
a
atyu30
flytreeleft-adhoc-f14089b.zip


[root@ns158 toool]# adhoc wlan0 essid openbsd key 1234567890123 start
Starting Ad-hoc...
DHCP server is running!
Now, restart Ad-hoc
Stopping adhoc ...
......
Wifi ad-hoc now stopped
Setting wlan0 gateway[192.168.2.254] and netmask[255.255.255.0]...    [ GOOD ]
Setting down wlan0...    [ GOOD ]
Setting wlan0 mode[ad-hoc]...    [ GOOD ]
Setting wlan0 essid[openbsd]...    [ GOOD ]
Setting wlan0 channel[auto]...    [ GOOD ]
Setting wlan0 password[1234567890123]...    [ GOOD ]
Setting wlan0 key type[restricted]...    [ GOOD ]
Setting up wlan0...    [ GOOD ]
Setting iptable:
    remove old rules...    [ GOOD ]
    bring up NAT rules...    [ GOOD ]
Starting DNS and DHCP server...    [ GOOD ]
Completed!^^
[root@ns158 toool]# ifconfig
eth0      Link encap:Ethernet  HWaddr F2:3E:F1:6C:5C:6F   
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:0 (0.0 b)  TX bytes:0 (0.0 b)
          Interrupt:20 Memory:f2600000-f2620000 

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:16436  Metric:1
          RX packets:5331 errors:0 dropped:0 overruns:0 frame:0
          TX packets:5331 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:615463 (601.0 KiB)  TX bytes:615463 (601.0 KiB)

vboxnet0  Link encap:Ethernet  HWaddr 0A:00:27:00:00:00  
          inet addr:172.16.110.1  Bcast:172.16.110.255  Mask:255.255.255.0
          inet6 addr: fe80::800:27ff:fe00:0/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:45 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:0 (0.0 b)  TX bytes:5489 (5.3 KiB)

wlan0     Link encap:Ethernet  HWaddr A0:88:B4:75:C5:10  
          inet addr:192.168.2.254  Bcast:192.168.2.255  Mask:255.255.255.0
          inet6 addr: fe80::a288:b4ff:fe75:c510/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:102140 errors:0 dropped:0 overruns:0 frame:0
          TX packets:78763 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:91931755 (87.6 MiB)  TX bytes:10262783 (9.7 MiB)

[root@ns158 toool]# ping www.baidu.com
ping: unknown host www.baidu.com
[root@ns158 toool]# 
[root@ns158 toool]# adhoc stop
Starting Ad-hoc...
DHCP server is running!
Now, restart Ad-hoc
Stopping adhoc ...
.stop: unknown interface: 没有那个设备
.Error for wireless request "Set Mode" (8B06) :
    SET failed on device stop ; No such device.
.Error for wireless request "Set Encode" (8B2A) :
    SET failed on device stop ; No such device.
.Error for wireless request "Set ESSID" (8B1A) :
    SET failed on device stop ; No such device.
..
Wifi ad-hoc now stopped
Setting stop gateway[192.168.2.254] and netmask[255.255.255.0]...    [ GOOD ]
Setting down stop...    [ GOOD ]
Setting stop mode[ad-hoc]...    [ GOOD ]
Setting stop essid[WiFi-Network]...    [ GOOD ]
Setting stop channel[auto]...    [ GOOD ]
Setting stop key type[off]...    [ GOOD ]
    [ WARNING, non-encrypted network ]
Setting up stop...    [ GOOD ]
Setting iptable:
    remove old rules...    [ GOOD ]
    bring up NAT rules...    [ GOOD ]
Starting DNS and DHCP server...    [ GOOD ]
Completed!^^

crazydan
crazydan
最新代码已增加对无线设备名称的判断,在所设置设备名称无效时,将列出系统可用的无线设备名称. 你可以下载最新代码 :-)
0
a
atyu30
楼主有测试通过吗?
crazydan
crazydan
其次,停止热点时,仍然需要指定说要停止的设备接口名称,你这里应该是 adhoc wlan0 stop. 当然,我这里还没有对接口是否存在进行判断,在后面的修改中将会涉及到. 最后,还是希望你能继续支持adhoc,有什么不足之处还望多多指出 :-)
crazydan
crazydan
首先,我要说明的是adhoc是将无线设备设置为无线热点,这样其他设备可以通过该无线设备连接上网,但是你的系统是不能再通过该无线设备上网的,必须通过以太网口上网. 也就是说,你的pc必须保证以太网口连接上了Internet,然后,将无线设备设置为热点,其他如手机等才能通过该热点上网. 不是你这么弄的 !-_-!
0
沉默的大绵羊
沉默的大绵羊
手机搜索不到信号
返回顶部
顶部