How to stop eth0 ip route allocation

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to stop eth0 ip route allocation

1,011 Views
mashaofeng
Contributor III

when imx8 started , we can see it's route and ifconfig configuration is

 

Destination     Gateway         Genmask         Flags Metric Ref    Use Iface

0.0.0.0         192.168.1.1     0.0.0.0         UG    0      0        0 br0

192.168.1.0     0.0.0.0         255.255.255.0   U     0      0        0 br0

root@imx8qxpmek:~# ifconfig

br0       Link encap:Ethernet  HWaddr 1e:a3:e1:e8:c8:cd 

          inet addr:192.168.1.18  Bcast:192.168.1.255  Mask:255.255.255.0

          inet6 addr: fe80::d45f:9fff:fe62:de10/64 Scope:Link

          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1

          RX packets:123 errors:0 dropped:0 overruns:0 frame:0

          TX packets:23 errors:0 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:1000

          RX bytes:13012 (12.7 KiB)  TX bytes:1334 (1.3 KiB)

 

eth0      Link encap:Ethernet  HWaddr be:dc:ce:a6:21:3f 

          inet6 addr: fe80::bcdc:ceff:fea6:213f/64 Scope:Link

          UP BROADCAST RUNNING MULTICAST DYNAMIC  MTU:1500  Metric:1

          RX packets:0 errors:0 dropped:0 overruns:0 frame:0

          TX packets:150 errors:0 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:1000

          RX bytes:0 (0.0 B)  TX bytes:18518 (18.0 KiB)

 

lo        Link encap:Local Loopback 

          inet addr:127.0.0.1  Mask:255.0.0.0

          inet6 addr: ::1/128 Scope:Host

          UP LOOPBACK RUNNING  MTU:65536  Metric:1

          RX packets:119 errors:0 dropped:0 overruns:0 frame:0

          TX packets:119 errors:0 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:1000

          RX bytes:11444 (11.1 KiB)  TX bytes:11444 (11.1 KiB)

 

usb0      Link encap:Ethernet  HWaddr 1e:a3:e1:e8:c8:cd 

          inet6 addr: fe80::1ca3:e1ff:fee8:c8cd/64 Scope:Link

          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1

          RX packets:128 errors:0 dropped:4 overruns:0 frame:0

          TX packets:2 errors:0 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:1000

          RX bytes:13339 (13.0 KiB)  TX bytes:268 (268.0 B)

 

 

but after few seconds (0 to 30 second),it  will change to follow status:

 

Destination     Gateway         Genmask         Flags Metric Ref    Use Iface

0.0.0.0         0.0.0.0         0.0.0.0         U     0      0        0 eth0

0.0.0.0         192.168.1.1     0.0.0.0         UG    0      0        0 br0

169.254.0.0     0.0.0.0         255.255.0.0     U     0      0        0 eth0

192.168.1.0     0.0.0.0         255.255.255.0   U     0      0        0 br0

root@imx8qxpmek:~# ifconfig

br0       Link encap:Ethernet  HWaddr 1e:a3:e1:e8:c8:cd 

          inet addr:192.168.1.18  Bcast:192.168.1.255  Mask:255.255.255.0

          inet6 addr: fe80::d45f:9fff:fe62:de10/64 Scope:Link

          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1

          RX packets:123 errors:0 dropped:0 overruns:0 frame:0

          TX packets:67 errors:0 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:1000

          RX bytes:13012 (12.7 KiB)  TX bytes:3238 (3.1 KiB)

 

eth0      Link encap:Ethernet  HWaddr be:dc:ce:a6:21:3f 

          inet addr:169.254.97.105  Bcast:169.254.255.255  Mask:255.255.0.0

          inet6 addr: fe80::bcdc:ceff:fea6:213f/64 Scope:Link

          UP BROADCAST RUNNING MULTICAST DYNAMIC  MTU:1500  Metric:1

          RX packets:0 errors:0 dropped:0 overruns:0 frame:0

          TX packets:203 errors:0 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:1000

          RX bytes:0 (0.0 B)  TX bytes:21952 (21.4 KiB)

 

lo        Link encap:Local Loopback 

          inet addr:127.0.0.1  Mask:255.0.0.0

          inet6 addr: ::1/128 Scope:Host

          UP LOOPBACK RUNNING  MTU:65536  Metric:1

          RX packets:225 errors:0 dropped:0 overruns:0 frame:0

          TX packets:225 errors:0 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:1000

          RX bytes:21078 (20.5 KiB)  TX bytes:21078 (20.5 KiB)

 

