设为首页 收藏本站
查看: 637|回复: 0

[经验分享] Turn Your Raspberry Pi Into a WiFi Hotspot with Edimax Nano USB EW-7811Un (RTL81

[复制链接]

尚未签到

发表于 2015-10-1 09:56:21 | 显示全部楼层 |阅读模式
  http://www.daveconroy.com/turn-your-raspberry-pi-into-a-wifi-hotspot-with-edimax-nano-usb-ew-7811un-rtl8188cus-chipset/
  
Posted by dconroy on Jul 10, 2013 in How To's, Raspberry Pi | 142 comments | 143,087 views
  I’m writing this blog to help anyone with an Edimax Nano USB WiFi adapter (EW-7811Un) configure a Wireless Accesss Point. The main reason I wrote this post is because the Edimax was the first wireless adapter I ever recommended(turning a Raspberry Pi into a fully functional web server). I chose this adapter because it works out of the box, is cheap, and has a really low profile. But when I started the process of trying to turn my rPi into a WiFi hotspot, it seemed that every tutorial out there claimed that the Edimax card I had recommended “doesn’t support Access Point”.
  Luckily for you and me, this is not the case.
DSC0000.jpg
  Given the varied level of experience of my readers, this tutorial will start from scratch. If you already have your operating system running, skip forward as needed.
  For this tutorial I am using Raspbian. I recommend it because it is an optimized version of Debian built specifically for Raspberry Pi’s. The last stable downloads can be found here.
  To flash your SD Card, you will need to unzip the image and write it your SD card using Win32DiskImager. This tool can also be used to after our initial setup to create an image of our finalized implementation(very useful as a backup).
DSC0001.png
  After the image is flashed, you can boot your device. At this point you can use your HDMI Cable/Mouse/Keyboard for your initial configuration, or you can use an SSH Client like Putty to connect. The default hostname, login, and password are as follows:
  host:raspberrypi
Username: pi
Password: raspberry
DSC0002.jpg
  For this tutorial, I will be using putty. On first boot, you will be prompted with a configuration tool called Raspi-Config. If the raspi-config doesnt load automatically, just enter the following command from the shell to get started.




sudo raspi-config
DSC0003.jpg
  The settings I recommend you update are

  update
expand_rootfs
change_pass
change_timezone
memory_split

  The usual distribution images are 2 GB. When you copy the image to a
larger SD card you have a portion of that card unused. expand_rootfs
expands the initial image to expand to fill the rest of the SD card,
giving you more space. By default, 64mb is reserved for the Graphical
UI. Since we plan on using this as a WiFi Hotspot, we can reduce this to
32mb with the memory_split command.
  After you finish your changes to the raspi-config, you should reboot your pi using the following command:




sudo shutdown -r now
  At this point you have a fully functional linux server, but we still need to check our network card and setup our WiFi hotspot.

Prerequisites
  The first thing you need to do is make sure you have an existing wired connection to your rPi. After that, you need to install the following packages.




sudo apt-get install bridge-utils hostapd
  The whole crux of the issue is that it is the apt hosted copy of hostapd that is not compatible with the RTL8188CUS chipset. But, thanks to the Edimax team, I’ve got a replacement hostapd binary to resolve this issue. This tutorial will not work without it.
  To download and replace the installed binary version of hostapd we just installed, issue the following commands:




wget http://www.daveconroy.com/wp3/wp-content/uploads/2013/07/hostapd.zip
unzip hostapd.zip
sudo mv /usr/sbin/hostapd /usr/sbin/hostapd.bak
sudo mv hostapd /usr/sbin/hostapd.edimax
sudo ln -sf /usr/sbin/hostapd.edimax /usr/sbin/hostapd
sudo chown root.root /usr/sbin/hostapd
sudo chmod 755 /usr/sbin/hostapd
  *Note, some people don’t like the idea of installing from untrusted 3rd parties, so if If would rather compile your own binary, you can download the realtek driver here . You will have to navigate to the ~/RTL8188C_8192C_USB_linux_v3.4.4_4749.20121105/wpa_supplicant_hostapd/wpa_supplicant_hostapd-0.8/hostapd and run a make, make install, then hostapd like i did above.

Bridge the Network Connections
  Now that we have the proper hostapd installed, we need to create a bridge between our ethernet connection and our Edimax Wireless card. To do this, we need to edit our network interfaces:




sudo nano /etc/network/interfaces
  To avoid any conflicts, you need to delete or comment out(#) any lines conatining wlan0 and then add the following text to bridge the connections, assuming your ethernet and wireless adapters are named eth0 and wlan0( use ifconfig -a to check)

  auto br0
iface br0 inet dhcp
bridge_ports eth0 wlan0


  
  The resulting file should look like this:

  #loopback adapter
auto lo
iface lo inet loopback
  #wired adapter
iface eth0 inet dhcp
  #bridge
auto br0
iface br0 inet dhcp
bridge_ports eth0 wlan0

  

Configuring Hostapd
  Now that our interfaces are setup, we need to configure hostapd. To do so, create the following file




sudo nano /etc/hostapd/hostapd.conf
  with the following contents:

  interface=wlan0
driver=rtl871xdrv
bridge=br0
ssid=DaveConroyPi
channel=1
wmm_enabled=0
wpa=1
wpa_passphrase=ConroyPi
wpa_key_mgmt=WPA-PSK
wpa_pairwise=TKIP
rsn_pairwise=CCMP
auth_algs=1
macaddr_acl=0


  

Wrapping Up
  We should be finished now, and afer a reboot




sudo reboot
  you can test your configuration using the following command




sudo hostapd -dd /etc/hostapd/hostapd.conf
  If it runs as expected, you can add it to startup by editing




sudo nano /etc/default/hostapd
  and uncommenting and updating the following line

  DAEMON_CONF="/etc/hostapd/hostapd.conf"


  That should do it! I’m happy to answer any questions, just comment on this post. Thanks for reading! DSC0004.png

运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-121198-1-1.html 上篇帖子: ubuntu下破解wifi密码 下篇帖子: android.net.wifi的简单使用方法
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表