linux下分享信号个android手机
2013-08-16 00:58
344 查看
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
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
相关文章推荐
- 【android】给大家分享个小功能,关于低版本安卓手机拍照找不到图片的问题
- android手机信号强度
- android双卡手机怎样分别获得两个卡的信号强度
- 分享摩托罗拉milestone手机升级到Android 2.2的过程
- android-获取手机信号强度(2)
- Linux下Android连接手机调试显示???问题的解决方案
- 谈谈国内开发的Linux手机软件平台Broncho,兼谈Android、Openmoko等[转]
- Intel 展示了可在大屏幕显示 Linux 系统的低端 Android 手机
- Android小功能获取手机信息(号码,内存,CPU,分辨率,MAC,IP,SD卡,IMEI,经纬度,信号强度等等)
- 在Linux下adb连接不上android手机的终极解决方案
- android 获取手机GSM/CDMA信号信息
- android手机使用完整的linux命令——busybox的安装和使用
- Android手机信号强度检测详细介绍
- 解决Linux下USB连接android手机
- Linux下真机调试Android手机
- 在Linux下adb连接不上android手机的终极解决方案
- 在Android手机上离线安装kali-linux的简单方法
- linux(ubuntu11.10)下手机真机调试eclipse上的android程序
- Android案例分享__HomePageA__仿'58到家/百度糯米/豆果美食/美团外卖/手机京东'首页
- Android 获取 Wifi 信号强度,检测是 Wifi 或者流量,获取手机电池电量及充电状态