# Cm data connect persistant after reboot

**URL:** <https://forum.legato.io/t/cm-data-connect-persistant-after-reboot/6997>\
**Category:** Uncategorized\
**Created:** [February 2, 2026, 3:14pm UTC](https://forum.legato.io/t/cm-data-connect-persistant-after-reboot/6997 "2026-02-02T15:14:04Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![fsdabharati](https://avatars.discourse-cdn.com/v4/letter/f/e0b2c6/32.png) [@fsdabharati](https://forum.legato.io/u/fsdabharati)\
**Post date:** [February 2, 2026, 3:14pm UTC](https://forum.legato.io/t/cm-data-connect-persistant-after-reboot/6997/1 "2026-02-02T15:14:04Z")

</div>

I need my data connection also need to be persistant when i connect my board to laptop

for now. I am able to automate the process till NAT rules and iptables, so only i have to use ‘cm data connect’ through ssh to get internet on my laptop

but I included below in my init script still i am not able to get internet access over ethernet from mangOH yellow to my laptop  
\*\*  
cm data connect \>/dev/null 2\>&1 &\*\*

could you tell me how to make above command persistant

---

<div class="post-metadata">

**Author:** ![jyijyi](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.legato.io/jyijyi/32/822_2.png) [@jyijyi](https://forum.legato.io/u/jyijyi)\
**Post date:** [February 2, 2026, 3:42pm UTC](https://forum.legato.io/t/cm-data-connect-persistant-after-reboot/6997/2 "2026-02-02T15:42:05Z")

</div>

1. create a script startdata.sh in /home/root with the following content:

`root@swi-mdm9x28-wp:~# cat startdata.sh`  
`sleep 30`  
`/mnt/legato/system/bin/cm data connect`

1. chmod 777 /home/root/startdata.sh
2. you can test this script by “sh /home/root/startdata.sh”
3. if it is ok, open /etc/init.d/startlegato.sh and add the following line:

```auto
case “$1” in
start)
echo “Legato start sequence”

    umount /legato 2>/dev/null
    mount -o bind $LEGATO_MNT /legato

    test -x $LEGATO_START && $LEGATO_START

sh /home/root/startdata.sh &
;;

```

---

<div class="post-metadata">

**Author:** ![fsdabharati](https://avatars.discourse-cdn.com/v4/letter/f/e0b2c6/32.png) [@fsdabharati](https://forum.legato.io/u/fsdabharati)\
**Post date:** [February 3, 2026, 7:51am UTC](https://forum.legato.io/t/cm-data-connect-persistant-after-reboot/6997/3 "2026-02-03T07:51:22Z")

</div>

my startdata.sh already have below script. could you please tell me at which location i should add your given piece of code?

#!/bin/sh

sleep 10

echo 1 \> /proc/sys/net/ipv4/ip\_forward

iptables -t nat -C POSTROUTING -o rmnet\_data0 -j MASQUERADE 2\>/dev/null ||  
iptables -t nat -A POSTROUTING -o rmnet\_data0 -j MASQUERADE

iptables -C FORWARD -i ecm0 -o rmnet\_data0 -j ACCEPT 2\>/dev/null ||  
iptables -A FORWARD -i ecm0 -o rmnet\_data0 -j ACCEPT

iptables -C FORWARD -i rmnet\_data0 -o ecm0 -m state --state RELATED,ESTABLISHED -j ACCEPT 2\>/dev/null ||  
iptables -A FORWARD -i rmnet\_data0 -o ecm0 -m state --state RELATED,ESTABLISHED -j ACCEPT

exit 0

---

<div class="post-metadata">

**Author:** ![jyijyi](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.legato.io/jyijyi/32/822_2.png) [@jyijyi](https://forum.legato.io/u/jyijyi)\
**Post date:** [February 3, 2026, 7:55am UTC](https://forum.legato.io/t/cm-data-connect-persistant-after-reboot/6997/4 "2026-02-03T07:55:15Z")

</div>

maybe you can add it at the beginning of the script:

i.e.

sleep 30  
/mnt/legato/system/bin/cm data connect

sleep 10

---

<div class="post-metadata">

**Author:** ![fsdabharati](https://avatars.discourse-cdn.com/v4/letter/f/e0b2c6/32.png) [@fsdabharati](https://forum.legato.io/u/fsdabharati)\
**Post date:** [February 3, 2026, 8:11am UTC](https://forum.legato.io/t/cm-data-connect-persistant-after-reboot/6997/5 "2026-02-03T08:11:48Z")

</div>

I followed your instructions, but below command is is halted in execution.

There is also one thing which i want to highlight that when I do cm data connect then manually every time i have to type Ctrl + C to come out of execution and then data is conneted.

root@swi-mdm9x28-wp:~# chmod 777 /home/root/startdata.sh

so I am not sure if ‘cm data connect‘ itself is the problem or not because rest of the script is behaving correctly.

I did not try reboot yet as it is giving me problems in chmod itself. please guide

---

<div class="post-metadata">

**Author:** ![jyijyi](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.legato.io/jyijyi/32/822_2.png) [@jyijyi](https://forum.legato.io/u/jyijyi)\
**Post date:** [February 3, 2026, 8:31am UTC](https://forum.legato.io/t/cm-data-connect-persistant-after-reboot/6997/6 "2026-02-03T08:31:34Z")

</div>

i don’t see problem to run this script

```auto

sleep 30
/mnt/legato/system/bin/cm data connect

```

---

<div class="post-metadata">

**Author:** ![fsdabharati](https://avatars.discourse-cdn.com/v4/letter/f/e0b2c6/32.png) [@fsdabharati](https://forum.legato.io/u/fsdabharati)\
**Post date:** [February 3, 2026, 8:38am UTC](https://forum.legato.io/t/cm-data-connect-persistant-after-reboot/6997/7 "2026-02-03T08:38:52Z")

</div>

It worked with me but a little modification which is mentioned below

sleep 30  
/mnt/legato/system/bin/cm data connect &

Thank you jyijyi !!
