cancel
Showing results for 
Search instead for 
Did you mean: 

How to configure ethernet port for direct connect and DHCP

Hammy
Associate III

I want to be able to have the Ethernet port on my board be configured as a link local address and be able to receive DHCP. How can I accomplish this?

1 ACCEPTED SOLUTION

Accepted Solutions
Hammy
Associate III

In Yocto you need to add some configurations to the systemd-networkd recipe. In <my-laye>/recipes/systemd-conf create a systemd-conf_%.bbappend. In that file add

FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:"

then make a folder called systemd-conf there and create a file called wired.network (<my-laye>/recipes/systemd-conf/systemd-conf/wired.network). Example contents might be

[Match]
Name=en* eth*
KernelCommandLine=!nfsroot
 
[Network]
DHCP=yes
LinkLocalAddressing=fallback
IPv4LLStartAddress=169.254.1.1
 
[DHCP]
RouteMetric=10
ClientIdentifier=mac
 
[DHCPv4]
MaxAttempts=3

this will overwrite the open embeded default config. You need systemd stable version 252 to get the feature IPv4LLStartAddress so we will need to patch it in since Kirkstone ecosystem 4.1 uses v250.

Create the following file <my-layer>/recipes-core/systemd/systemd_250.5.bbappend with the contents of

FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:"
 
SRC_URI += "file://0001-Enable-IPv4LLStartAddress.patch"
 

then create the following file <my-layer>/recipes-core/systemd/systemd/0001-Enable-IPv4LLStartAddress.patch with the contents from here https://pastebin.pl/view/4a9f8277

and that should do it

View solution in original post

1 REPLY 1
Hammy
Associate III

In Yocto you need to add some configurations to the systemd-networkd recipe. In <my-laye>/recipes/systemd-conf create a systemd-conf_%.bbappend. In that file add

FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:"

then make a folder called systemd-conf there and create a file called wired.network (<my-laye>/recipes/systemd-conf/systemd-conf/wired.network). Example contents might be

[Match]
Name=en* eth*
KernelCommandLine=!nfsroot
 
[Network]
DHCP=yes
LinkLocalAddressing=fallback
IPv4LLStartAddress=169.254.1.1
 
[DHCP]
RouteMetric=10
ClientIdentifier=mac
 
[DHCPv4]
MaxAttempts=3

this will overwrite the open embeded default config. You need systemd stable version 252 to get the feature IPv4LLStartAddress so we will need to patch it in since Kirkstone ecosystem 4.1 uses v250.

Create the following file <my-layer>/recipes-core/systemd/systemd_250.5.bbappend with the contents of

FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:"
 
SRC_URI += "file://0001-Enable-IPv4LLStartAddress.patch"
 

then create the following file <my-layer>/recipes-core/systemd/systemd/0001-Enable-IPv4LLStartAddress.patch with the contents from here https://pastebin.pl/view/4a9f8277

and that should do it