The ETH class enables the use of an ethernet connection via the PyEthernet board plugged into a Pygate.

NOTE : Ethernet support is only available in the Pygate firmware build.

NOTE2 : The PyEthernet board is connected via SPI bus 3 and GPIO’s 17-19 and 21-23. So this bus and pins cannot be used concurrently with ethernet. This also means that on a LoPy4 with Pygate firmware, the LoRa module of the LoPy4 is disabled, since it is also connected via SPI 3. Of course you can still use the LoRa gateway functionality since this uses the LoRa modules on the the Pygate board itself.


class network.ETH([id=0], …)

Create and configure an ETH object. See init for params of configuration.

from network import ETH
eth = ETH()



This function starts the Ethernet interface and enables the ethernet adapter.

hostname: set the interface hostname

eth.ifconfig([config={‘dhcp’ / configtuple}])

Get or set the interface configuration.

Optionally specify the configuration parameter:

  • config='dhcp': If ‘dhcp’ is passed as a parameter, then the DHCP client is enabled and the IP parameters are negotiated with the DHCP server.
  • config=(ip, nm, gw, dns): If the 4-tuple config is given then a static IP is configured.

For example: eth.ifconfig(config=('', '', '', '')).


Set the interface host name.


Get the ethernet interface mac address.


Shut down the ethernet interface.


Return True if the ethernet link is up and IP is acquired, False otherwise.