In the Raspberry Pi, by the way, record how to distribute hot spots to your phone or other device using raspberry. The premise here is that the Raspberry Pi requires a wireless card (a small USB). This does not show how to install the Raspberry Pi system. Okay, let's go straight to the subject.
1. Modify the IP of the Wlan0
sudo nano/etc/network/interfaces
Comment or delete the part of the Wlan0. Take care not to confuse the eth0 part, that's the wired card.
192.168. 10.1 255.255. 255.0
2. Installing HOSTAPD
sudo Install HOSTAPD
Edit HOSTAPD Default Profile
sudo NANO/ETC/DEFAULT/HOSTAPD
Find #daemon_conf= "" and modify it to:
daemon_conf="/etc/hostapd/hostapd.conf"
Then edit:
sudo nano/etc/hostapd/hostapd.conf
The contents of the changes are as follows, according to the need to change their own parameters, mainly those changes can be, where WPA is equal to 3. Here to change to 2. We usually pick up the WiFi or WPA2 this mode is mostly. One of the driver=nl80211 is the driver for most people, because I have a problem with the driver installation, so I installed the third-party driver, and finally the following driver appeared. A third-party driver method is installed below.
Interface=Wlan0ssid=Raspberrychannel= One#bridge=br0# WPA and WPA2 configurationmacaddr_acl=0Auth_algs=1Ignore_broadcast_ssid=0WPA=2Wpa_passphrase=Raspberrywpa_key_mgmt=wpa-pskwpa_pairwise=tkiprsn_pairwise=ccmp# Hardware configurationdriver=rtl871xdrvieee80211n=1Hw_mode=Gdevice_name=Rtl8192cumanufacturer=realtek
HOSTAPD is primarily the file setting for this hostapd.conf. Now you can restart your HOSTAPD service.
sudo service HOSTAPD restart
If there is no error, then the next step, I am not so lucky, the following error occurred, need to install a third-party driver
file:/etc/hostapd/'nl80211'nl80211 '
Uninstalling the previously installed HOSTAPD driver
sudo apt-get autoremove HOSTAPD
Download third-party drivers
wget https://tar -zxvf v1. 1. Tar . GZ cd RTL8188-hostapd-1.1/sudomakesudomake Install
now! You can restart the HOSTAPD service, this is no problem, hehe.
3. Installing the DHCP service
sudo Install Isc-dhcp-server
To edit a file:
sudo nano/etc/dhcp/dhcpd.conf
The contents are as follows:
default-lease- Time -; Max-lease- Time 7200; log-facility LOCAL7; subnet192.168.10.0Netmask255.255.255.0{Range192.168.10.10 192.168.10.100; option Routers192.168.10.1; option broadcast-address192.168.10.127; option Domain-name-servers8.8.8.8,8.8.4.4; default-lease- Time -; Max-lease- Time 7200; }
Restart service after saving
sudo service isc-dhcp-server restart
4. Configure route forwarding
sudo iptables-sudo iptables-sudo iptables-t nat-a postrouting-o eth0-
sudo
bash iptables-save >/etc/
iptables.up.rules exit
Edit:
sudo nano/etc/network/if-pre-up.d/iptables
Add the following two lines of code:
#!/bin//sbin/iptables-restore </etc/iptables.up.rules
Save exit, and then modify Iptables permissions:
sudo chmod 755 /etc/network/if-pre-up.d/iptables
Account Core Forwarding:
sudo nano/etc/sysctl.conf
Find the following two lines:
for IPv4 #net. Ipv4.ip_forward=1
Remove the Net.ipv4.ip_forward in front of you and save the exit.
And then
sudo sysctl-p
5. Service Self-starter
Hot Wi-Fi is of course the boot to start, or else to bash command, outside to open a WiFi can not be done. Continue as follows:
sudo chkconfig--sudo chkconfig--add isc-dhcp-server
The launch of WiFi in here, even if completed, there is a question about the boot start item, you can refer to my blog post: http://www.cnblogs.com/xmfdsh/p/4469577.html
Make a wireless router with Raspberry Pi