资讯

精准传达 • 有效沟通

从品牌网站建设到网络营销策划,从策略到执行的一站式服务

linux命令显示热点 linux连接热点

deepin linux怎么创建wifi热点

方法/步骤

榆林网站建设公司创新互联,榆林网站设计制作,有大型网站制作公司丰富经验。已为榆林成百上千家提供企业网站建设服务。企业网站搭建\外贸网站制作要多少钱,请找那个售后服务好的榆林做网站的公司定做!

安装hostapd无线网认证程序。

sudo apt-get install hostapd

安装小型DNS/TFTP服务器。

sudo apt-get install dnsmasq

安装iptables。默认deepin linux下已经安装。

sudo apt-get install iptables

安装git,需要克隆github上的create_ap。sudo apt-get install git

建立一个文件夹,并初始化git仓库,以便克隆github上的工具。

克隆github上的ap创建工具create_ap。

克隆完成,执行如下命令安装create_ap。

sudo make install

接下来查看自己电脑上网络名称。

最后通过create_ap来创建wifi热点,命令格式:

create_ap 无线网卡 有线网卡 热点名称 密码

比如我的电脑创建一个密码为110120114的叫mywifi的热点。

sudo create_ap wlan0 enxb827eb03ac05 mywifi 110120114

开启后,其它无线设备就可以在无线网扫描中找到mywifi的网络,输入密码即可上网了。

linux mint17怎么开热点

第一步:安装应用;

apt-get install hostapd dnsmasq

第二步:配置文件;

修改/etc/hostapd/hostapd.conf

1

2

3

4

5

6

7

8

9

10

interface=wlan0

driver=nl80211

ssid=hotspot # Your WAP name, change it to something more unique

hw_mode=g

channel=6 # You may want to change this if the channel is too crowded

wpa=1

wpa_passphrase=hotspot_password # Password for clients

wpa_key_mgmt=WPA-PSK

wpa_pairwise=TKIP CCMP

wpa_ptk_rekey=600

修改/etc/dnsmasq.conf

1

2

3

4

5

6

7

8

9

# disables dnsmasq reading any other files like /etc/resolv.conf for nameservers

no-resolv

# Interface to bind to

interface=wlan0

# Specify starting_range,end_range,lease_time

dhcp-range=10.0.0.3,10.0.0.20,12h

# dns addresses to send to the clients

server=8.8.8.8

server=8.8.4.4

第三步:添加脚步;

将以下脚本添加到/etc/network/if-up.d/wapstart:

#!/bin/sh

WIRE=eth0

WIFI=wlan0

# Only run script for wired interface

if [ ! "$IFACE" = "$WIRE" ]

then

exit 0

fi

# Setup wireless interface

ifconfig $WIFI up 10.0.0.1 netmask 255.255.255.0

# Start dnsmasq

/etc/init.d/dnsmasq start

#Enable NAT

iptables --flush

iptables --table nat --flush

iptables --delete-chain

iptables --table nat --delete-chain

iptables --table nat --append POSTROUTING --out-interface $WIRE -j MASQUERADE

iptables --append FORWARD --in-interface $WIFI -j ACCEPT

# Start the Wireless Access Point service

/etc/init.d/hostapd start

exit 0

将以下脚本添加到/etc/network/if-post-down.d/wapstop:

#!/bin/bash

WIRE=eth0

WIFI=wlan0

# Only run script for wired interface

if [ ! "$IFACE" = "$WIRE" ]

then

exit 0

fi

# Stops Wireless Access Point services

/etc/init.d/hostapd stop

/etc/init.d/dnsmasq stop

# Asked nice the first time...

killall dnsmasq

killall hostapd

ifconfig $WIFI down

为这两个脚本加上可执行权限:

chmod +x /etc/network/if-up.d/wapstart

chmod +x /etc/network/if-post-down.d/wapstop

最后一步:使用咯;

ifconfig eth0 down

ifconfig eth0 up

linux设备发出热点接收wifi账号密码

步骤分步阅读

1

/6

检查确认笔记本网卡支持master模式

首先要安装一个iw:yum install iw -y

然后执行命令:iw list

在命令执行结果中如果看到了下面的内容,就说明这张网卡是支持用于ap做路由的

Supported interface modes:

* IBSS

* managed

* AP

* AP/VLAN

* monitor

* mesh point

2

/6

安装hostapd

通过 yum install hostapd -y 安装,如果是其它红帽系列的可以安装epel的源,或者找一下hostapd的rpm,下载对应自己发行版的进行安装。其它Linux可以通过源码安装。

3

/6

修改配置文件

# vim /etc/hostapd/hostapd.conf

修改成如下状态

ctrl_interface=/var/run/hostapd

ctrl_interface_group=wheel

macaddr_acl=0

auth_algs=1

ignore_broadcast_ssid=0

wpa=3

wpa_key_mgmt=WPA-PSK

wpa_pairwise=TKIP

rsn_pairwise=CCMP

wpa_passphrase=ap_password

driver=nl80211

interface=wlan0

hw_mode=g

channel=9

ssid=ap_name

注意修改涉及到的ssid和密码

4

/6

安装和配置dhcp

# yum install dhcpd -y

# vim /etc/dhcp/dhcpd.conf

将此文件改成如下:

option domain-name-servers 211.161.45.222,10.141.146.10;

default-lease-time 3600;

max-lease-time 7200;

log-facility local7;

subnet 192.168.7.0 netmask 255.255.255.0 {

range 192.168.7.77 192.168.7.99;

option broadcast-address 192.168.7.255;

option routers 192.168.7.7;

}

注意将第一行的nameserver添加成你isp提供的dns,这样解析的速度会快一些,不知道的话就改成谷歌的8.8.8.8好了。subnet 里面设置的是分配给连接无线路由的设备的ip段,可以根据自己需求进行调整,这里给了192.168.7.77-99

需要注意的是,option routers要写成这台机器的wlan0的ip,这个是手动设置的

# ifconfig wlan0 192.168.7.7

5

/6

配置SNAT

Linux可以很方便的通过iptables配置SNAT服务器,命令如下:

iptables -t nat -I POSTROUTING -o eth0 -j MASQUERADE

iptables -A FORWARD -s 192.168.4.0/24 -j ACCEPT

iptables -A FORWARD -d 192.168.4.0/24 -j ACCEPT

其中第一条表示将通过本机的转发数据包从eth0(外网)这个网卡发出去,另外两条表示只转发192.168.4.0/24这个网段过来的数据包,这个网段正好是wlan0其它设备连上本机以后分配的网段。

还需要在打开内核的ip转发功能:

# vim /etc/sysctl.conf

添加或修改这样一段:

net.ipv4.conf.default.rp_filter = 1

然后执行命令

# sysctl -p

6

/6

启动相关服务

/etc/init.d/dhcpd start

/etc/init.d/hostapd start

将有线网卡的网口插上网线调通就可以用其它无线设备连接此wifi ap上网了。


本文名称:linux命令显示热点 linux连接热点
网页路径:http://cdkjz.cn/article/doppdie.html
多年建站经验

多一份参考,总有益处

联系快上网,免费获得专属《策划方案》及报价

咨询相关问题或预约面谈,可以通过以下方式与我们联系

大客户专线   成都:13518219792   座机:028-86922220