[亲测]deepin分享wifi给android手机使用
Tofloor
poster avatar
qq200600
deepin
2013-08-16 09:07
Author
1.首先你的电脑在win7下可以分享信号给android手机用
2.
  1. sudo apt-get install hostapd dnsmasq
Copy the Code
3.安装完成后在终端输入:
  1. sudo service hostapd stop
  2. sudo service dnsmasq stop
  3. sudo update-rc.d hostapd disable
  4. sudo update-rc.d dnsmasq disable
Copy the Code


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


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

  1. # Define interface
  2. interface=wlan0
  3. # Select driver
  4. driver=nl80211
  5. # Set access point name
  6. ssid=myhotspot
  7. # Set access point harware mode to 802.11g
  8. hw_mode=g
  9. # Set WIFI channel (can be easily changed)
  10. channel=6
  11. # Enable WPA2 only (1 for WPA, 2 for WPA2, 3 for WPA + WPA2)
  12. wpa=2
  13. wpa_passphrase=mypassword
Copy the Code


这里的mypassword可以自己定义


6.然后创建快捷启动文件随便在哪里创建start.sh
输入:
  1. #!/bin/bash
  2. # Start
  3. # Configure IP address for WLAN
  4. sudo ifconfig wlan0 192.168.150.1
  5. # Start DHCP/DNS server
  6. sudo service dnsmasq restart
  7. # Enable routing
  8. sudo sysctl net.ipv4.ip_forward=1
  9. # Enable NAT
  10. sudo iptables -t nat -A POSTROUTING -o ppp0 -j MASQUERADE
  11. # Run access point daemon
  12. sudo hostapd /etc/hostapd.conf
  13. # Stop
  14. # Disable NAT
  15. sudo iptables -D POSTROUTING -t nat -o ppp0 -j MASQUERADE
  16. # Disable routing
  17. sudo sysctl net.ipv4.ip_forward=0
  18. # Disable DHCP/DNS server
  19. sudo service dnsmasq stop
  20. sudo service hostapd stop
Copy the Code


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

我的运行环境:deepin 12.12.1 64位 + nexus 4  测试成功
转载地址:http://blog.csdn.net/qq634416025/article/details/9993727
Reply Favorite View the author
All Replies
vipsks
deepin
2013-08-16 15:47
#1
可我本本前几天就把win7给格了,只留linux deepin.

不然我也想测试下,运行环境是deepin 12.12.1   32位

不敢乱折腾呀.

到了:6.然后创建快捷启动文件随便在哪里创建start.sh

这一步不会呀,如何创建?我新建成文本文件,把内容放进去,然后重命名为start.sh后,把它属性设为可运行,运行后,快速弹出,那个界面看不到详细的,一闪就没啦,结果我上不了网了.本本无线上网的.linux deepin注销后恢复上网状态.
Reply View the author
electricface
deepin
2013-08-16 16:31
#2
记录bug管理 #2327
Reply View the author
qq200600
deepin
2013-08-16 18:16
#3
可我本本前几天就把win7给格了,只留linux deepin.

不然我也想测试下,运行环境是deepin 12.12.1   32位

不敢乱折腾呀.

到了:6.然后创建快捷启动文件随便在哪里创建start.sh

这一步不会呀,如何创建?我新建成文本文件,把内容放进去,然后重命名为start.sh后,把它属性设为可运行,运行后,快速弹出,那个界面看不到详细的,一闪就没啦,结果我上不了网了.本本无线上网的.linux deepin注销后恢复上网状态.

就是在新建成文本文件,把内容放进去,然后重命名为start.sh 在命令行里面运行试试 看有什么错误
Reply View the author
woodelf
deepin
2013-08-16 18:29
#4
脚本都用root权限运行了,脚本里面还要写上sudo作甚?
多此一举,而且脚本里面的sudo用法也不是这么写的。
另外一点,第4步里面KDE的命令怎么也是gedit?KDE自带的编辑器是kate才对。
Reply View the author
vipsks
deepin
2013-08-16 18:38
#5
[quote]可我本本前几天就把win7给格了,只留linux deepin.

