Table of Contents

VIM4 Wi-Fi STA/AP Mode Configuration

Download

wget https://raw.githubusercontent.com/khadas/fenix/refs/heads/master/archives/filesystem/common/usr/local/bin/khadas_ap.sh
sudo chmod 777 khadas_ap.sh
sudo mv khadas_ap.sh /usr/local/bin

We will add it in next version and users could also rebuild the image.

Overview

This guide explains how to configure dual Wi-Fi mode using the provided script (v1.0), enabling simultaneous operation in:

STA+AP Mode: wlan0 as STA (connects to existing Wi-Fi) + wlan1 as AP (creates hotspot)

ETH+AP Mode: eth0 as Ethernet uplink + wlan1 as AP (Note: Not available on Edge2 devices)

Prerequisites

Root privileges required

Ensure wireless interfaces are properly identified:

STA interface: wlan0

AP interface: wlan1

Ethernet interface: eth0 (not present on Edge2)

Configuration Script Usage

Run the script with root privileges:

sudo khadas_ap.sh
========================================
 WiFi Configuration Tool v1.0
========================================
1. STA+AP Mode
2. ETH+AP Mode
3. Stop All Services
4. Exit
========================================
Please select an option [1-4]:

1.STA+AP Mode - Recommended for most devices: creates NAT forwarding between wlan0 (STA) and wlan1 (AP), requires existing Wi-Fi connection on wlan0, hotspot IP: 192.168.43.1 (DHCP range: 192.168.43.2-254)

2.ETH+AP Mode - For devices with Ethernet port: creates NAT forwarding between eth0 and wlan1Not functional on Edge2 devices (no eth0 interface). Same hotspot IP range as STA+AP mode

3.Stop All Services - Terminates AP/DHCP/NAT services

4.Exit - Quit the script

Configuration Steps

Select operation mode from menu

For AP modes (1 or 2):

Verification

Check interface status after configuration:

ifconfig wlan0 && ifconfig wlan1

Verify internet connectivity (STA+AP mode):

ping -I wlan0 google.com

Test hotspot access:

SSID: [Your configured SSID]

Password: [Your set password]

Client IP range: 192.168.43.2-254

Important Notes

Edge2 Device Limitations:

No Ethernet interface (eth0)

ETH+AP Mode (Option 2) will not function

Use STA+AP Mode (Option 1) exclusively

Technical Details

IP Configuration:

Security:

Default channel: 6

Dependencies:

Troubleshooting

AP Not Appearing:

Confirm wlan1 interface exists

Check for conflicting services:

ps aux | grep -E 'hostapd|dnsmasq'

No Internet Access:

Verify STA connection:

iwconfig wlan0

Check NAT rules:

iptables -t nat -L -n -v

DHCP Failures:

Confirm dnsmasq running:

systemctl status dnsmasq