This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Check Ipsec Vpn Status by Command Cli

HI,
I would need to retrieve the following information from the XG 135 Firewall via script:
- VPN status node by node and child by child
- restart the VPN if phase2 or phase1 is down

Can you help me retrieve this information via commands?
Thank you



This thread was automatically locked due to age.
Parents
  • Hello  ,

    Thank you for reaching out to the community, you can use the following commands:
    On the CLI, select option 5. Device Management, then option 3. Advanced Shell
    >  ipsec statusall
    > service strongswan:restart -ds nosync

    Thanks & Regards,
    _______________________________________________________________

    Vivek Jagad | Team Lead, Global Support & Services 

    Log a Support Case | Sophos Service Guide
    Best Practices – Support Case


    Sophos Community | Product Documentation | Sophos Techvids | SMS
    If a post solves your question please use the 'Verify Answer' button.

  • My other question is i need to do this command by external program for example write in c#, i do without problem ssh connection, but in which way i can send command ipsec statusall , i got always % Error: Unknown Parameter, in which way i can connect on advanced shell from external program?

    Could you help me?

  • Other than this it would be difficult, ipsec statusall will display a useful information. And regarding the external program can you please show a screenshot how are you doing it ?

    Thanks & Regards,
    _______________________________________________________________

    Vivek Jagad | Team Lead, Global Support & Services 

    Log a Support Case | Sophos Service Guide
    Best Practices – Support Case


    Sophos Community | Product Documentation | Sophos Techvids | SMS
    If a post solves your question please use the 'Verify Answer' button.

  •    static void Main()

            {
        
                string host = "ip";

                string username = "admin";

                string password = "passw";



                using (var client = new SshClient(host, username, password))

                {

                    client.Connect();



                    if (client.IsConnected)

                    {

                        var commandText = "ipsec statusall";



                        var command = client.RunCommand(commandText);

                        string result = command.Result;



                        Console.WriteLine("Risultato del comando:");

                        Console.WriteLine(result);



                        client.Disconnect();

                    }

                }

            }                    

    Example of my C#  code

    what i need is:

    - send command example ipsec statusll

    - Get result

    - if ipsec down

    - restart ipsec connection

    Davide

Reply
  •    static void Main()

            {
        
                string host = "ip";

                string username = "admin";

                string password = "passw";



                using (var client = new SshClient(host, username, password))

                {

                    client.Connect();



                    if (client.IsConnected)

                    {

                        var commandText = "ipsec statusall";



                        var command = client.RunCommand(commandText);

                        string result = command.Result;



                        Console.WriteLine("Risultato del comando:");

                        Console.WriteLine(result);



                        client.Disconnect();

                    }

                }

            }                    

    Example of my C#  code

    what i need is:

    - send command example ipsec statusll

    - Get result

    - if ipsec down

    - restart ipsec connection

    Davide

Children