Where to place a bash script to check if the client is connected to the internal network on IGEL OS?

hey community, i want to build a simple bash script to check if the client is connected to the internal network or not. if not i want to establish the already configured openvpn-connection.

Learn more, read the entire thread inside the IGEL Community o Slack

the script should not be the problem, but can you assist me where to place the script? is it after network initialization oder better after network-dns oder as final netwrok command? and is it possible to put the script into that section, or should i upload the bash script to the client and call the script?

got the answer on another channel here, and this is my solution which is currently being tested:

if ifconfig eth0 | grep -i inet | sed -e ‘s/.inet addr://’ -e ‘s/Bcast.//’ | grep -vq “^10.2.” ; then /config/sessions/openvpn0 ; fi

ok, didn’t work – the pvn connection gets established and immediately is closed. any idea?

Where are you running the script?

sorry, wasn’t aware of your answer.

i tested it at several places, currently my command is used as “final network command”

still have the issue. the script is running fine when executing it in a local terminal, but when I put it into firmware customization (i tried all possible locations under “network”) it is toggling (vpn connected – vpn disconnected).

Yea, it’s because there is a 10 second timeout, so running the VPN from command line there will only run until you hit the timeout. You most likely need a custom application to run it. Unfortunately I don’t have a way to really test this in my environment so I am not sure what the solution would be

can you point me to a documentation to build a custom application?


As long as the user has rights to start it, this may be better

You can use a custom command to build the script, and call the script with the custom application

thank you very much!

but that just gives me the icon on the desktop for being started by the user, right? that is what we already have (openvpn-icon can be started by user, but that prevents ums from getting the updated ip-address and the client and fetch display configuration.

I was able to find the root cause for the behaviour. The script ran everytime a network connection has changed. At startup this is correct to start the script, check the local noetwork and decide wether to start openvpn or not..

but when openvpn-connection was established, this is a change to the network itself again and forces the script to run again. this is the reason why the vpn-connection is established and disconnected again.

with this knowledge it is easy to check in the script if already a vpn connection is established and in this case skip the script. runs perfect.

thanks to all for their knowledge, because otherwise i wouldn’t have been able to start openvpn-connection from cli at all! 😉 thx a lot!

Continue reading and comment on the thread ‘Where to place a bash script to check if the client is connected to the internal network on IGEL OS?’.  Not a member? Join Here!

Learn more, search the IGEL Knowledge Base

Ask a question or comment on the above message thread?

Join or log in to the IGEL Community to ask us anything and meet other IGEL customers, partners, and EUC enthusiasts.

Submit a question, or Join Today!

Popular Message Threads

Categories & Tags: