# Creating a data session while debugging

**URL:** <https://forum.legato.io/t/creating-a-data-session-while-debugging/59>\
**Category:** Legato Application Framework\
**Created:** [July 24, 2014, 8:53am UTC](https://forum.legato.io/t/creating-a-data-session-while-debugging/59 "2014-07-24T08:53:37Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![pascalbod](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.legato.io/pascalbod/32/575_2.png) [@pascalbod](https://forum.legato.io/u/pascalbod)\
**Post date:** [July 24, 2014, 8:53am UTC](https://forum.legato.io/t/creating-a-data-session-while-debugging/59/1 "2014-07-24T08:53:37Z")

</div>

Hello,

I am running the modemDemo sample application on a WP710x, using Developer Studio to display debug messages. When I sent the TestDataConnectionV4 SMS command to the application, it answered that it had failed to connect to [sierrawireless.com](http://www.sierrawireless.com).

After a rapid investigation, I discovered that once the data session is opened, the rmnet0 device is created. And routing table (as returned by ip route show) is:

> [@](#):
>
> default via 10.193.224.1 dev eth0  
> 10.0.0.0/8 dev rmnet0 src 10.41.236.52  
> 10.193.224.0/24 dev eth0 src 10.193.224.83

which means that all connection requests targeting networks other than 10.193.224.0/24 will be routed over eth0, while they should be routed over rmnet0. To be sure, I modified the routing table:

> [@](#):
>
> ip route del default  
> ip route add default via 10.141.236.53 dev rmnet0

(10.141.236.53 is the gateway address returned by the answer to the Netinfo SMS command).

And this time, the TestDataConnectionV4 worked perfectly.

Reading Modem Data Control section of Legato documentation, I didn’t find any way to specify the network interface to use, from an application. What would be the best way to do this?

---

<div class="post-metadata">

**Author:** ![pascalbod](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.legato.io/pascalbod/32/575_2.png) [@pascalbod](https://forum.legato.io/u/pascalbod)\
**Post date:** [July 24, 2014, 12:33pm UTC](https://forum.legato.io/t/creating-a-data-session-while-debugging/59/2 "2014-07-24T12:33:43Z")

</div>

Going on with my tests, I happened to reboot the WP710x. Looking at the routing table again, I got:

> [@](#):
>
> # ip route show
> 
> default via 10.31.221.193 dev rmnet0  
> 10.0.0.0/8 dev rmnet0 src 10.31.221.195  
> 10.193.224.0/24 dev eth0 src 10.193.224.218

which is correct… So what happened during my previous test? I’ll try to find out…

---

<div class="post-metadata">

**Author:** ![thibs](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.legato.io/thibs/32/420_2.png) [@thibs](https://forum.legato.io/u/thibs)\
**Post date:** [July 24, 2014, 12:59pm UTC](https://forum.legato.io/t/creating-a-data-session-while-debugging/59/3 "2014-07-24T12:59:22Z")

</div>

Salut Pascal ! I hope you’re doing well after Dev Days 🙂

So, your issue is solved, right?

.Thibault.

---

<div class="post-metadata">

**Author:** ![pascalbod](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.legato.io/pascalbod/32/575_2.png) [@pascalbod](https://forum.legato.io/u/pascalbod)\
**Post date:** [July 24, 2014, 2:05pm UTC](https://forum.legato.io/t/creating-a-data-session-while-debugging/59/4 "2014-07-24T14:05:54Z")

</div>

Salut Thibault,

Yes, thanks. And, at last, I got some time to really start playing with Legato 8)

Well, solved for now, yes. But I’ll try to reproduce what happened, if possible. I’ll update this post accordingly.

Bonne après-midi,  
P.

---

<div class="post-metadata">

**Author:** ![rio99](https://avatars.discourse-cdn.com/v4/letter/r/d78d45/32.png) [@rio99](https://forum.legato.io/u/rio99)\
**Post date:** [May 16, 2016, 1:02pm UTC](https://forum.legato.io/t/creating-a-data-session-while-debugging/59/5 "2016-05-16T13:02:04Z")

</div>

Hello, I have similar problem, when I starting session using le\_mdc\_StartSession, I have no access to Internet because of wrong gateway.  
route shows:

`Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
***.***.***.96 * 255.255.255.224 U 0 0 0 rmnet0
192.168.2.0 * 255.255.255.0 U 0 0 0 usb0
`

while le\_mdc\_GetIPv4GatewayAddress shows:  
_ **.** _.\*\*\*.113

route add default gateway _ **.** _.\*\*\*.113 solves this problem, but why the device picking wrong gateway after I call StartSession?  
Is there any way to manually set the right gateway in my code?
