mangOH Red lost 192.168.2.2 IP & MT7697 Setup

Hi All,

I am running a script file through an application to bring up the wlan1 automatically.

I have inserted the below command in /etc/init.d/mtwifi(at the end of start function)
wpa_supplicant -D wext _b -i wlan1 -c your_ssid.wpa_supplicant.conf

Modified the /etc/network/interfaces
auto wlan1
iface wlan1 inet dhcp
pre-up /etc/init.d/mtwifi start uart 1
post-down /etc/init.d/mtwifi stop 1

I have tested this from command, it works.
Based on this above, created a script with a command ifup wlan1

Here are some observations.
When the script is run from a an application -

  1. IP address is assigned to wlan1 with router settings given
  2. Unable to ping to any IP address outside, not even the router IP

When the script is run from the command line (after changing the app to manual mode and a reboot)

  1. IP address is assigned to wlan1 with router settings given
  2. Pinging any IP address like google.com/8.8.8.8 works perfect.

One more observation (when script is run with in the Auto App) :-
A ping command or an ntp command within the script works fine.
If this is run out side the script (as an independent command or another script or shell), it doesn’t work…

So, I think for some reason the network configuration seems to work within the shell where the script is run. This is evident because of the ping in the script file worked well.

The whole purpose of this is to configure and set the wifi connectivity automatically and initialize the Device time (from any ntp server).

Is anything missing here?
Is there a better way to achieve the purpose?

Appreciate the support.

Thanks in advance.