Fine3399或rk3399\sw799刷armbian创建热点

sudo bash
#切换root
sudo apt install -y hostapd isc-dhcp-server ifupdown


# 配置 hostapd
sudo nano /etc/hostapd/hostapd.conf
interface=wlan0
driver=nl80211
ssid=hostspot-name
macaddr_acl=0
auth_algs=1
#auth_algs=3
ignore_broadcast_ssid=0
hw_mode=bgn
channel=6
wpa=2
wpa_passphrase=password
wpa_key_mgmt=WPA-PSK
wpa_pairwise=CCMP
#wpa_pairwise=TKIP
#rsn_pairwise=CCMP

# 修改 hostapd 默认配置文件路径
sudo nano /etc/default/hostapd
DAEMON_CONF=/etc/hostapd/hostapd.conf

# 重启 hostapd
sudo service hostapd restart
sudo service hostapd status

# dhcp 配置
sudo nano /etc/dhcp/dhcpd.conf
#option domain-name "example.org";
#option domain-name-servers ns1.example.org, ns2.example.org;
authoritative;
subnet 10.0.0.0 netmask 255.255.255.0 {
    range 10.0.0.10 10.0.0.200;
    option broadcast-address 10.0.0.255;
    option routers 10.0.0.1;
    default-lease-time 600;
    max-lease-time 7200;
    option domain-name "local";
    option domain-name-servers 223.5.5.5, 8.8.4.4;
}

# 设置 dhcp 网口
# 不进行操作会出现错误:Not configured to listen on any interfaces!
sudo nano /etc/default/isc-dhcp-server
INTERFACESv4="wlan0"
INTERFACESv6="wlan0"

# 设置 wlan0 地址
# 不进行操作会出现错误:Not configured to listen on any interfaces!
sudo ip addr add 10.0.0.1/24 dev wlan0
# 设置开机自动设置
mkdir /etc/network/interfaces.d/
echo -e "# armbian NAT hostapd\nallow-hotplug wlan0\niface wlan0 inet static\n \taddress 10.0.0.1\n\tnetmask 255.255.255.0\n\tnetwork 10.0.0.0\n\tbroadcast 10.0.0.255" > /etc/network/interfaces.d/armbian.ap.nat
# 开启转发
sudo sysctl -w net.ipv4.ip_forward=1
sudo iptables -t nat -A POSTROUTING -s 10.0.0.1/24 -o eth0 -j MASQUERADE
sudo iptables -A FORWARD -i eth0 -o wlan0 -m state --state RELATED,ESTABLISHED -j ACCEPT
sudo iptables -A FORWARD -i wlan0 -o eth0 -j ACCEPT
#设置开机启动自动设置
sudo iptables-save > /etc/iptables.ipv4.nat
cat <<-EOF > /etc/systemd/system/armbian-restore-iptables.service
[Unit]
Description="Restore IP tables"
[Timer]
OnBootSec=20Sec
[Service]
Type=oneshot
ExecStart=/sbin/iptables-restore /etc/iptables.ipv4.nat
[Install]
WantedBy=sysinit.target
EOF
systemctl enable armbian-restore-iptables.service
# 启动 dhcp 服务
systemctl enable isc-dhcp-server 
systemctl start isc-dhcp-server 

参考:https://gitee.com/xiayang0521/rk3399

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值