SSH to Linux Container from Other Machine 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” questionHow to configure external IP addresses for LXC guests?Using bridge utils to connect two computers via LinuxHow does ssh work when client and host are on the same machine?Can't use hostname for my linux machinehow to use ssh command to connect to multiple computers and send different commands to each computers at same timeSSH/web servers in Linux containers improve security?SSH in local network while hosting same networkTwo LXC containers using two different physical network interfacesssh to docker container breaks after 45 secondsSSH forwarded through modem recently started failing: updatessh works only one way
Do working physicists consider Newtonian mechanics to be "falsified"?
Why don't the Weasley twins use magic outside of school if the Trace can only find the location of spells cast?
How to say that you spent the night with someone, you were only sleeping and nothing else?
What can I do if my MacBook isn’t charging but already ran out?
Is there a service that would inform me whenever a new direct route is scheduled from a given airport?
Determine whether f is a function, an injection, a surjection
How is simplicity better than precision and clarity in prose?
Need a suitable toxic chemical for a murder plot in my novel
Autumning in love
Can smartphones with the same camera sensor have different image quality?
Blender game recording at the wrong time
Who can trigger ship-wide alerts in Star Trek?
Slither Like a Snake
Classification of bundles, Postnikov towers, obstruction theory, local coefficients
Mortgage adviser recommends a longer term than necessary combined with overpayments
When is phishing education going too far?
Cold is to Refrigerator as warm is to?
What did Darwin mean by 'squib' here?
How can I make names more distinctive without making them longer?
Single author papers against my advisor's will?
Can the prologue be the backstory of your main character?
Can a zero nonce be safely used with AES-GCM if the key is random and never used again?
What LEGO pieces have "real-world" functionality?
Is it possible to ask for a hotel room without minibar/extra services?
SSH to Linux Container from Other Machine
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” questionHow to configure external IP addresses for LXC guests?Using bridge utils to connect two computers via LinuxHow does ssh work when client and host are on the same machine?Can't use hostname for my linux machinehow to use ssh command to connect to multiple computers and send different commands to each computers at same timeSSH/web servers in Linux containers improve security?SSH in local network while hosting same networkTwo LXC containers using two different physical network interfacesssh to docker container breaks after 45 secondsSSH forwarded through modem recently started failing: updatessh works only one way
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
I created five different containers and authorized their keys for easy access between each other. They have internal ip (10.0.3.***). Now what I am trying is to connect these containers from other computers which are in the same network. I installed openssh-server
to my machine for ssh
access. But can't connect to container.
I search about it through the google but couldn't find any that works and I couldn't understand some of them.
How to 'ssh' my containers from other machines?
EDIT:
When computers ssh each other they use eth0 or eth1. When computer(which containers are in) tries to connect to containers it uses loopback. Now lets assume we have two different computer, comp1 and comp2, which are in the same network a cisco modem that do not have internet connection. I can connect from comp1 to comp2 by;
'ssh username@comp2-ip'
But I cannot connect comp2's linux containers which are in the loopback. I want to connect them as easy as I connect comp2. Is there a way?
networking ssh openssh lxc
migrated from askubuntu.com Mar 10 '14 at 13:01
This question came from our site for Ubuntu users and developers.
add a comment |
I created five different containers and authorized their keys for easy access between each other. They have internal ip (10.0.3.***). Now what I am trying is to connect these containers from other computers which are in the same network. I installed openssh-server
to my machine for ssh
access. But can't connect to container.
I search about it through the google but couldn't find any that works and I couldn't understand some of them.
How to 'ssh' my containers from other machines?
EDIT:
When computers ssh each other they use eth0 or eth1. When computer(which containers are in) tries to connect to containers it uses loopback. Now lets assume we have two different computer, comp1 and comp2, which are in the same network a cisco modem that do not have internet connection. I can connect from comp1 to comp2 by;
'ssh username@comp2-ip'
But I cannot connect comp2's linux containers which are in the loopback. I want to connect them as easy as I connect comp2. Is there a way?
networking ssh openssh lxc
migrated from askubuntu.com Mar 10 '14 at 13:01
This question came from our site for Ubuntu users and developers.
Can you ping the containers ?
– Bahaïka
Mar 10 '14 at 12:26
From local machine I can ping but from other machines I can't. It says 'Destination Net Unreachable'.
– rebuked
Mar 10 '14 at 13:16
Destination Net Unreachable - in that case they are probably not in the same network (10.0.0.0) segment.
– grebneke
Mar 10 '14 at 13:36
Also see: unix.stackexchange.com/questions/50201/…
– grebneke
Mar 10 '14 at 13:37
add a comment |
I created five different containers and authorized their keys for easy access between each other. They have internal ip (10.0.3.***). Now what I am trying is to connect these containers from other computers which are in the same network. I installed openssh-server
to my machine for ssh
access. But can't connect to container.
I search about it through the google but couldn't find any that works and I couldn't understand some of them.
How to 'ssh' my containers from other machines?
EDIT:
When computers ssh each other they use eth0 or eth1. When computer(which containers are in) tries to connect to containers it uses loopback. Now lets assume we have two different computer, comp1 and comp2, which are in the same network a cisco modem that do not have internet connection. I can connect from comp1 to comp2 by;
'ssh username@comp2-ip'
But I cannot connect comp2's linux containers which are in the loopback. I want to connect them as easy as I connect comp2. Is there a way?
networking ssh openssh lxc
I created five different containers and authorized their keys for easy access between each other. They have internal ip (10.0.3.***). Now what I am trying is to connect these containers from other computers which are in the same network. I installed openssh-server
to my machine for ssh
access. But can't connect to container.
I search about it through the google but couldn't find any that works and I couldn't understand some of them.
How to 'ssh' my containers from other machines?
EDIT:
When computers ssh each other they use eth0 or eth1. When computer(which containers are in) tries to connect to containers it uses loopback. Now lets assume we have two different computer, comp1 and comp2, which are in the same network a cisco modem that do not have internet connection. I can connect from comp1 to comp2 by;
'ssh username@comp2-ip'
But I cannot connect comp2's linux containers which are in the loopback. I want to connect them as easy as I connect comp2. Is there a way?
networking ssh openssh lxc
networking ssh openssh lxc
edited 17 hours ago
Rui F Ribeiro
42.1k1483142
42.1k1483142
asked Mar 10 '14 at 11:52
rebukedrebuked
1012
1012
migrated from askubuntu.com Mar 10 '14 at 13:01
This question came from our site for Ubuntu users and developers.
migrated from askubuntu.com Mar 10 '14 at 13:01
This question came from our site for Ubuntu users and developers.
Can you ping the containers ?
– Bahaïka
Mar 10 '14 at 12:26
From local machine I can ping but from other machines I can't. It says 'Destination Net Unreachable'.
– rebuked
Mar 10 '14 at 13:16
Destination Net Unreachable - in that case they are probably not in the same network (10.0.0.0) segment.
– grebneke
Mar 10 '14 at 13:36
Also see: unix.stackexchange.com/questions/50201/…
– grebneke
Mar 10 '14 at 13:37
add a comment |
Can you ping the containers ?
– Bahaïka
Mar 10 '14 at 12:26
From local machine I can ping but from other machines I can't. It says 'Destination Net Unreachable'.
– rebuked
Mar 10 '14 at 13:16
Destination Net Unreachable - in that case they are probably not in the same network (10.0.0.0) segment.
– grebneke
Mar 10 '14 at 13:36
Also see: unix.stackexchange.com/questions/50201/…
– grebneke
Mar 10 '14 at 13:37
Can you ping the containers ?
– Bahaïka
Mar 10 '14 at 12:26
Can you ping the containers ?
– Bahaïka
Mar 10 '14 at 12:26
From local machine I can ping but from other machines I can't. It says 'Destination Net Unreachable'.
– rebuked
Mar 10 '14 at 13:16
From local machine I can ping but from other machines I can't. It says 'Destination Net Unreachable'.
– rebuked
Mar 10 '14 at 13:16
Destination Net Unreachable - in that case they are probably not in the same network (10.0.0.0) segment.
– grebneke
Mar 10 '14 at 13:36
Destination Net Unreachable - in that case they are probably not in the same network (10.0.0.0) segment.
– grebneke
Mar 10 '14 at 13:36
Also see: unix.stackexchange.com/questions/50201/…
– grebneke
Mar 10 '14 at 13:37
Also see: unix.stackexchange.com/questions/50201/…
– grebneke
Mar 10 '14 at 13:37
add a comment |
2 Answers
2
active
oldest
votes
Two machines in different (private) networks can't see each other unless both have declared routes to each other. For instance, if you have one machine with an address 10.0.3.1 and a net mask of 255.255.255.0, and another machine with an address 10.0.4.1 and the same (class C) mask, they can't see each other.
They need a shared router that both can see; typically a third machine with 2 IPs, let's say 10.0.3.254 and 10.0.4.254, which has some routing capabilities -- under Linux doing echo 1 > /proc/sys/net/ipv4/ip_forward
will be enough for basic stuff.
Then you'll have to declare your router as such on each machine with route
or ip route
, on the 10.0.3.1 machine:
route add -net 10.0.4.0 netmask 255.255.255.0 gw 10.0.3.254
And the other way around on the 10.0.4.1 machine:
route add -net 10.0.3.0 netmask 255.255.255.0 gw 10.0.4.254
As you're using containers, the container host must act as the router between the containers and the outside world. So activate ip forwarding on it, and add proper routes on the containers, and on the machines you want to access the container from.
add a comment |
Here are a few points to get you started:
Can you
ping
one container from the other? Another machine on the same network?$ ping ip-address-of-other-container
$ ping ip-address-of-other-machine-in-same-network
If not, there is a networking problem
Can you
ssh
locally?$ ssh ip-address-of-same-container
If not,
sshd
might not be running, or there is some firewall problemTry
ssh -v ip-address-of-other-container
-v
will give you debugging information which might reveal more about the issue.
1-Yes, I can ping containers from other containers. 2-I can ssh locally. 3-I can connect without any problems. There is no problem connecting containers from the computer they are installed or between each other. What i want is to connect them from another computer through the internet.
– rebuked
Mar 10 '14 at 13:26
Are you following a guide? Maybe update your question with info about exactly what steps you followed to setup external networking. Did you see this as an example: linux.org/threads/…
– grebneke
Mar 10 '14 at 13:31
I edited my question to reflect my problem better.
– rebuked
Mar 10 '14 at 14:01
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%2f118974%2fssh-to-linux-container-from-other-machine%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
Two machines in different (private) networks can't see each other unless both have declared routes to each other. For instance, if you have one machine with an address 10.0.3.1 and a net mask of 255.255.255.0, and another machine with an address 10.0.4.1 and the same (class C) mask, they can't see each other.
They need a shared router that both can see; typically a third machine with 2 IPs, let's say 10.0.3.254 and 10.0.4.254, which has some routing capabilities -- under Linux doing echo 1 > /proc/sys/net/ipv4/ip_forward
will be enough for basic stuff.
Then you'll have to declare your router as such on each machine with route
or ip route
, on the 10.0.3.1 machine:
route add -net 10.0.4.0 netmask 255.255.255.0 gw 10.0.3.254
And the other way around on the 10.0.4.1 machine:
route add -net 10.0.3.0 netmask 255.255.255.0 gw 10.0.4.254
As you're using containers, the container host must act as the router between the containers and the outside world. So activate ip forwarding on it, and add proper routes on the containers, and on the machines you want to access the container from.
add a comment |
Two machines in different (private) networks can't see each other unless both have declared routes to each other. For instance, if you have one machine with an address 10.0.3.1 and a net mask of 255.255.255.0, and another machine with an address 10.0.4.1 and the same (class C) mask, they can't see each other.
They need a shared router that both can see; typically a third machine with 2 IPs, let's say 10.0.3.254 and 10.0.4.254, which has some routing capabilities -- under Linux doing echo 1 > /proc/sys/net/ipv4/ip_forward
will be enough for basic stuff.
Then you'll have to declare your router as such on each machine with route
or ip route
, on the 10.0.3.1 machine:
route add -net 10.0.4.0 netmask 255.255.255.0 gw 10.0.3.254
And the other way around on the 10.0.4.1 machine:
route add -net 10.0.3.0 netmask 255.255.255.0 gw 10.0.4.254
As you're using containers, the container host must act as the router between the containers and the outside world. So activate ip forwarding on it, and add proper routes on the containers, and on the machines you want to access the container from.
add a comment |
Two machines in different (private) networks can't see each other unless both have declared routes to each other. For instance, if you have one machine with an address 10.0.3.1 and a net mask of 255.255.255.0, and another machine with an address 10.0.4.1 and the same (class C) mask, they can't see each other.
They need a shared router that both can see; typically a third machine with 2 IPs, let's say 10.0.3.254 and 10.0.4.254, which has some routing capabilities -- under Linux doing echo 1 > /proc/sys/net/ipv4/ip_forward
will be enough for basic stuff.
Then you'll have to declare your router as such on each machine with route
or ip route
, on the 10.0.3.1 machine:
route add -net 10.0.4.0 netmask 255.255.255.0 gw 10.0.3.254
And the other way around on the 10.0.4.1 machine:
route add -net 10.0.3.0 netmask 255.255.255.0 gw 10.0.4.254
As you're using containers, the container host must act as the router between the containers and the outside world. So activate ip forwarding on it, and add proper routes on the containers, and on the machines you want to access the container from.
Two machines in different (private) networks can't see each other unless both have declared routes to each other. For instance, if you have one machine with an address 10.0.3.1 and a net mask of 255.255.255.0, and another machine with an address 10.0.4.1 and the same (class C) mask, they can't see each other.
They need a shared router that both can see; typically a third machine with 2 IPs, let's say 10.0.3.254 and 10.0.4.254, which has some routing capabilities -- under Linux doing echo 1 > /proc/sys/net/ipv4/ip_forward
will be enough for basic stuff.
Then you'll have to declare your router as such on each machine with route
or ip route
, on the 10.0.3.1 machine:
route add -net 10.0.4.0 netmask 255.255.255.0 gw 10.0.3.254
And the other way around on the 10.0.4.1 machine:
route add -net 10.0.3.0 netmask 255.255.255.0 gw 10.0.4.254
As you're using containers, the container host must act as the router between the containers and the outside world. So activate ip forwarding on it, and add proper routes on the containers, and on the machines you want to access the container from.
answered Mar 14 '17 at 17:44
wazooxwazoox
1,107913
1,107913
add a comment |
add a comment |
Here are a few points to get you started:
Can you
ping
one container from the other? Another machine on the same network?$ ping ip-address-of-other-container
$ ping ip-address-of-other-machine-in-same-network
If not, there is a networking problem
Can you
ssh
locally?$ ssh ip-address-of-same-container
If not,
sshd
might not be running, or there is some firewall problemTry
ssh -v ip-address-of-other-container
-v
will give you debugging information which might reveal more about the issue.
1-Yes, I can ping containers from other containers. 2-I can ssh locally. 3-I can connect without any problems. There is no problem connecting containers from the computer they are installed or between each other. What i want is to connect them from another computer through the internet.
– rebuked
Mar 10 '14 at 13:26
Are you following a guide? Maybe update your question with info about exactly what steps you followed to setup external networking. Did you see this as an example: linux.org/threads/…
– grebneke
Mar 10 '14 at 13:31
I edited my question to reflect my problem better.
– rebuked
Mar 10 '14 at 14:01
add a comment |
Here are a few points to get you started:
Can you
ping
one container from the other? Another machine on the same network?$ ping ip-address-of-other-container
$ ping ip-address-of-other-machine-in-same-network
If not, there is a networking problem
Can you
ssh
locally?$ ssh ip-address-of-same-container
If not,
sshd
might not be running, or there is some firewall problemTry
ssh -v ip-address-of-other-container
-v
will give you debugging information which might reveal more about the issue.
1-Yes, I can ping containers from other containers. 2-I can ssh locally. 3-I can connect without any problems. There is no problem connecting containers from the computer they are installed or between each other. What i want is to connect them from another computer through the internet.
– rebuked
Mar 10 '14 at 13:26
Are you following a guide? Maybe update your question with info about exactly what steps you followed to setup external networking. Did you see this as an example: linux.org/threads/…
– grebneke
Mar 10 '14 at 13:31
I edited my question to reflect my problem better.
– rebuked
Mar 10 '14 at 14:01
add a comment |
Here are a few points to get you started:
Can you
ping
one container from the other? Another machine on the same network?$ ping ip-address-of-other-container
$ ping ip-address-of-other-machine-in-same-network
If not, there is a networking problem
Can you
ssh
locally?$ ssh ip-address-of-same-container
If not,
sshd
might not be running, or there is some firewall problemTry
ssh -v ip-address-of-other-container
-v
will give you debugging information which might reveal more about the issue.
Here are a few points to get you started:
Can you
ping
one container from the other? Another machine on the same network?$ ping ip-address-of-other-container
$ ping ip-address-of-other-machine-in-same-network
If not, there is a networking problem
Can you
ssh
locally?$ ssh ip-address-of-same-container
If not,
sshd
might not be running, or there is some firewall problemTry
ssh -v ip-address-of-other-container
-v
will give you debugging information which might reveal more about the issue.
edited Mar 10 '14 at 13:34
answered Mar 10 '14 at 13:18
grebnekegrebneke
3,4121819
3,4121819
1-Yes, I can ping containers from other containers. 2-I can ssh locally. 3-I can connect without any problems. There is no problem connecting containers from the computer they are installed or between each other. What i want is to connect them from another computer through the internet.
– rebuked
Mar 10 '14 at 13:26
Are you following a guide? Maybe update your question with info about exactly what steps you followed to setup external networking. Did you see this as an example: linux.org/threads/…
– grebneke
Mar 10 '14 at 13:31
I edited my question to reflect my problem better.
– rebuked
Mar 10 '14 at 14:01
add a comment |
1-Yes, I can ping containers from other containers. 2-I can ssh locally. 3-I can connect without any problems. There is no problem connecting containers from the computer they are installed or between each other. What i want is to connect them from another computer through the internet.
– rebuked
Mar 10 '14 at 13:26
Are you following a guide? Maybe update your question with info about exactly what steps you followed to setup external networking. Did you see this as an example: linux.org/threads/…
– grebneke
Mar 10 '14 at 13:31
I edited my question to reflect my problem better.
– rebuked
Mar 10 '14 at 14:01
1-Yes, I can ping containers from other containers. 2-I can ssh locally. 3-I can connect without any problems. There is no problem connecting containers from the computer they are installed or between each other. What i want is to connect them from another computer through the internet.
– rebuked
Mar 10 '14 at 13:26
1-Yes, I can ping containers from other containers. 2-I can ssh locally. 3-I can connect without any problems. There is no problem connecting containers from the computer they are installed or between each other. What i want is to connect them from another computer through the internet.
– rebuked
Mar 10 '14 at 13:26
Are you following a guide? Maybe update your question with info about exactly what steps you followed to setup external networking. Did you see this as an example: linux.org/threads/…
– grebneke
Mar 10 '14 at 13:31
Are you following a guide? Maybe update your question with info about exactly what steps you followed to setup external networking. Did you see this as an example: linux.org/threads/…
– grebneke
Mar 10 '14 at 13:31
I edited my question to reflect my problem better.
– rebuked
Mar 10 '14 at 14:01
I edited my question to reflect my problem better.
– rebuked
Mar 10 '14 at 14:01
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%2f118974%2fssh-to-linux-container-from-other-machine%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
-lxc, networking, openssh, ssh
Can you ping the containers ?
– Bahaïka
Mar 10 '14 at 12:26
From local machine I can ping but from other machines I can't. It says 'Destination Net Unreachable'.
– rebuked
Mar 10 '14 at 13:16
Destination Net Unreachable - in that case they are probably not in the same network (10.0.0.0) segment.
– grebneke
Mar 10 '14 at 13:36
Also see: unix.stackexchange.com/questions/50201/…
– grebneke
Mar 10 '14 at 13:37