How can I use openconnect in the background












0















I am going to connect to a VPN using openconnect on CEntOS 7 terminal. I only have one terminal because I am on a SSH session. I need to connect to the VPN using openconnect. I do so like this:



openconnect -u username us.myprovider.net


I need to run the VPN in the background and then do other things in the foreground. Currently, I start the VPN, I press Ctrl + Z and then press bg to send it to the background. But, this seems to close the VPN connection. How can I do that?










share|improve this question



























    0















    I am going to connect to a VPN using openconnect on CEntOS 7 terminal. I only have one terminal because I am on a SSH session. I need to connect to the VPN using openconnect. I do so like this:



    openconnect -u username us.myprovider.net


    I need to run the VPN in the background and then do other things in the foreground. Currently, I start the VPN, I press Ctrl + Z and then press bg to send it to the background. But, this seems to close the VPN connection. How can I do that?










    share|improve this question

























      0












      0








      0








      I am going to connect to a VPN using openconnect on CEntOS 7 terminal. I only have one terminal because I am on a SSH session. I need to connect to the VPN using openconnect. I do so like this:



      openconnect -u username us.myprovider.net


      I need to run the VPN in the background and then do other things in the foreground. Currently, I start the VPN, I press Ctrl + Z and then press bg to send it to the background. But, this seems to close the VPN connection. How can I do that?










      share|improve this question














      I am going to connect to a VPN using openconnect on CEntOS 7 terminal. I only have one terminal because I am on a SSH session. I need to connect to the VPN using openconnect. I do so like this:



      openconnect -u username us.myprovider.net


      I need to run the VPN in the background and then do other things in the foreground. Currently, I start the VPN, I press Ctrl + Z and then press bg to send it to the background. But, this seems to close the VPN connection. How can I do that?







      vpn cisco openconnect






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked May 27 '18 at 10:56









      codezombiecodezombie

      181110




      181110






















          3 Answers
          3






          active

          oldest

          votes


















          1














          According to the Openconnect documentation, the option you would want to try would be:



          -b,--background

          Continue in background after startup





          share|improve this answer































            2














            Yes. -b is the option. But that just leads to the next issue. A clean disconnect then is not possible anymore. I mean, the only way to exit openconnect when it is in background is to kill the process. But that causes a name service problem. All dns requests are still sent to the name servers that were learned during the vpn establishment process, but they are not reachable anymore after disconnect. Only workaround is to shutdown the whole interface and take it up again.






            share|improve this answer































              0














              Finally, I came up with this solution: Run openvpn command to connect to server. Then, press CTRL+Z to stop it and then type bg to make the stopped program continue in the background. To continue running the program in foreground, you have to type fg and then you can disconnect VPN by pressing CTRL+C.






              share|improve this answer























                Your Answer








                StackExchange.ready(function() {
                var channelOptions = {
                tags: "".split(" "),
                id: "106"
                };
                initTagRenderer("".split(" "), "".split(" "), channelOptions);

                StackExchange.using("externalEditor", function() {
                // Have to fire editor after snippets, if snippets enabled
                if (StackExchange.settings.snippets.snippetsEnabled) {
                StackExchange.using("snippets", function() {
                createEditor();
                });
                }
                else {
                createEditor();
                }
                });

                function createEditor() {
                StackExchange.prepareEditor({
                heartbeatType: 'answer',
                autoActivateHeartbeat: false,
                convertImagesToLinks: false,
                noModals: true,
                showLowRepImageUploadWarning: true,
                reputationToPostImages: null,
                bindNavPrevention: true,
                postfix: "",
                imageUploader: {
                brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
                contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
                allowUrls: true
                },
                onDemand: true,
                discardSelector: ".discard-answer"
                ,immediatelyShowMarkdownHelp:true
                });


                }
                });














                draft saved

                draft discarded


















                StackExchange.ready(
                function () {
                StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f446301%2fhow-can-i-use-openconnect-in-the-background%23new-answer', 'question_page');
                }
                );

                Post as a guest















                Required, but never shown

























                3 Answers
                3






                active

                oldest

                votes








                3 Answers
                3






                active

                oldest

                votes









                active

                oldest

                votes






                active

                oldest

                votes









                1














                According to the Openconnect documentation, the option you would want to try would be:



                -b,--background

                Continue in background after startup





                share|improve this answer




























                  1














                  According to the Openconnect documentation, the option you would want to try would be:



                  -b,--background

                  Continue in background after startup





                  share|improve this answer


























                    1












                    1








                    1







                    According to the Openconnect documentation, the option you would want to try would be:



                    -b,--background

                    Continue in background after startup





                    share|improve this answer













                    According to the Openconnect documentation, the option you would want to try would be:



                    -b,--background

                    Continue in background after startup






                    share|improve this answer












                    share|improve this answer



                    share|improve this answer










                    answered May 27 '18 at 21:46









                    GracefulRestartGracefulRestart

                    1,10427




                    1,10427

























                        2














                        Yes. -b is the option. But that just leads to the next issue. A clean disconnect then is not possible anymore. I mean, the only way to exit openconnect when it is in background is to kill the process. But that causes a name service problem. All dns requests are still sent to the name servers that were learned during the vpn establishment process, but they are not reachable anymore after disconnect. Only workaround is to shutdown the whole interface and take it up again.






                        share|improve this answer




























                          2














                          Yes. -b is the option. But that just leads to the next issue. A clean disconnect then is not possible anymore. I mean, the only way to exit openconnect when it is in background is to kill the process. But that causes a name service problem. All dns requests are still sent to the name servers that were learned during the vpn establishment process, but they are not reachable anymore after disconnect. Only workaround is to shutdown the whole interface and take it up again.






                          share|improve this answer


























                            2












                            2








                            2







                            Yes. -b is the option. But that just leads to the next issue. A clean disconnect then is not possible anymore. I mean, the only way to exit openconnect when it is in background is to kill the process. But that causes a name service problem. All dns requests are still sent to the name servers that were learned during the vpn establishment process, but they are not reachable anymore after disconnect. Only workaround is to shutdown the whole interface and take it up again.






                            share|improve this answer













                            Yes. -b is the option. But that just leads to the next issue. A clean disconnect then is not possible anymore. I mean, the only way to exit openconnect when it is in background is to kill the process. But that causes a name service problem. All dns requests are still sent to the name servers that were learned during the vpn establishment process, but they are not reachable anymore after disconnect. Only workaround is to shutdown the whole interface and take it up again.







                            share|improve this answer












                            share|improve this answer



                            share|improve this answer










                            answered Jan 18 at 9:05









                            forty2forty2

                            212




                            212























                                0














                                Finally, I came up with this solution: Run openvpn command to connect to server. Then, press CTRL+Z to stop it and then type bg to make the stopped program continue in the background. To continue running the program in foreground, you have to type fg and then you can disconnect VPN by pressing CTRL+C.






                                share|improve this answer




























                                  0














                                  Finally, I came up with this solution: Run openvpn command to connect to server. Then, press CTRL+Z to stop it and then type bg to make the stopped program continue in the background. To continue running the program in foreground, you have to type fg and then you can disconnect VPN by pressing CTRL+C.






                                  share|improve this answer


























                                    0












                                    0








                                    0







                                    Finally, I came up with this solution: Run openvpn command to connect to server. Then, press CTRL+Z to stop it and then type bg to make the stopped program continue in the background. To continue running the program in foreground, you have to type fg and then you can disconnect VPN by pressing CTRL+C.






                                    share|improve this answer













                                    Finally, I came up with this solution: Run openvpn command to connect to server. Then, press CTRL+Z to stop it and then type bg to make the stopped program continue in the background. To continue running the program in foreground, you have to type fg and then you can disconnect VPN by pressing CTRL+C.







                                    share|improve this answer












                                    share|improve this answer



                                    share|improve this answer










                                    answered Jan 18 at 14:51









                                    codezombiecodezombie

                                    181110




                                    181110






























                                        draft saved

                                        draft discarded




















































                                        Thanks for contributing an answer to Unix & Linux Stack Exchange!


                                        • Please be sure to answer the question. Provide details and share your research!

                                        But avoid



                                        • Asking for help, clarification, or responding to other answers.

                                        • Making statements based on opinion; back them up with references or personal experience.


                                        To learn more, see our tips on writing great answers.




                                        draft saved


                                        draft discarded














                                        StackExchange.ready(
                                        function () {
                                        StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f446301%2fhow-can-i-use-openconnect-in-the-background%23new-answer', 'question_page');
                                        }
                                        );

                                        Post as a guest















                                        Required, but never shown





















































                                        Required, but never shown














                                        Required, but never shown












                                        Required, but never shown







                                        Required, but never shown

































                                        Required, but never shown














                                        Required, but never shown












                                        Required, but never shown







                                        Required, but never shown







                                        Popular posts from this blog

                                        How to make a Squid Proxy server?

                                        Is this a new Fibonacci Identity?

                                        19世紀