How to make ip_forward as 1 by default after reboot

root@swi-mdm9x28-wp:~# cat /proc/sys/net/ipv4/ip_forward

0

I have manually set it to 1 so I can use mangOH yellow internet on my laptop. but it is again set up to 0 after reboot. now to make it persistant. is there any init script to set NAT and routing

you can add your init script here:

Could you please tell me exactly where to insert my init code?

my code is below

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

below is some last part of legato code

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                  
    ;;                                                      
                                                            
stop)                                                       
    # Do something to stop Legato                           
    echo "Legato shutdown sequence"                   
    test -x $LEGATO_START && $LEGATO_START stop       
    umount /legato                                    
    legato_cleanup                                    
    ;;                                                
                                                      
*)                                                    
    exit 1                                            
    ;;                                                

esac

echo “Finished Legato $1 Sequence”

  • /etc/init.d/startlegato.sh 60/60 100%
  1. put all your command into a script file in /home/root such as test.sh
  2. chmod 777 /home/root/test.sh
  3. test your script to make sure it works by “sh /home/root/test.sh”
  4. if it works, then next step is to open /etc/init.d/startlegato.sh and add the following line:
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/test.sh &
;;


can you open a new topic?