rk3568 Debian11 如何打开热点

思路:

1. 下载必要工具(hostapt、dnsmasq)

2. 配置网络(无线网卡配置静态IP)

3. 配置hostapt配置文件

4. 配置DHCP服务

5. 启动服务(hostapd/dnsmasq/network)

6. IP转发(这一步决定了是否可以上网)
一、 下载必要工具 :
# apt-get update
# apt-get install hostapd dnsmasq
二、配置网络: 
# vi /etc/network/interfaces
//Add the following to the file
auto wlx367de41c8192
iface wlx367de41c8192 inet static
address 192.168.1.1
netmask 255.255.255.0

在这里插入图片描述

无线网卡设备名称为什么使用的是 wlx367de41c8192 ?

在这里插入图片描述

我看的手册,我使用的无线模块为:RTL8723DU

在这里插入图片描述
在这里插入图片描述

三、配置hostapt配置文件 (关于具体配置说明网上有很多资源介绍)

# touch /etc/hostapd/hostapd.conf
# chmod 777 /etc/hostapd/hostapd.conf

# vi /etc/hostapd/hostapd.conf

//Add the following to the file

interface=wlx367de41c8192
ssid=YourHots
hw_mode=g
channel=6
wmm_enabled=0
macaddr_acl=0
auth_algs=1
ignore_broadcast_ssid=0
wpa=2
wpa_passphrase=12345678
wpa_key_mgmt=WPA-PSK
wpa_pairwise=TKIP
rsn_pairwise=CCMP

在这里插入图片描述

四、配置DHCP服务

# vi /etc/dnsmasq.conf

//Add the following to the file

interface=wlx367de41c8192
dhcp-range=192.168.1.2,192.168.1.100,255.255.255.0,12h

在最后一行添加即可

五、启动服务(hostapd/dnsmasq/network)

# service dnsmasq start
# systemctl unmask hostapd.service
# service hostapd start
# systemctl restart networking

此时手机可以连接到该热点了,但是依然无法上网。

在这里插入图片描述
在这里插入图片描述

六、IP转发(这一步决定了是否可以上网)
IP转发,步步都是坑,我就是一个坑一个坑的爬起来,本人对这方便的知识了解还是一只小菜鸟,
但是解决完这个问题后还是稍有成就感,分享主要是为了记录,其次有幸的话能给其他小白一些借鉴,少入坑。
1)保存IP 转发设置
# vi  /etc/sysctl.conf
net.ipv4.ip_forward=1

在这里插入图片描述

2)确认内核是否配置了防火墙 iptables,如果没有配置,这里需要配置内核然后重新编译。

+CONFIG_NETFILTER=y
+CONFIG_NF_CONNTRACK=y
+CONFIG_NF_TABLES=y
+CONFIG_NF_TABLES_INET=y
+CONFIG_IP_NF_IPTABLES=y
+CONFIG_IP_NF_NAT=y
+CONFIG_IP_NF_TARGET_MASQUERADE=y
+CONFIG_BRIDGE=y
+CONFIG_IPV6=n
修改内核配置后,wifi/BT模块的驱动务必需要重新编译,不然kernel在加载wifi驱动的时候会崩溃掉。
我选择在板子上,删除掉原来wifi/bt驱动后,再烧写boot.img驱动,最后使用 adb push 放置最新编译
的驱动到相对应的目录下。
# rm -rf /system/lib/modules/RTL8723DU.ko
# rm -rf /usr/lib/modules/rtk_btusb.ko
以下为ADB操作:

adb push G:\C_Push\gg\RTL8723DU.ko /system/lib/modules
adb push G:\C_Push\gg\rtk_btusb.ko /usr/lib/modules
adb shell
chmod 777 /system/lib/modules/RTL8723DU.ko
chmod 777 /usr/lib/modules/rtk_btusb.ko
reboot
3)设置防火墙工具
# update-alternatives --config iptables
# iptables -t nat -L

在这里插入图片描述
在这里插入图片描述

4. IP 转发
# iptables -t nat -A POSTROUTING -s 192.168.1.1/24 ! -d 192.168.1.1/24 -j MASQUERADE

在这里插入图片描述

此时可以上网啦

在这里插入图片描述

板子重启的话,需要重新加载网络和ip转发。
# systemctl restart networking
# iptables -t nat -A POSTROUTING -s 192.168.1.1/24 ! -d 192.168.1.1/24 -j MASQUERADE
  • 0
    点赞
  • 9
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

YY2065

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值