Skip to content
Get started

Ethernet over USB

The Ethernet component enables microcontrollers to establish a network connection over USB. The microcontroller will appear to the host computer as an Ethernet dongle. With the correct configuration, Home Assistant can reach it through the host. This establishes a wired network connection without any dedicated hardware.

Other USB functions such as the logger over USB_CDC can be used at the same time. IPv6 is supported.

The following microcontrollers are currently supported:

  • RP2040
  • RP2350
# Example configuration
rp2:
board: rpipico
ethernet:
type: usb
manual_ip:
static_ip: 192.168.137.100
gateway: 192.168.137.1
subnet: 255.255.255.0

See Ethernet for configuration variables.

Configuration depends on the operating system running on host computer.

When connecting directly to a host computer running HA OS, configuration works like this:

  1. Prepare your microcontroller by flashing ESPHome with Ethernet over USB and static ip address 192.168.137.100
  2. Visit Settings -> System -> Network and take note of the network interfaces
  3. Connect the microcontroller
  4. Reboot HA OS. Note: Restarting Home Assistant is not enough.
  5. Visit Settings -> System -> Network again. You should find a new one, for example enu1u4i2.
  6. Configure the new interface with IPv4 using “Static”.
    Add the address 192.168.137.1/24 and leave the gateway empty: the microcontroller is on the link.
  7. Optionally, use a SSH addon to run ping 192.168.137.100. It should respond.
  8. Add ESPHome integration with host 192.168.137.100

We can use Internet Connection Sharing. It provides DHCP on the 192.168.137.0/24 subnet and routing to the rest of the network using NAT (network address translation).

  1. Prepare your microcontroller by flashing ESPHome with Ethernet over USB and static ip address 192.168.137.100
  2. Disconnect the microcontroller
  3. Win + R, then type ncpa.cpl and hit Enter
  4. Connect the microcontroller again
  5. A new network connection should appear
  6. Right click your normal network connection, select Properties.
  7. Select the Sharing Tab
  8. Check the box for Allow other network users to connect through this computer’s Internet connection
  9. As Home networking connection, choose the new network connection that appeared in Step 5.
  10. Win + R, then type cmd and hit Enter
  11. ping 192.168.137.100. It should respond.
  12. Follow Connecting to Home Assistant via API.

Without manual_ip, the microcontroller may get any address in 192.168.137.0/24.

macOS needs no driver: the microcontroller appears as a new network interface.

  1. Prepare your microcontroller by flashing ESPHome with Ethernet over USB and static ip address 192.168.137.100
  2. Connect the microcontroller
  3. Open System Settings > Network and select the new interface (its name depends on the board, for example RP2040), or find it as a new en interface in ifconfig
  4. Under Details > TCP/IP, set Configure IPv4 to Manually, with IP address 192.168.137.1 and subnet mask 255.255.255.0
  5. ping 192.168.137.100. It should respond.
  6. Follow Connecting to Home Assistant via API.

WARNING

Known issue: in some boots macOS turns the device’s network interface on and right off again, because of a macOS bug that Apple is working on. The device then stays off the network until it restarts, which ESPHome does on its own when it has no connection. This only happens at startup, for example after a firmware update.

Network configuration on Linux depends on your network management software. If you don’t know which one you are running, try these commands:

  • sudo systemctl status NetworkManager
  • sudo systemctl status systemd-networkd
  • sudo systemctl status dhcpcd

