Starting SSH server after VPN starts Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern) 2019 Community Moderator Election Results Why I closed the “Why is Kali so hard” questionSSH Server on Ubuntu not worksHow does OpenVPN server assign client IP addresses in case of multiclient configuration?ssh into a server which is connected to a VPN serviceConnect to Ubuntu Server through SSH over the internetPort forwarding to two different VPN clients on the same serverSSH server also runs OpenVPN client - Inbound SSH times outAllow SSH connection not using my VPNAble to ssh into OpenVPN server after establishing VPN tunnel, but unable to connect to other machines on my server side LAN or on the InternetCannot create OpenSSH tunnelAccess LAN computers via VPN connection
Apollo command module space walk?
Identifying polygons that intersect with another layer using QGIS?
List *all* the tuples!
Output the ŋarâþ crîþ alphabet song without using (m)any letters
Fundamental Solution of the Pell Equation
When do you get frequent flier miles - when you buy, or when you fly?
Why did the rest of the Eastern Bloc not invade Yugoslavia?
How can I make names more distinctive without making them longer?
At the end of Thor: Ragnarok why don't the Asgardians turn and head for the Bifrost as per their original plan?
2001: A Space Odyssey's use of the song "Daisy Bell" (Bicycle Built for Two); life imitates art or vice-versa?
How would the world control an invulnerable immortal mass murderer?
How does the particle を relate to the verb 行く in the structure「A を + B に行く」?
How do I stop a creek from eroding my steep embankment?
Check which numbers satisfy the condition [A*B*C = A! + B! + C!]
Why is my conclusion inconsistent with the van't Hoff equation?
How to tell that you are a giant?
Is there a program I can run on the C64 to speed up booting of a game?
What is the meaning of the new sigil in Game of Thrones Season 8 intro?
Can a non-EU citizen traveling with me come with me through the EU passport line?
Do I really need recursive chmod to restrict access to a folder?
Storing hydrofluoric acid before the invention of plastics
How to react to hostile behavior from a senior developer?
Is the Standard Deduction better than Itemized when both are the same amount?
How to align text above triangle figure
Starting SSH server after VPN starts
Announcing the arrival of Valued Associate #679: Cesar Manara
Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern)
2019 Community Moderator Election Results
Why I closed the “Why is Kali so hard” questionSSH Server on Ubuntu not worksHow does OpenVPN server assign client IP addresses in case of multiclient configuration?ssh into a server which is connected to a VPN serviceConnect to Ubuntu Server through SSH over the internetPort forwarding to two different VPN clients on the same serverSSH server also runs OpenVPN client - Inbound SSH times outAllow SSH connection not using my VPNAble to ssh into OpenVPN server after establishing VPN tunnel, but unable to connect to other machines on my server side LAN or on the InternetCannot create OpenSSH tunnelAccess LAN computers via VPN connection
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
I am running an OpenVPN server on Ubuntu 14.04 as well as OpenSSH.
I have my SSH server configured to bind to an IP address on my VPN interface. Once my machine boots, binding to that IP fails.
Once I log in, can see with netstat that sshd is not listening. I am able to restart sshd and the machine will start listening properly. The IP on my VPN is the only IP I have configured sshd to listen on.
At Boot:
sshd[1016]: Set /proc/self/oom_score_adj from 0 to -1000
sshd[1016]: error: Bind to port 22 on 10.8.0.1 failed: Cannot assign requested address.
sshd[1016]: fatal: Cannot bind any address.Restart SSH:
sshd[3481]: Set /proc/self/oom_score_adj from 0 to -1000
sshd[3481]: Server listening on 10.8.0.1 port 22.My best guess is that sshd is starting before my VPN is up and running. Is there a way I am able to ensure sshd starts afterwards so it can bind properly?
Any suggestions about what to do or check?
vpn openvpn openssh sshd
add a comment |
I am running an OpenVPN server on Ubuntu 14.04 as well as OpenSSH.
I have my SSH server configured to bind to an IP address on my VPN interface. Once my machine boots, binding to that IP fails.
Once I log in, can see with netstat that sshd is not listening. I am able to restart sshd and the machine will start listening properly. The IP on my VPN is the only IP I have configured sshd to listen on.
At Boot:
sshd[1016]: Set /proc/self/oom_score_adj from 0 to -1000
sshd[1016]: error: Bind to port 22 on 10.8.0.1 failed: Cannot assign requested address.
sshd[1016]: fatal: Cannot bind any address.Restart SSH:
sshd[3481]: Set /proc/self/oom_score_adj from 0 to -1000
sshd[3481]: Server listening on 10.8.0.1 port 22.My best guess is that sshd is starting before my VPN is up and running. Is there a way I am able to ensure sshd starts afterwards so it can bind properly?
Any suggestions about what to do or check?
vpn openvpn openssh sshd
There most likely is, but it will largely depend on your OS/distro. Please edit your question w/ that piece of information.
– tink
Jul 17 '14 at 4:08
I have included it. It is on the first line. I am running Ubuntu 14.04.
– ehaydenr
Jul 17 '14 at 4:09
add a comment |
I am running an OpenVPN server on Ubuntu 14.04 as well as OpenSSH.
I have my SSH server configured to bind to an IP address on my VPN interface. Once my machine boots, binding to that IP fails.
Once I log in, can see with netstat that sshd is not listening. I am able to restart sshd and the machine will start listening properly. The IP on my VPN is the only IP I have configured sshd to listen on.
At Boot:
sshd[1016]: Set /proc/self/oom_score_adj from 0 to -1000
sshd[1016]: error: Bind to port 22 on 10.8.0.1 failed: Cannot assign requested address.
sshd[1016]: fatal: Cannot bind any address.Restart SSH:
sshd[3481]: Set /proc/self/oom_score_adj from 0 to -1000
sshd[3481]: Server listening on 10.8.0.1 port 22.My best guess is that sshd is starting before my VPN is up and running. Is there a way I am able to ensure sshd starts afterwards so it can bind properly?
Any suggestions about what to do or check?
vpn openvpn openssh sshd
I am running an OpenVPN server on Ubuntu 14.04 as well as OpenSSH.
I have my SSH server configured to bind to an IP address on my VPN interface. Once my machine boots, binding to that IP fails.
Once I log in, can see with netstat that sshd is not listening. I am able to restart sshd and the machine will start listening properly. The IP on my VPN is the only IP I have configured sshd to listen on.
At Boot:
sshd[1016]: Set /proc/self/oom_score_adj from 0 to -1000
sshd[1016]: error: Bind to port 22 on 10.8.0.1 failed: Cannot assign requested address.
sshd[1016]: fatal: Cannot bind any address.Restart SSH:
sshd[3481]: Set /proc/self/oom_score_adj from 0 to -1000
sshd[3481]: Server listening on 10.8.0.1 port 22.My best guess is that sshd is starting before my VPN is up and running. Is there a way I am able to ensure sshd starts afterwards so it can bind properly?
Any suggestions about what to do or check?
vpn openvpn openssh sshd
vpn openvpn openssh sshd
edited Jul 17 '14 at 12:50
Patrick
51.6k11134183
51.6k11134183
asked Jul 17 '14 at 3:17
ehaydenrehaydenr
3115
3115
There most likely is, but it will largely depend on your OS/distro. Please edit your question w/ that piece of information.
– tink
Jul 17 '14 at 4:08
I have included it. It is on the first line. I am running Ubuntu 14.04.
– ehaydenr
Jul 17 '14 at 4:09
add a comment |
There most likely is, but it will largely depend on your OS/distro. Please edit your question w/ that piece of information.
– tink
Jul 17 '14 at 4:08
I have included it. It is on the first line. I am running Ubuntu 14.04.
– ehaydenr
Jul 17 '14 at 4:09
There most likely is, but it will largely depend on your OS/distro. Please edit your question w/ that piece of information.
– tink
Jul 17 '14 at 4:08
There most likely is, but it will largely depend on your OS/distro. Please edit your question w/ that piece of information.
– tink
Jul 17 '14 at 4:08
I have included it. It is on the first line. I am running Ubuntu 14.04.
– ehaydenr
Jul 17 '14 at 4:09
I have included it. It is on the first line. I am running Ubuntu 14.04.
– ehaydenr
Jul 17 '14 at 4:09
add a comment |
2 Answers
2
active
oldest
votes
I found a solution.
In the OpenVPN configuration file /etc/openvpn/server.conf you can specify a script to run on up. If you take a look at the OpenVPN manual page man openvpn, you will see --up cmd. In the /etc/openvpn/server.conf configuration file, I added a line:
up "/etc/openvpn/up.sh"
This file is one that I created and will be executed when the VPN starts. Right now, mine looks like this:
#!/bin/sh
logger VPN is UP
service ssh restart
Now, every time my OpenVPN server starts up, it will also restart the OpenSSH server as well. Likewise, I am able to also use --down cmd and specify a file in the server configuration file if I wish to have a script executed when the server is shutdown.
You can read more about these in the OpenVPN manual page - man openvpn
How did you set up SSH to bind to the VPN interface?
– JB0x2D1
Oct 2 '14 at 17:21
@JB0x2D1 I achieved it without actually binding the interface. I bound it to the IP address i knew my machine would be on after connecting to the VPN. In this case, I was hosting the VPN so I knew what ip my machine (The VPN server) would have inside the VPN. From there, you just have ssh only listen on that ip address. I am not sure whether this is 100% reliable. It was for me, but i would imagine interface binding would be better. Please comment if you learn how to bind.
– ehaydenr
Oct 2 '14 at 18:05
Thanks. I think the problem is with my client. I can connect to the VPN then run SSH with no problems on one client but not with another. The problem client is running Lubuntu
– JB0x2D1
Oct 2 '14 at 18:10
add a comment |
Looks like ssh uses upstart, but openvpn doesn't ... you might be able to force ssh to come up delayed by doing this, but it's untested (I don't want to mess up my install):
update-rc.d ssh defaults 99
And as it's untested: CAVEAT EMPTOR
add a comment |
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
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f144992%2fstarting-ssh-server-after-vpn-starts%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
I found a solution.
In the OpenVPN configuration file /etc/openvpn/server.conf you can specify a script to run on up. If you take a look at the OpenVPN manual page man openvpn, you will see --up cmd. In the /etc/openvpn/server.conf configuration file, I added a line:
up "/etc/openvpn/up.sh"
This file is one that I created and will be executed when the VPN starts. Right now, mine looks like this:
#!/bin/sh
logger VPN is UP
service ssh restart
Now, every time my OpenVPN server starts up, it will also restart the OpenSSH server as well. Likewise, I am able to also use --down cmd and specify a file in the server configuration file if I wish to have a script executed when the server is shutdown.
You can read more about these in the OpenVPN manual page - man openvpn
How did you set up SSH to bind to the VPN interface?
– JB0x2D1
Oct 2 '14 at 17:21
@JB0x2D1 I achieved it without actually binding the interface. I bound it to the IP address i knew my machine would be on after connecting to the VPN. In this case, I was hosting the VPN so I knew what ip my machine (The VPN server) would have inside the VPN. From there, you just have ssh only listen on that ip address. I am not sure whether this is 100% reliable. It was for me, but i would imagine interface binding would be better. Please comment if you learn how to bind.
– ehaydenr
Oct 2 '14 at 18:05
Thanks. I think the problem is with my client. I can connect to the VPN then run SSH with no problems on one client but not with another. The problem client is running Lubuntu
– JB0x2D1
Oct 2 '14 at 18:10
add a comment |
I found a solution.
In the OpenVPN configuration file /etc/openvpn/server.conf you can specify a script to run on up. If you take a look at the OpenVPN manual page man openvpn, you will see --up cmd. In the /etc/openvpn/server.conf configuration file, I added a line:
up "/etc/openvpn/up.sh"
This file is one that I created and will be executed when the VPN starts. Right now, mine looks like this:
#!/bin/sh
logger VPN is UP
service ssh restart
Now, every time my OpenVPN server starts up, it will also restart the OpenSSH server as well. Likewise, I am able to also use --down cmd and specify a file in the server configuration file if I wish to have a script executed when the server is shutdown.
You can read more about these in the OpenVPN manual page - man openvpn
How did you set up SSH to bind to the VPN interface?
– JB0x2D1
Oct 2 '14 at 17:21
@JB0x2D1 I achieved it without actually binding the interface. I bound it to the IP address i knew my machine would be on after connecting to the VPN. In this case, I was hosting the VPN so I knew what ip my machine (The VPN server) would have inside the VPN. From there, you just have ssh only listen on that ip address. I am not sure whether this is 100% reliable. It was for me, but i would imagine interface binding would be better. Please comment if you learn how to bind.
– ehaydenr
Oct 2 '14 at 18:05
Thanks. I think the problem is with my client. I can connect to the VPN then run SSH with no problems on one client but not with another. The problem client is running Lubuntu
– JB0x2D1
Oct 2 '14 at 18:10
add a comment |
I found a solution.
In the OpenVPN configuration file /etc/openvpn/server.conf you can specify a script to run on up. If you take a look at the OpenVPN manual page man openvpn, you will see --up cmd. In the /etc/openvpn/server.conf configuration file, I added a line:
up "/etc/openvpn/up.sh"
This file is one that I created and will be executed when the VPN starts. Right now, mine looks like this:
#!/bin/sh
logger VPN is UP
service ssh restart
Now, every time my OpenVPN server starts up, it will also restart the OpenSSH server as well. Likewise, I am able to also use --down cmd and specify a file in the server configuration file if I wish to have a script executed when the server is shutdown.
You can read more about these in the OpenVPN manual page - man openvpn
I found a solution.
In the OpenVPN configuration file /etc/openvpn/server.conf you can specify a script to run on up. If you take a look at the OpenVPN manual page man openvpn, you will see --up cmd. In the /etc/openvpn/server.conf configuration file, I added a line:
up "/etc/openvpn/up.sh"
This file is one that I created and will be executed when the VPN starts. Right now, mine looks like this:
#!/bin/sh
logger VPN is UP
service ssh restart
Now, every time my OpenVPN server starts up, it will also restart the OpenSSH server as well. Likewise, I am able to also use --down cmd and specify a file in the server configuration file if I wish to have a script executed when the server is shutdown.
You can read more about these in the OpenVPN manual page - man openvpn
edited 9 hours ago
Rui F Ribeiro
42.1k1484142
42.1k1484142
answered Jul 18 '14 at 3:26
ehaydenrehaydenr
3115
3115
How did you set up SSH to bind to the VPN interface?
– JB0x2D1
Oct 2 '14 at 17:21
@JB0x2D1 I achieved it without actually binding the interface. I bound it to the IP address i knew my machine would be on after connecting to the VPN. In this case, I was hosting the VPN so I knew what ip my machine (The VPN server) would have inside the VPN. From there, you just have ssh only listen on that ip address. I am not sure whether this is 100% reliable. It was for me, but i would imagine interface binding would be better. Please comment if you learn how to bind.
– ehaydenr
Oct 2 '14 at 18:05
Thanks. I think the problem is with my client. I can connect to the VPN then run SSH with no problems on one client but not with another. The problem client is running Lubuntu
– JB0x2D1
Oct 2 '14 at 18:10
add a comment |
How did you set up SSH to bind to the VPN interface?
– JB0x2D1
Oct 2 '14 at 17:21
@JB0x2D1 I achieved it without actually binding the interface. I bound it to the IP address i knew my machine would be on after connecting to the VPN. In this case, I was hosting the VPN so I knew what ip my machine (The VPN server) would have inside the VPN. From there, you just have ssh only listen on that ip address. I am not sure whether this is 100% reliable. It was for me, but i would imagine interface binding would be better. Please comment if you learn how to bind.
– ehaydenr
Oct 2 '14 at 18:05
Thanks. I think the problem is with my client. I can connect to the VPN then run SSH with no problems on one client but not with another. The problem client is running Lubuntu
– JB0x2D1
Oct 2 '14 at 18:10
How did you set up SSH to bind to the VPN interface?
– JB0x2D1
Oct 2 '14 at 17:21
How did you set up SSH to bind to the VPN interface?
– JB0x2D1
Oct 2 '14 at 17:21
@JB0x2D1 I achieved it without actually binding the interface. I bound it to the IP address i knew my machine would be on after connecting to the VPN. In this case, I was hosting the VPN so I knew what ip my machine (The VPN server) would have inside the VPN. From there, you just have ssh only listen on that ip address. I am not sure whether this is 100% reliable. It was for me, but i would imagine interface binding would be better. Please comment if you learn how to bind.
– ehaydenr
Oct 2 '14 at 18:05
@JB0x2D1 I achieved it without actually binding the interface. I bound it to the IP address i knew my machine would be on after connecting to the VPN. In this case, I was hosting the VPN so I knew what ip my machine (The VPN server) would have inside the VPN. From there, you just have ssh only listen on that ip address. I am not sure whether this is 100% reliable. It was for me, but i would imagine interface binding would be better. Please comment if you learn how to bind.
– ehaydenr
Oct 2 '14 at 18:05
Thanks. I think the problem is with my client. I can connect to the VPN then run SSH with no problems on one client but not with another. The problem client is running Lubuntu
– JB0x2D1
Oct 2 '14 at 18:10
Thanks. I think the problem is with my client. I can connect to the VPN then run SSH with no problems on one client but not with another. The problem client is running Lubuntu
– JB0x2D1
Oct 2 '14 at 18:10
add a comment |
Looks like ssh uses upstart, but openvpn doesn't ... you might be able to force ssh to come up delayed by doing this, but it's untested (I don't want to mess up my install):
update-rc.d ssh defaults 99
And as it's untested: CAVEAT EMPTOR
add a comment |
Looks like ssh uses upstart, but openvpn doesn't ... you might be able to force ssh to come up delayed by doing this, but it's untested (I don't want to mess up my install):
update-rc.d ssh defaults 99
And as it's untested: CAVEAT EMPTOR
add a comment |
Looks like ssh uses upstart, but openvpn doesn't ... you might be able to force ssh to come up delayed by doing this, but it's untested (I don't want to mess up my install):
update-rc.d ssh defaults 99
And as it's untested: CAVEAT EMPTOR
Looks like ssh uses upstart, but openvpn doesn't ... you might be able to force ssh to come up delayed by doing this, but it's untested (I don't want to mess up my install):
update-rc.d ssh defaults 99
And as it's untested: CAVEAT EMPTOR
answered Jul 17 '14 at 4:20
tinktink
4,50711222
4,50711222
add a comment |
add a comment |
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.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f144992%2fstarting-ssh-server-after-vpn-starts%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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
-openssh, openvpn, sshd, vpn
There most likely is, but it will largely depend on your OS/distro. Please edit your question w/ that piece of information.
– tink
Jul 17 '14 at 4:08
I have included it. It is on the first line. I am running Ubuntu 14.04.
– ehaydenr
Jul 17 '14 at 4:09