如何通过 CLI 设置 NAT 接入点?橙皮

如何通过 CLI 设置 NAT 接入点?橙皮

我想通过 CLI 使用 NAT 设置接入点。当我使用“orangepi-config”设置时,我无法通过 CLI 找出这些设置。

如何使用 CLI 配置 NAT 接入点?

笔记:

操作系统:Orange Pi Bionic,Linux 4.9.170-sun50iw9

我是按照程序做的,比如

  1. 禁用 systemd 解析

    
    sudo systemctl disable systemd-resolved
    
    sudo rm -v /etc/resolv.conf
    
    echo "nameserver 8.8.8.8" | sudo tee /etc/resolv.conf
    
    
  2. 安装 DNSMASQ

    sudo apt install dnsmasq -y

  3. DHCP 设置

    sudo mv -v /etc/dnsmasq.conf /etc/dnsmasq.conf.bk

    sudo nano /etc/dnsmasq.conf

    
    listen-address=172.24.1.1
    
    bind-interfaces
    
    server=8.8.8.8
    
    domain-needed
    
    bogus-priv
    
    dhcp-range=172.24.1.50,172.24.1.150,12h
    
    
    sudo rfkill unblock wlan
    
    sudo systemctl restart dnsmasq
    
    
  4. 转发端口

    sudo nano /etc/sysctl.conf

    kernel.printk = 3 4 1 3
    vm.swappiness=100
    
    
  5. IP表

    iptables -t nat -A POSTROUTING -o wlan0 -j MASQUERADE
    
    iptables -A FORWARD -i eth0 -o wlan0 -m state --state RELATED,ESTABLISHED -j ACCEPT
    
    iptables -A FORWARD -i wlan0 -o eth0 -j ACCEPT
    
    
  6. 主机

    sudo nano /etc/hostapd.conf

    # orangepi hostapd configuration example
    #
    # nl80211 mode
    #
    
    ssid=OrangePi
    interface=wlan0
    hw_mode=g
    channel=40
    #bridge=br0
    driver=nl80211
    
    logger_syslog=0
    logger_syslog_level=0
    wmm_enabled=1
    wpa=2
    preamble=1
    
    wpa_psk=66eb31d2b48d19ba216f2e50c6831ee11be98e2fa3a8075e30b866f4a5ccda27
    wpa_passphrase=12345678
    wpa_key_mgmt=WPA-PSK
    wpa_pairwise=TKIP
    rsn_pairwise=CCMP
    auth_algs=1
    macaddr_acl=0
    
    ## IEEE 802.11n
    ieee80211n=1
    ht_capab=[SHORT-GI-20][SHORT-GI-40][HT40+]
    country_code=US
    ieee80211d=1
    ## IEEE 802.11n
    
    ## IEEE 802.11a
    hw_mode=a
    ## IEEE 802.11a
    
    ## IEEE 802.11ac
    ieee80211ac=1
    vht_capab=
    vht_oper_chwidth=1
    vht_oper_centr_freq_seg0_idx=42
    ## IEEE 802.11ac
    
    # controlling enabled
    ctrl_interface=/var/run/hostapd
    ctrl_interface_group=0
    
    

但是,它是失败的

相关内容