One of them will be active (running).

  1. Prepare your microcontroller by flashing ESPHome with Ethernet over USB and static ip address 192.168.137.100
  2. Disconnect the microcontroller
  3. ip link to check your existing network interfaces
  4. Connect the microcontroller again
  5. ip link again, a new network interface should be listed. This example assumes usb0
  6. nmcli connection add type ethernet ifname usb0 con-name pico ipv4.method shared ipv4.addresses 192.168.137.1/24
  7. sudo iptables -A FORWARD -i usb0 -j ACCEPT (or nftables equivalent)
  8. sudo iptables -A FORWARD -o usb0 -j ACCEPT (or nftables equivalent)
  9. ping 192.168.137.100
  10. make iptables rules persistent by adding them to the files in /etc/iptables/*.rules (or nftables equivalent)
  11. Follow Connecting to Home Assistant via API.

dhcpcd cannot act as a DHCP server, so we must use static ip addresses.

  1. Prepare your microcontroller by flashing ESPHome with Ethernet over USB and static ip address 192.168.137.100
  2. Disconnect the microcontroller
  3. ip link to check your existing network interfaces
  4. Connect the microcontroller again
  5. ip link again, a new network interface should be listed. This example assumes usb0
  6. add the following to /etc/dhcpcd.conf:
interface usb0
static ip_address=192.168.137.1/24
  1. systemctl restart dhcpcd
  2. ping 192.168.137.100
  3. sudo sysctl -w net.ipv4.conf.all.forwarding=1
  4. sudo iptables -A FORWARD -i usb0 -j ACCEPT (or nftables equivalent)
  5. sudo iptables -A FORWARD -o usb0 -j ACCEPT (or nftables equivalent)
  6. sudo iptables -t nat -A POSTROUTING -s 192.168.137.0/24 ! -o usb0 -j MASQUERADE (or nftables equivalent)
  7. make iptables rules persistent by adding them to the files in /etc/iptables/*.rules (or nftables equivalent)
  8. Follow Connecting to Home Assistant via API.

The IPv4Forwarding= and IPv6Forwarding= settings below need systemd 256 or later.

  1. Prepare your microcontroller by flashing ESPHome with Ethernet over USB and static ip address 192.168.137.100
  2. Disconnect the microcontroller
  3. ip link to check your existing network interfaces
  4. Connect the microcontroller again
  5. ip link again, a new network interface should be listed. This example assumes usb0
  6. create /etc/systemd/network/pico.network with this content:
[Match]
Name=usb0
[Network]
Address=192.168.137.1/24
IPv4Forwarding=yes
IPMasquerade=yes
DHCPServer=yes
IPv6Forwarding=yes
IPv6SendRA=yes
DHCPPrefixDelegation=yes
[DHCPServer]
EmitDNS=yes
UplinkInterface=:auto
[IPv6SendRA]
EmitDNS=yes
UplinkInterface=:auto
  1. sudo iptables -A FORWARD -i usb0 -j ACCEPT (or nftables equivalent)
  2. sudo iptables -A FORWARD -o usb0 -j ACCEPT (or nftables equivalent)
  3. sudo systemctl restart systemd-networkd
  4. ping 192.168.137.100
  5. make iptables rules persistent by adding them to the files in /etc/iptables/*.rules (or nftables equivalent)
  6. Follow Connecting to Home Assistant via API.

This config will not survive a Linux reboot, but may be ok for testing.

  1. Prepare your microcontroller by flashing ESPHome with Ethernet over USB and static ip address 192.168.137.100
  2. Disconnect the microcontroller
  3. ip link to check your existing network interfaces
  4. Connect the microcontroller again
  5. ip link again, a new network interface should be listed. This example assumes usb0
  6. You can also check lsusb -t and dmesg
  7. ip link set usb0 up
  8. ip addr add 192.168.137.1/24 dev usb0
  9. ping 192.168.137.100

Once your device responds to pings, you may want to connect it to Home Assistant. If Home Assistant runs directly on the USB Host, (e.g. directly connected to a Home Assistant Green or HA OS) you can setup the ESPHome integration directly.

  1. Add ESPHome integration
  2. Host is 192.168.137.100

If Home Assistant runs on a different computer, we need to establish a connection across the NAT.
One way is to use Outgoing Connections, which need Home Assistant 2026.10.0 or later. The device dials Home Assistant on port 6054, so the USB host must route or forward it.

  1. Add an encryption key and outgoing connection to your yaml.
# Example configuration
api:
encryption:
key: !secret api_encryption_key
outgoing_connection:
host: <ip-of-your-home-assistant>
delay: 10s

You can use the key generator from the API docs.

  1. Flash the changes to your microcontroller.
  2. Build a SSH tunnel for the initial configuration, which must be an incoming connection.
    On the USB Host: ssh user@your-home-assistant-server -R 6053:192.168.137.100:6053
  3. Add ESPHome integration
  4. Host is 127.0.0.1
  5. Enter the encryption key when asked.
  6. After successful setup, stop the SSH tunnel.
  7. The connection should fail and then reestablish on its own as the outbound connection comes alive.

Connection can also be established in ways other than outgoing_connection. For example you may setup port forwarding, use Wireguard or remove the NAT and setup a static route.