Ip over USB works only with a second cable connection

I can use a USB0 interface and assigned with connman a static ip.
Everything works good. I mean I can ping and connect throught ssh, until I disconnect ethernet cable.
At this point either ethernet and usb connection drop down and I cannot connect anymore without reboot all system.
Could you please explain me how to avoid this?
Below command and status:

root@b2qt-colibri-imx7-emmc:~# connmanctl services
*AR Wired                ethernet_00142d6267fc_cable
*   Wired                gadget_000000000000_usb
root@b2qt-colibri-imx7-emmc:~# ip link show
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: eth0: <BROADCAST,MULTICAST,DYNAMIC,UP,LOWER_UP> mtu 1500 qdisc mq state UP mode DEFAULT group default qlen 1000
    link/ether 00:14:2d:62:67:fc brd ff:ff:ff:ff:ff:ff
3: usb0: <BROADCAST,MULTICAST,DYNAMIC,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP mode DEFAULT group default qlen 1000
    link/ether ca:d2:2e:91:46:3b brd ff:ff:ff:ff:ff:ff
root@b2qt-colibri-imx7-emmc:~# connmanctl config gadget_000000000000_usb --ipv4 manual 192.168.1.118 255.255.255.0 192.168.1.1
root@b2qt-colibri-imx7-emmc:~# connmanctl connect gadget_000000000000_usb
Connected gadget_000000000000_usb
root@b2qt-colibri-imx7-emmc:~# ifconfig
eth0      Link encap:Ethernet  HWaddr 00:14:2D:62:67:FC
          inet addr:192.168.1.115  Bcast:192.168.1.255  Mask:255.255.255.0
          inet6 addr: fe80::214:2dff:fe62:67fc/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:2885 errors:0 dropped:0 overruns:0 frame:0
          TX packets:1158 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:262381 (256.2 KiB)  TX bytes:193054 (188.5 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:39600 errors:0 dropped:0 overruns:0 frame:0
              TX packets:39600 errors:0 dropped:0 overruns:0 carrier:0
              collisions:0 txqueuelen:1
              RX bytes:2851520 (2.7 MiB)  TX bytes:2851520 (2.7 MiB)
    
    usb0      Link encap:Ethernet  HWaddr CA:D2:2E:91:46:3B
              inet addr:192.168.1.118  Bcast:192.168.1.255  Mask:255.255.255.0
              inet6 addr: fe80::c8d2:2eff:fe91:463b/64 Scope:Link
              UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
              RX packets:491 errors:0 dropped:0 overruns:0 frame:0
              TX packets:36 errors:0 dropped:0 overruns:0 carrier:0
              collisions:0 txqueuelen:1000
              RX bytes:42881 (41.8 KiB)  TX bytes:4444 (4.3 KiB)
 
    root@b2qt-colibri-imx7-emmc:~# route
    Kernel IP routing table
    Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
    default         192.168.1.1     0.0.0.0         UG    0      0        0 eth0
    192.168.1.0     *               255.255.255.0   U     0      0        0 eth0
    192.168.1.0     *               255.255.255.0   U     0      0        0 usb0
    192.168.1.1     *               255.255.255.255 UH    0      0        0 usb0
    192.168.1.1     *               255.255.255.255 UH    0      0        0 eth0
    root@b2qt-colibri-imx7-emmc:~#

HI @andreat

Thanks for writing to the Toradex Community!

What exactly are you trying to do?
What is your application?

usb0 is a RNDIS Interface, where the IP address is preset. You should use Ethernet Interface for Ethernet communication.

Best regards,
Jaski

Thank you for reply.

You should use Ethernet Interface for Ethernet communication.

I didn’t write before, so I am going to explain.

If I have a virtual ethernet interface (RNDIS interface) I want to use it for an application which required ethernet interface (like a web server).
On our future board(and not now which I tried an Evaluation board) we have to remove ethernet physical interface.

The point is simple: Why this usb virtualization (which I tested it is connected with the usb cable, disconnected it and checked that also interface lose the connection) looks also connected to my physical ethernet cable?

You are welcome. Thanks for the explanation.

Does this happen too if you don’t assign static address to the usb0 interface?

Best regards,
Jaski

Does this happen too if you don’t assign static address to the usb0 interface?

If I don’t have a static address assigned, I cannot connect to the target.
As I wrote, the link at physical layer is ok. See ip link show above

I think it is possible to check easily, does it happen to you too?

BR,
Andrea

Hi Andrea

If I don’t have a static address assigned, I cannot connect to the target. As I wrote, the link at physical layer is ok. See ip link show above

I can use a USB0 interface and assigned with connman a static ip.

This is what you wrote above. this is the output of ifconfig tested on regular Bsp 2.8b6 release:

root@colibri-imx7-emmc:~# ifconfig
eth0      Link encap:Ethernet  HWaddr 00:14:2D:2D:3E:E6
          inet addr:192.168.10.32  Bcast:192.168.10.255  Mask:255.255.255.0
          inet6 addr: fe80::214:2dff:fe2d:3ee6%lo/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:42 errors:0 dropped:0 overruns:0 frame:0
          TX packets:114 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:5052 (4.9 KiB)  TX bytes:18993 (18.5 KiB)

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1%1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:234 errors:0 dropped:0 overruns:0 frame:0
          TX packets:234 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1
          RX bytes:17200 (16.7 KiB)  TX bytes:17200 (16.7 KiB)

usb0      Link encap:Ethernet  HWaddr 00:14:2D:FF:FF:FF
          inet addr:192.168.11.1  Bcast:192.168.11.255  Mask:255.255.255.0
          inet6 addr: fe80::214:2dff:feff:ffff%lo/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:69 errors:0 dropped:0 overruns:0 frame:0
          TX packets:52 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:8849 (8.6 KiB)  TX bytes:11161 (10.8 KiB)

I cannot reproduce your issue. In my case, if i disconnect the Rndis Interface, then this Interface cannot be pinged, but still the Ethernet interface. And if disconnect if I disconnect the Ethernet Interface, then this Interface cannot be pinged, but still the RNDIS interface.

Best regards,
Jaski

Ok, simple divide the answer… I didn’t get your point.

if i disconnect the Rndis Interface, then this Interface cannot be pinged, but still the Ethernet interface.
Ok, this is same behavior

And if disconnect if I disconnect the Ethernet Interface, then this Interface cannot be pinged, but still the RNDIS interface1. If you disconnect Ethernet interface this is not pinged, but still the RNDIS interface
You mean that you can still ping and did you try to connect through USB for example with an ssh?

Could you please put all your steps and the message kernel? I already showed mine. I’d like to know since your boot-up, thank you.
Including route command

Hi

Ok, simple divide the answer… I didn’t get your point.

Same here.

You mean that you can still ping and did you try to connect through USB for example with an ssh?

Yes, this works perfectly. Please find the dmesg.log and the output of the command route here.

Best regards,
Jaski

Thank you for reply.
Ok, there is a first very trivial difference.
As you mentioned you are using the Lxde Image 2.8b6, but
I am using the kernel 2.8b5 following this:

I want have the same starting point to avoid silly mistake. How can I recompile the kernel with version 2.8b6?
Let me know.

Hi

You are welcome. Starting for Bsp. 2.8b5, we are using the kernel branch 4.9.2.3 so your kernel should be similar to mine.

Could you install a clean regular Bsp 2.8b6 and try to reproduce the issue?

Best regards,
Jaski

Thank you. I can try, but which is the commit of 2.8b6?
I didn’t find here:

You need to check here.