Community
cancel
Showing results for 
Search instead for 
Did you mean: 
RWils4
New Contributor I
1,059 Views

USB Ethernet Bridging with WiFi AP

Scenario

The Edison is configured to be a WiFi Access Point (AP) via wlan0. It is also connected to the internet with a usb-ethernet device via usb0. Users who connect to the Edison AP will not be able to browse the internet unless a bridge is made between wlan0 and usb0. We want to create the bridge and have it obtain the network configuration from DHCP over the usb-ethernet device.

These instructions configure the bridge and install a systemd service for bringing up the bridge during system boot.

All files are attached for convenience while the content of those files are also presented here just in case they become unavailable as attachments for some unforeseen reason.

There are undoubtedly alternative methods to achieve the same outcome. Let's share and discuss them

Note: The instructions were originally written in markdown, however these forums do not support it. Furthermore, using tags do not render the code blocks as expected.

Please understand I'm attempting to reformat the instructions for these forums.

Enable WiFi AP mode
  • systemctl stop wpa_supplicant.service
  • systemctl disable wpa_supplicant.service
  • systemctl enable hostapd.service
  • systemctl start hostapd.service
  • reboot
  • connect mobile device to the edison AP
  • verify ability to browse to http://edison.local/ http://edison.local

Enable USB-Ethernet bridging

autoconf -o configure configure.in &&

./configure --prefix=/usr &&

make &&

make install

  • cd /etc/systemd/network/
  • create the bridge device and network
    • vi br0.netdev

[NetDev]

Name=br0

Kind=bridge

  • vi br0.network

[Match]

Name=br0

[Network]

DHCP=ipv4

  • change usb0.network to use the bridge
    • vi usb0.network

[Match]

Name=usb0

[Network]

Bridge=br0

- make hostapd use the bridge

  • make hostapd attach wlan0 to the bridge
    • vim /etc/hostapd/hostapd.conf
      • uncomment the line for `bridge=br0`

Install systemd service for usb-ethernet bridge
  • vim /lib/systemd/system/udhcpc-for-br0.service

[Unit]

Description=udhcp client for usb ethernet bridge

Requires=hostapd.service

After=hostapd.service

StopWhenUnneeded=true

[Service]

Type=simple

ExecStart=/sbin/udhcpc -i br0 -p /var/run/udhcpc-br0.pid -S

Restart=on-failure

RestartSec=1

[Install]

WantedBy=multi-user.target

  • enable the service file
    • systemctl enable udhcpc-for-br0.service

Reboot the system and verify bridge is working
  • connect a usb ethernet device to the OTG port
  • reboot
  • brctl show

bridge name bridge id STP enabled interfaces

br0 8000.0200860edb75 no usb0

wlan0

  • ifconfig br0

br0 Link encap:Ethernet HWaddr 02:00:86:0e:db:75

inet addr:192.168.2.4 B...

Tags (2)
0 Replies
Reply