disable imx8mq default eth0 dhcp

cancel
Showing results for 
Search instead for 
Did you mean: 

disable imx8mq default eth0 dhcp

1,486 Views
jheng-jhongwu
Contributor II

It seems eth0 on imx8mq evk auto gets an ip address after booting. But I cannot find /etc/network/interfaces on rootfs and there is no ip=dhcp in bootargs. How does imx8mq evk manage network interfaces? How to disable default eth0 dhcp function?

Thanks

0 Kudos
6 Replies

600 Views
igorpadykov
NXP TechSupport
NXP TechSupport

Hi Jheng-Jhong

also one can check linux documentation for ip=none

nfsroot.txt\nfs\filesystems\Documentation - linux-imx - i.MX Linux kernel 

Best regards
igor

0 Kudos

600 Views
jheng-jhongwu
Contributor II

I had tried, but dhcp still worked

0 Kudos

600 Views
marouene_boubakri
NXP Employee
NXP Employee

Dear jheng-jhongwu‌,

You can manage the network configuration using systemd.

To stop using DHCP and define a static ip address:

1. Create a file under /lib/systemd/network folder named 10-eth0.network for example and define your desired configuration:

[Match]
Name=eth0
[Network]
Address=10.0.0.100/24
Gateway=10.0.0.1‍‍‍‍‍

2. Restart systemd-networkd service

root@imx8mqevk:~# systemctl restart systemd-networkd.service‍

3. Verify

root@imx8mqevk:~# ifconfig
eth0 Link encap:Ethernet HWaddr 00:04:9f:05:69:fc
 inet addr:10.0.0.100 Bcast:10.0.0.255 Mask:255.255.255.0
 inet6 addr: fe80::204:9fff:fe05:69fc/64 Scope:Link
 UP BROADCAST RUNNING MULTICAST DYNAMIC MTU:1500 Metric:1
 RX packets:1691402 errors:0 dropped:0 overruns:0 frame:0
 TX packets:93052 errors:0 dropped:0 overruns:0 carrier:0
 collisions:0 txqueuelen:1000
 RX bytes:192346556 (183.4 MiB) TX bytes:15991089 (15.2 MiB)‍‍‍‍‍‍‍‍‍

That's all

If this reply answers your question please mark it as "correct answer".

Regards

Maro

600 Views
jheng-jhongwu
Contributor II

Finally I found I have to disable connman service. Otherwise it will force doing eth0 dhcp.

systemctl disable connman

Thanks a lot!

0 Kudos

600 Views
marouene_boubakri
NXP Employee
NXP Employee

If you want to go through connman I prefer perform configuration through it rather than disabling it.

In your board run:

# connmanctl services‍
*AR Wired ethernet_00049f04a748_cable

Then set IP parameters:

# connmanctl config ethernet_00049f04a748_cable --ipv4 manual 192.168.1.100 255.255.255.0 192.168.1.1

Verify, before and after rebooting

#ifconfig
eth0 Link encap:Ethernet HWaddr 00:04:9f:04:a7:48
 inet addr:192.168.1.100 Bcast:192.168.1.255 Mask:255.255.255.0
 inet6 addr: fe80::204:9fff:fe04:a748/64 Scope:Link
 UP BROADCAST RUNNING MULTICAST DYNAMIC MTU:1500 Metric:1
 RX packets:205 errors:0 dropped:0 overruns:0 frame:0
 TX packets:44 errors:0 dropped:0 overruns:0 carrier:0
 collisions:0 txqueuelen:1000
 RX bytes:29641 (28.9 KiB) TX bytes:7822 (7.6 KiB)

I hope this helps you

Regards

Maro

0 Kudos

600 Views
jheng-jhongwu
Contributor II

After rebooting, eth0 still gets an IP. I cannot figure out what happened... Specifically, I'd like to not assign any IP to eth0.

0 Kudos