usb0      Link encap:Ethernet  HWaddr 1e:a3:e1:e8:c8:cd 

          inet6 addr: fe80::1ca3:e1ff:fee8:c8cd/64 Scope:Link

          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1

          RX packets:128 errors:0 dropped:4 overruns:0 frame:0

          TX packets:2 errors:0 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:1000

          RX bytes:13339 (13.0 KiB)  TX bytes:268 (268.0 B)

 

root@imx8qxpmek:~#

the follow route have bad influence to our product 

0.0.0.0         0.0.0.0         0.0.0.0         U     0      0        0 eth0

169.254.0.0     0.0.0.0         255.255.0.0     U     0      0        0 eth0

i try to delete the route    , but the first one can not be delelted;

how to stop route allocation for eth0 ?  

0 Kudos
4 Replies

951 Views
jimmychan
NXP TechSupport
NXP TechSupport

You may set a fix IP to it

0 Kudos

951 Views
mashaofeng
Contributor III

from the follow link on nxp community

disable imx8mq default eth0 dhcp 

use "     systemctl disable connman  "   can make eth0 dhcp stop

but the first bringup of the board will have issue;

it seems we must delete connman.service when compile ;

i cannot sure whether it have other influence;

thanks

0 Kudos

951 Views
jimmychan
NXP TechSupport
NXP TechSupport

Have you try to set the IP in u-boot bootargs?

e.g.  (https://community.nxp.com/message/866455?commentID=866455#comment-866455 )

setenv bootargs ${bootargs} ip=${ipaddr}:${serverip}:${gateway}:${netmask}::eth0

0 Kudos

951 Views
mashaofeng
Contributor III

i add fix ip to it , but it's still have new ip route  :

root@imx8qxpmek:/# route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         192.168.1.1     0.0.0.0         UG    0      0        0 eth0
0.0.0.0         0.0.0.0         0.0.0.0         U     0      0        0 eth0
169.254.0.0     0.0.0.0         255.255.0.0     U     0      0        0 eth0
192.168.1.0     0.0.0.0         255.255.255.0   U     0      0        0 eth0
192.168.1.0     0.0.0.0         255.255.255.0   U     0      0        0 br0

root@imx8qxpmek:/# ifconfig
br0       Link encap:Ethernet  HWaddr 3e:f2:d4:d1:61:10 
          inet addr:192.168.1.18  Bcast:192.168.1.255  Mask:255.255.255.0
          inet6 addr: fe80::3cf2:d4ff:fed1:6110/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:248 errors:0 dropped:0 overruns:0 frame:0
          TX packets:14 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:27349 (26.7 KiB)  TX bytes:1140 (1.1 KiB)
eth0      Link encap:Ethernet  HWaddr 3e:f2:d4:d1:61:10 
          inet addr:192.168.1.66  Bcast:192.168.1.255  Mask:255.255.255.0
          inet6 addr: fe80::3cf2:d4ff:fed1:6110/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST DYNAMIC  MTU:1500  Metric:1
          RX packets:248 errors:0 dropped:0 overruns:0 frame:0
          TX packets:97 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:32309 (31.5 KiB)  TX bytes:8534 (8.3 KiB)
lo        Link encap:Local Loopback 
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:36899 errors:0 dropped:0 overruns:0 frame:0
          TX packets:36899 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:2651084 (2.5 MiB)  TX bytes:2651084 (2.5 MiB)
usb0      Link encap:Ethernet  HWaddr f6:4b:61:00:11:f1 
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

we use follow service to control net configuration :

[Unit]
Description=dias network configuration
After=network.target
DefaultDependencies=yes
[Service]
ExecStart=/bin/bash -c "/sbin/ip addr add 0/32 dev eth0 \
                      ifconfig eth0 netmask 255.255.255.0 broadcast 192.168.1.255 0 up; \
                      echo \"nameserver 114.114.114.114\" > /etc/resolv.conf; \
                      echo \"nameserver 8.8.8.8\" >> /etc/resolv.conf; \
                      ifconfig usb0 netmask 255.255.255.0 broadcast 192.168.1.255 0 up; \
                      ifconfig eth0 down; ifconfig eth0 192.168.1.66 up; ifconfig usb0 down; ifconfig usb0 0 up; \
                      brctl addbr br0; brctl addif br0 eth0; brctl addif br0 usb0; ifconfig br0 192.168.1.18 up; \
                      sleep 45 && route add default gw 192.168.1.1; \
        "

[Install]
WantedBy=multi-user.target
thanks
0 Kudos