不然我也想测试下,运行环境是deepin 12.12.1   32位

不敢乱折腾呀.

到了:6.然后创建快捷启动文件随便在哪里创建start.sh

这一步不会呀,如何创建?我新建成文本文件,把内容放进去,然后重命名为start.sh后,把它属性设为可运行,运行后,快速弹出,那个界面看不到详细的,一闪就没啦,结果我上不了网了.本本无线上网的.linux deepin注销后恢复上网状态.

就是在新建成文本文件,把内容放进去,然后重命名为start.sh 在命令行里面运行试试 看有什么错误[/quote]
运行命令是,麻烦贴下嘛,我新人,不懂的地方多着呢.
Reply View the author
qq200600
deepin
2013-08-16 21:30
#6
脚本都用root权限运行了,脚本里面还要写上sudo作甚?
多此一举,而且脚本里面的sudo用法也不是这么写的。
另外一点,第4步里面KDE的命令怎么也是gedit?KDE自带的编辑器是kate才对。
莫激动哈 我只是翻译了一下外文。。。
Reply View the author
jouyouyun
deepin
2013-08-17 01:15
#7
mark
Reply View the author
2048tb.com
deepin
2013-08-17 06:47
#8
[quote]脚本都用root权限运行了,脚本里面还要写上sudo作甚?
多此一举,而且脚本里面的sudo用法也不是这么写的。
另外一点,第4步里面KDE的命令怎么也是gedit?KDE自带的编辑器是kate才对。
莫激动哈 我只是翻译了一下外文。。。[/quote]
那你这不是标题党吗?标题显示亲测!
Reply View the author
ahcute
deepin
2013-08-17 07:47
#9
那他确实是自己测试了的啊。。。
亲测没错啊。。。没写原创啊
觉得还是加上转帖翻译会好些。。。
另外谢谢了,明天试试
Reply View the author
leolin
deepin
2013-08-17 19:41
#10
有没有大神能搞成“一键共享”呢
Reply View the author
cxbii
deepin
2013-08-17 20:01
#11
有没有大神能搞成“一键共享”呢
以后的网络设置会内带这个功能的
Reply View the author
a287740928
deepin
2013-08-19 23:56
#12
  1. SIOCSIFADDR: 没有那个设备
  2. wlan0: 获取接口标志时出错: 没有那个设备
  3. * Restarting DNS forwarder and DHCP server dnsmasq                             
  4. dnsmasq: unknown interface wlan0
  5.                                                                          [fail]
  6. net.ipv4.ip_forward = 1
  7. Configuration file: /etc/hostapd.conf
  8. Could not read interface wlan0 flags: No such device
  9. Could not read interface wlan0 flags: No such device
  10. nl80211 driver initialization failed.
  11. net.ipv4.ip_forward = 0
  12. * Stopping DNS forwarder and DHCP server dnsmasq                                * (not running)
Copy the Code
怎么破?
Reply View the author
qq200600
deepin
2013-08-20 08:19
#13
[quote][quote]脚本都用root权限运行了,脚本里面还要写上sudo作甚?
多此一举,而且脚本里面的sudo用法也不是这么写的。
另外一点,第4步里面KDE的命令怎么也是gedit?KDE自带的编辑器是kate才对。
莫激动哈 我只是翻译了一下外文。。。[/quote]
那你这不是标题党吗?标题显示亲测![/quote]
对呀 我测试了的呀 晕 :?
Reply View the author
no1lixixi
deepin
2013-09-14 23:58
#14
这个32位系统谁试过了?可以用么?
Reply View the author
isunny
deepin
2013-09-18 17:08
#15
有这样的需求了   不过看起来好麻烦的样子 啊  要是有人打个包子就好了  最好再附一个简单的 使用说明。。。
Reply View the author
老银杏
deepin
2014-02-28 00:33
#16
可以连接上电脑,但是不能共享上网,不知道那里的问题
Reply View the author
老银杏
deepin
2014-02-28 00:34
#17
[quote]有没有大神能搞成“一键共享”呢
以后的网络设置会内带这个功能的[/quote]
在哪里可以找到这个功能?
Reply View the author