DOUBLE NETWORK PORT BRIDGE TEST


1. Double Network Port Bridging Method

  1. Dual wired network ports. One access network and another access device;

  2. Dual wireless network ports. One access network in STA mode and another opens AP mode to create a hotspot for devices to access;

  3. One wired network port access network, and one wireless network port opens AP mode to create a hotspot for devices to access;

  4. One wired network port access device, and one wireless network port access network in STA mode.


2. Kernel Config

Set the following options in the kernel config:

Networking support -> Wireless:
    <*> cfg80211 - wireless configuration API


Device Drivers->Generic Driver options
    [*] Support for uevent helper


Networking support  Networking options
    <*> 802.1d Ethernet Bridging

3. Bridge Test

Before establishing a bridge, confirm whether the network port can work normally. If using Wi-Fi, confirm that the wifi driver is loaded normally.

You can use ifconfig -a to view the node name of the network port device.

3.1. Bridge Method

Bridge Method Pre-Network port Post-Network port Configure Wi-Fi STA Establish a bridge Configure Wi-Fi AP
Dual wired network ports eth0 eth1 × ×
Dual wireless network ports wlan0 p2p0
Wired network port + wireless network port, Wi-Fi access wlan0 eth0 ×
Wired network port + wireless network port, wired network port access eth0 p2p0 ×

3.2. Configure Wi-Fi STA Environment

3.2.1. Access Hotspot With Wi-Fi Config

Edit /appconfigs/wpa_supplicant.conf to add connectable hotspots. Take adding a hotspot named "EnglishName" as an example:

ctrl_interface=/customer/profile/wpa_supplicant
update_config=1

network={
    ssid="EnglishName"
    psk="12345678"
}

3.2.2. Hotspot Connection

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib:/lib:/config/wifi
ifconfig wlan0 up
./wpa_supplicant  -Dnl80211 -i wlan0 -c /appconfigs/wpa_supplicant.conf -d &
udhcpc  -q -i wlan0 -s /etc/init.d/udhcpc.script &

3.3. Configure Wi-Fi AP Environment

3.3.1. Configure Hotspots With Wi-Fi

Edit config/wifi/hostapd.conf: set "ssw101bap" as the hotspot name and password as "12345678". To modify the hotspot name and password, you can edit "ssid" and "wpa_passphrase".

interface=p2p0
ctrl_interface=/var/run/hostapd
ctrl_interface_group=0
driver=nl80211
ssid=ssw101bap
hw_mode=g
channel=4
macaddr_acl=0
auth_algs=1
ignore_broadcast_ssid=0
wpa=3
wpa_passphrase=12345678
wpa_key_mgmt=WPA-PSK
wpa_pairwise=TKIP
rsn_pairwise=CCMP

3.3.2. Configure Hotspots

touch /appconfigs/hosts
mkdir -p /appconfigs/misc/wifi/
mkdir -p /var/wifi/misc/
mkdir -p /var/lib/misc/
mkdir -p /var/run/hostapd/
udhcpc -S /etc/init.d/udhcpc.script -i br0

./hostapd -B /config/wifi/hostapd.conf
./dnsmasq -i p2p0 --no-daemon -C /config/wifi/dnsmasq.conf &

3.4. Establish A Bridge

ifconfig [Pre-Network port] up
ifconfig [Post-Network port] up
ifconfig [Pre-Network port] 0.0.0.0
ifconfig [Post-Network port] 0.0.0.0
brctl addbr br0
brctl addif br0 [Pre-Network port]
brctl addif br0 [Post-Network port]
ifconfig br0 up

Successfully establish a dual network port bridging mode.