如何将raspberrypi连接到Ad-Hoc

时间:2014-01-02 00:20:31

标签: debian raspberry-pi adhoc

我正在尝试让RaspberryPi(运行Raspbian)加入由运行Debian 7的无线网卡的台式计算机托管的Ad-Hoc网络(无密码)。我能够连接到Ad-Hoc网络运行Windows 7的笔记本电脑成功获得了IP 10.42.0.69,但是,我从RaspberryPi连接的所有尝试都失败了。

RaspberryPi正在使用Edimax Wifi USB,我已尝试在/ etc / network / interfaces中使用以下设置为Ad-Hoc网络请求静态IP:

auto wlan0
iface wlan0 inet static
    address 10.42.0.2
    netmask 255.255.255.0
    wireless-channel 1
    wireless-mode ad-hoc
    wireless-essid TESTING

我在桌面上配置wifi网络所做的就是在面板的网络管理器中使用“创建新的无线网络”。下面是Debian 7桌面上ifconfig的输出:

wlan0     
    Link encap:Ethernet  HWaddr 00:11:50:d5:d6:61  
    inet addr:10.42.0.1  Bcast:10.42.0.255  Mask:255.255.255.0
    inet6 addr: fe80::211:50ff:fed5:d661/64 Scope:Link
    UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
    RX packets:5347 errors:0 dropped:0 overruns:0 frame:0
    TX packets:8698 errors:0 dropped:0 overruns:0 carrier:0
    collisions:0 txqueuelen:1000 
    RX bytes:884808 (864.0 KiB)  TX bytes:4728097 (4.5 MiB)

这是iwconfig:

wlan0 
    IEEE 802.11bg  ESSID:"TESTING"  
    Mode:Ad-Hoc  Frequency:2.412 GHz  Cell: C6:D7:1D:CB:74:CD   
    Tx-Power=20 dBm   
    Retry  long limit:7   RTS thr:off   Fragment thr:off
    Encryption key:off
    Power Management:off

RPi上的/ etc / network / interfaces需要什么才能连接?

1 个答案:

答案 0 :(得分:0)

解决方案:此问题的解决方案是定义网关和密钥:

    final JScrollPane p = new JScrollPane();
    p.setViewportView(table);
    p.getVerticalScrollBar().addAdjustmentListener(new AdjustmentListener(){ 
        @Override
        public void adjustmentValueChanged(AdjustmentEvent e) {
            // here the control if vertical scroll bar has reached the maximum value
            if(!e.getValueIsAdjusting()){
                JScrollBar source = (JScrollBar) e.getAdjustable();
                int extent = source.getModel().getExtent();
                int maximum = source.getModel().getMaximum();
                if(e.getValue() + extent == maximum){
                    retrieveData();
                }
            }

        }
    });

然后安装isc-dhcp-server。然后,使用dhcpd.conf的配置,您可以选择一个简单的网络域,如下所示:

gateway as 10.41.0.1
wireless-key 01234567890

现在重启设备,将正确加载/ etc / network / interfaces,并提供网络服务。