【Ubuntu】单无线网卡创建无线热点共享网络连接
来源:互联网 发布:阿里云域名 跳转 编辑:程序博客网 时间:2024/05/17 02:39
主要工具:
- iw : A new nl80211 based CLI configuration utility for wireless
devices. - hostapd : A user space software access point capable of
turning normal network interface cards into access points and
authentication servers. - iptables : Used to set up, maintain, and inspect the tables of IPv4 packet filter rules in the Linux kernel.
- udhcpd : A very small DHCP server program geared towards embedded systems.
- udpcpc : A very small DHCP client program geared towards embedded systems.
- macchanger : A GNU/Linux utility for viewing/manipulating the MAC address of network interfaces.
安装方法:
sudo apt-get install iw hostapd iptables udhcpd udhcpc macchanger
各工具配置文件:
/etc/hostapd.conf
interface=new1driver=nl80211ssid=xxxxxxxxxchannel=11 #I sugest you to use the same channel as your wireless networkhw_mode=gwme_enabled=1macaddr_acl=0auth_algs=1ignore_broadcast_ssid=0wpa=3wpa_passphrase=xxxxpasswordxxxxxwpa_key_mgmt=WPA-PSKwpa_pairwise=TKIPrsn_pairwise=CCMP
/etc/udhcpd.conf
start 192.168.0.102 #These IPs must to be in the same subset as your current default routeend 192.168.0.117 interface new1 opt dns 114.114.114.114 option subnet 255.255.255.0opt router 192.168.0.101 #This IP must to be in the same subset as your current default routeoption domain localhost
/etc/default/udhcpd
# Comment the following line to enable#DHCPD_ENABLED="no"# Options to pass to busybox' udhcpd.## -S Log to syslog# -f run in foregroundDHCPD_OPTS="-S"
/etc/wpa_supplicant.conf
ctrl_interface=/run/wpa_supplicantnetwork={ ssid="CMCC-EDU" key_mgmt=NONE}
启动 & 关闭 热点 脚本:
启动热点 脚本:
#!/bin/bashservice network-manager stopsleep 1pkill -15 nm-appletsleep 1ifconfig wlan0 down #wlan0 - the name of your wireless adaptersleep 1iw phy phy0 interface add new0 type stationiw phy phy0 interface add new1 type __apsleep 2macchanger --mac 00:11:22:33:44:55 new0macchanger --mac 00:11:22:33:44:66 new1ifconfig new1 192.168.0.101 up #192.168.0.101 - the same IP defined for router in 'udhcpd.conf' file hostapd /etc/hostapd.conf &sleep 2service udhcpd startwpa_supplicant -i new0 -c /etc/wpa_supplicant.conf &sleep 10udhcpc -i new0echo "1" > /proc/sys/net/ipv4/ip_forwardiptables --table nat --append POSTROUTING --out-interface new0 -j MASQUERADEiptables --append FORWARD --in-interface new1 -j ACCEPT
关闭热点 脚本:
#!/bin/bashkillall wpa_supplicantkillall hostapdservice udhcpd stopiw dev new0 deliw dev new1 delifconfig wlan0 uproute add -net 0.0.0.0/0 netmask 0.0.0.0 dev wlan0iptables --table nat --delete POSTROUTING --out-interface new0 -j MASQUERADEiptables --delete FORWARD --in-interface new1 -j ACCEPTservice network-manager startnm-applet &
其他备选方法:
create_ap 脚本。
注意!此脚本在单无线网卡上开热点时会失败。
Ref:
1. http://askubuntu.com/questions/318973/how-do-i-create-a-wifi-hotspot-sharing-wireless-internet-connection-single-adap
2. https://wireless.wiki.kernel.org/en/users/documentation/iw
3. https://wiki.gentoo.org/wiki/Hostapd
4. https://w1.fi/cgit/hostap/plain/hostapd/hostapd.conf
5. https://github.com/oblique/create_ap
0 0
- 【Ubuntu】单无线网卡创建无线热点共享网络连接
- 用无线网卡做wifi热点共享网络的方法
- Ubuntu 16.04 创建无线热点
- ubuntu 开启无线网卡的wifi热点
- win7 虚拟无线网卡 创建wifi热点
- Win7下建立WiFi热点共享网络(共享3G无线网卡/有线本地连接)
- 如何使用笔记本无线网卡创建无线热点?
- 如何使用笔记本无线网卡创建无线热点补充(本地连接)
- windowsXP笔记本创建无线热点共享上网
- Windows7下用无线网卡自建热点共享Internet访问
- ubuntu开启无线热点
- 无线热点创建完成
- Fedora17 创建无线热点
- Mac创建无线热点
- Windows7上网共享模式二:做为无线路由器--无线网卡连接因特网,同时无线无线网卡共享
- ubuntu建立无线热点与windows、手机等共享有线网络
- ubuntu建立无线热点与windows、手机等共享有线网络
- WIN7下使用无线网卡共享网络(利用笔记本无线网卡做无线AP)
- 使用Handler子线程向主线程通信方式及源码解析
- 矩形嵌套(最小字典序)—DAG动态规划问题
- 如何获取EDU邮箱
- MBProgressHUD 介绍及使用
- 硬币问题(字典最小序)-DAG动态规划问题
- 【Ubuntu】单无线网卡创建无线热点共享网络连接
- QT 和 MFC
- Win32中用VS生成属于自己的动态链接库(DLL)并应用
- 数字音频备忘录
- 八一八那些男票脑洞大开时送的奇葩礼物
- leetcode:152. Maximum Product Subarray
- GeoHadoop 之 Hilbert 空间填充曲线 Java 实现(一)
- 【翻(xue)译(xi)】3D Game Programming With DirectX11 - 4.1
- 【翻(xue)译(xi)】3D Game Programming With DirectX11 - 4.2