Connected to network but no network access

Hi,

I am working on getting a network connection via the le_mdc_interface. This is done via ‘le_mdc_StartSession’ with a valid profile. When I check via the CM data tool, then is see that the modem is connected to the network (as expected). However, I don’t have any connection to the ‘outside world’. When I try to ping for example: 8.8.8.8 I get the response:
“PING 8.8.8.8 (8.8.8.8): 56 data bytes
ping: sendto: Network is unreachable”

However when I attempt to connect manually via the cm tool: cm data connect (with the same profile) then a network connection is setup and I am able to ping external addresses.
I looked through the source code of the cm data tool, but I see no significant changes that could explain this behavior.
Also when I let my application keep running, and I disconnect from the network with the cm data tool (cm data disconnect) and re-connect with the cm data tool, then all of the sudden my application can also communicate with external sources.

Am I missing some kind of additional configuration to be able to connect to external addresses?

You can try the modemdemo sample app and see if it works

Hi @BCUbing,

In additional, your test result is expected.
When using le_mdc, app have to configure the network interface, as explained in
https://docs.legato.io/latest/c_mdc.html#le_mdc_session_networkItf

It’s the application’s responsibility to configure the network interface…

Refer to sample code:
https://docs.legato.io/latest/c_mdcDataSessions.html

Or you may switch to le_data API if you want that to be done automatically.

Hope it helps.
Thx

@jyijyi
The Demo application for my legato version works via the le_data API, which is a legacy API (as far as I understand) which will propably be deprecated some time in the future.

As @lotam lotam previously suggested,
I hadn’t configured the network interface properly as stated here:
https://docs.legato.io/latest/c_mdc.html#le_mdc_session_networkItf

The disadvantage of this approach is that the application must call an external program (route) and configure a file (outside its application path: /etc/resolv.conf). The only way that I could get it to work is when the application is not sanboxed.

But other than the disadvantage stated above, after configuring the interface I have network access and it works as I would expect.