zoukankan      html  css  js  c++  java
  • linux下分享信号个android手机

    1.首先你的电脑在win7下可以分享信号给android手机用
    2. 
     sudo apt-get install hostapd dnsmasq
    3.安装完成后在终端输入:
    sudo service hostapd stop
    sudo service dnsmasq stop
    sudo update-rc.d hostapd disable
    sudo update-rc.d dnsmasq disable


    4.你需要配置文件
     sudo gedit /etc/dnsmasq.conf如果是KDE的话就是sudo gedit /etc/dnsmasq.conf
    # Bind to only one interface
    bind-interfaces
    # Choose interface for binding
    interface=wlan0
    # Specify range of IP addresses for DHCP leasses
    dhcp-range=192.168.150.2,192.168.150.10


    5.然后是hostpad配置文件
    sudo gedit /etc/hostapd.conf


    # Define interface
    interface=wlan0
    # Select driver
    driver=nl80211
    # Set access point name
    ssid=myhotspot
    # Set access point harware mode to 802.11g
    hw_mode=g
    # Set WIFI channel (can be easily changed)
    channel=6
    # Enable WPA2 only (1 for WPA, 2 for WPA2, 3 for WPA + WPA2)
    wpa=2
    wpa_passphrase=mypassword


    这里的mypassword可以自己定义


    6.然后创建快捷启动文件随便在哪里创建start.sh
    输入:
    #!/bin/bash
    # Start
    # Configure IP address for WLAN
    sudo ifconfig wlan0 192.168.150.1
    # Start DHCP/DNS server
    sudo service dnsmasq restart
    # Enable routing
    sudo sysctl net.ipv4.ip_forward=1
    # Enable NAT
    sudo iptables -t nat -A POSTROUTING -o ppp0 -j MASQUERADE
    # Run access point daemon
    sudo hostapd /etc/hostapd.conf
    # Stop
    # Disable NAT
    sudo iptables -D POSTROUTING -t nat -o ppp0 -j MASQUERADE
    # Disable routing
    sudo sysctl net.ipv4.ip_forward=0
    # Disable DHCP/DNS server
    sudo service dnsmasq stop
    sudo service hostapd stop


    然后保存。用root权限运行start.sh
    运行结果大概是:
     * Restarting DNS forwarder and DHCP server dnsmasq                      [ OK ] 
    /etc/resolvconf/update.d/libc: Warning: /etc/resolv.conf is not a symbolic link to /run/resolvconf/resolv.conf
    net.ipv4.ip_forward = 1
    Configuration file: /etc/hostapd.conf
    Failed to update rate sets in kernel module
    Using interface wlan0 with hwaddr 74:de:2b:43:0b:9e and ssid 'myhotspot'
    wlan0: STA 10:68:3f:3d:3c:04 IEEE 802.11: authenticated
    wlan0: STA 10:68:3f:3d:3c:04 IEEE 802.11: associated (aid 1)
    wlan0: AP-STA-CONNECTED 10:68:3f:3d:3c:04
    wlan0: STA 10:68:3f:3d:3c:04 RADIUS: starting accounting session 520D0582-00000000
    wlan0: STA 10:68:3f:3d:3c:04 WPA: pairwise key handshake completed (RSN)
    wlan0: STA 10:68:3f:3d:3c:04 WPA: group key handshake completed (RSN)


    我的运行环境:deepin 12.12.1 64位 + nexus 4  测试成功

    原文地址:http://forum.xda-developers.com/showthread.php?t=2009381

  • 相关阅读:
    Pygal之掷骰子
    pygal之掷骰子 2颗面数为6的骰子
    matplotlib之scatter
    使用Flash Builder 4 beta和FlexUnit进行Test Driven Development
    FlexUnit单元测试(第二章FlexUnit基本应用)
    FlexUnit单元测试(第三章FlexUnit事件断言)
    [Flex]Flex SDK 4(Gumbo)更方便的自定义样式、自定义SparkSkin(二)
    Flex开源项目
    Flex 4 : Chart 控件
    Flex SDK 4(Gumbo)更方便的自定义样式、自定义SparkSkin(三)
  • 原文地址:https://www.cnblogs.com/tqj-zyy/p/4559770.html
Copyright © 2011-2022 走看看