How can I access a virtual machine running on a remote machine directly?Which concept does ssh “proxy jump” belong to: proxy, port forwarding or something else?How does Linux handle 2 identical destinations in its routing table?iptables routingHow can I connect to a local computer behind a router with the router's IP address?OpenVPN and routing problem on OpenWRTip rule not acting on fwmarkrouting problem - arpAllow KVM guests on virsh virtual network to access the real internal networklinux policy routing; Sending arp for off network IPs instead of sending traffic to gatewayiptables - 2 Internetprovider - routingConfiguring Linux Mint as a Gateway
How to answer pointed "are you quitting" questioning when I don't want them to suspect
Landlord wants to switch my lease to a "Land contract" to "get back at the city"
Need help identifying/translating a plaque in Tangier, Morocco
Was there ever an axiom rendered a theorem?
Does the average primeness of natural numbers tend to zero?
Lied on resume at previous job
Is every set a filtered colimit of finite sets?
extract characters between two commas?
What is the command to reset a PC without deleting any files
How did the USSR manage to innovate in an environment characterized by government censorship and high bureaucracy?
LWC and complex parameters
Add an angle to a sphere
Is domain driven design an anti-SQL pattern?
Can I find out the caloric content of bread by dehydrating it?
What does 'script /dev/null' do?
Crop image to path created in TikZ?
Could Giant Ground Sloths have been a good pack animal for the ancient Mayans?
Ideas for 3rd eye abilities
How do I create uniquely male characters?
What is the meaning of "of trouble" in the following sentence?
How to manage monthly salary
Why is my log file so massive? 22gb. I am running log backups
How can I fix this gap between bookcases I made?
What happens when a metallic dragon and a chromatic dragon mate?
How can I access a virtual machine running on a remote machine directly?
Which concept does ssh “proxy jump” belong to: proxy, port forwarding or something else?How does Linux handle 2 identical destinations in its routing table?iptables routingHow can I connect to a local computer behind a router with the router's IP address?OpenVPN and routing problem on OpenWRTip rule not acting on fwmarkrouting problem - arpAllow KVM guests on virsh virtual network to access the real internal networklinux policy routing; Sending arp for off network IPs instead of sending traffic to gatewayiptables - 2 Internetprovider - routingConfiguring Linux Mint as a Gateway
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
My local Lubuntu's wifi IP address is 192.168.1.97
A remote Lubuntu's wifi IP address is 192.168.1.198,
A virtual machine running on the remote Lubuntu has IP address 192.168.122.169.
I can access the virtual machine from my local machine, indirectly by ssh to the remote by ssh t@192.168.1.198
, and then ssh to the virtual machine by ssh t@192.168.122.169
.
I can access the local machine from the virtual machine, directly by ssh t@192.168.1.97
.
Because of the routing table on my local Lubuntu, I can't access the virtual machine directly from my local machine
$ ssh t@192.168.122.169
ssh: connect to host 192.168.122.169 port 22: No route to host
Can I access the virtual machine directly from my local Lubuntu?
Do I have to modify the routing tables of my local Lubuntu and the remote Lubuntu?
Can NAT help?
Thanks.
The routing table on the local Lubuntu is
$ route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
0.0.0.0 192.168.1.1 0.0.0.0 UG 600 0 0 wlx801f02b5c389
172.17.0.0 0.0.0.0 255.255.0.0 U 0 0 0 docker0
192.168.1.0 0.0.0.0 255.255.255.0 U 600 0 0 wlx801f02b5c389
192.168.122.0 0.0.0.0 255.255.255.0 U 0 0 0 virbr0
The routing table on the remote Lubuntu is
$ route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
0.0.0.0 192.168.1.1 0.0.0.0 UG 600 0 0 wlp5s0
192.168.1.0 0.0.0.0 255.255.255.0 U 600 0 0 wlp5s0
192.168.122.0 0.0.0.0 255.255.255.0 U 0 0 0 virbr0
The routing table on the virtual machine is:
$ route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
0.0.0.0 192.168.122.1 0.0.0.0 UG 0 0 0 ens3
169.254.0.0 0.0.0.0 255.255.0.0 U 1000 0 0 ens3
192.168.122.0 0.0.0.0 255.255.255.0 U 0 0 0 ens3
routing nat
add a comment |
My local Lubuntu's wifi IP address is 192.168.1.97
A remote Lubuntu's wifi IP address is 192.168.1.198,
A virtual machine running on the remote Lubuntu has IP address 192.168.122.169.
I can access the virtual machine from my local machine, indirectly by ssh to the remote by ssh t@192.168.1.198
, and then ssh to the virtual machine by ssh t@192.168.122.169
.
I can access the local machine from the virtual machine, directly by ssh t@192.168.1.97
.
Because of the routing table on my local Lubuntu, I can't access the virtual machine directly from my local machine
$ ssh t@192.168.122.169
ssh: connect to host 192.168.122.169 port 22: No route to host
Can I access the virtual machine directly from my local Lubuntu?
Do I have to modify the routing tables of my local Lubuntu and the remote Lubuntu?
Can NAT help?
Thanks.
The routing table on the local Lubuntu is
$ route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
0.0.0.0 192.168.1.1 0.0.0.0 UG 600 0 0 wlx801f02b5c389
172.17.0.0 0.0.0.0 255.255.0.0 U 0 0 0 docker0
192.168.1.0 0.0.0.0 255.255.255.0 U 600 0 0 wlx801f02b5c389
192.168.122.0 0.0.0.0 255.255.255.0 U 0 0 0 virbr0
The routing table on the remote Lubuntu is
$ route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
0.0.0.0 192.168.1.1 0.0.0.0 UG 600 0 0 wlp5s0
192.168.1.0 0.0.0.0 255.255.255.0 U 600 0 0 wlp5s0
192.168.122.0 0.0.0.0 255.255.255.0 U 0 0 0 virbr0
The routing table on the virtual machine is:
$ route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
0.0.0.0 192.168.122.1 0.0.0.0 UG 0 0 0 ens3
169.254.0.0 0.0.0.0 255.255.0.0 U 1000 0 0 ens3
192.168.122.0 0.0.0.0 255.255.255.0 U 0 0 0 ens3
routing nat
1
IMHO this is a question about networking rather than about Unix or Linux. You either bridge the network interface on the VM (so it shares the same address range as the host) or forward across the NAT. See for example Introduction to Networking Modes in particular the "VM←Net/LAN" column of Table 6.1
– steeldriver
Mar 28 at 12:51
I am using kvm.
– Tim
Mar 28 at 12:54
AFAIK the principle is the same regardless of the particular VM platform - if you believe that is not the case, please edit your question to make that clear.
– steeldriver
Mar 28 at 12:56
add a comment |
My local Lubuntu's wifi IP address is 192.168.1.97
A remote Lubuntu's wifi IP address is 192.168.1.198,
A virtual machine running on the remote Lubuntu has IP address 192.168.122.169.
I can access the virtual machine from my local machine, indirectly by ssh to the remote by ssh t@192.168.1.198
, and then ssh to the virtual machine by ssh t@192.168.122.169
.
I can access the local machine from the virtual machine, directly by ssh t@192.168.1.97
.
Because of the routing table on my local Lubuntu, I can't access the virtual machine directly from my local machine
$ ssh t@192.168.122.169
ssh: connect to host 192.168.122.169 port 22: No route to host
Can I access the virtual machine directly from my local Lubuntu?
Do I have to modify the routing tables of my local Lubuntu and the remote Lubuntu?
Can NAT help?
Thanks.
The routing table on the local Lubuntu is
$ route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
0.0.0.0 192.168.1.1 0.0.0.0 UG 600 0 0 wlx801f02b5c389
172.17.0.0 0.0.0.0 255.255.0.0 U 0 0 0 docker0
192.168.1.0 0.0.0.0 255.255.255.0 U 600 0 0 wlx801f02b5c389
192.168.122.0 0.0.0.0 255.255.255.0 U 0 0 0 virbr0
The routing table on the remote Lubuntu is
$ route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
0.0.0.0 192.168.1.1 0.0.0.0 UG 600 0 0 wlp5s0
192.168.1.0 0.0.0.0 255.255.255.0 U 600 0 0 wlp5s0
192.168.122.0 0.0.0.0 255.255.255.0 U 0 0 0 virbr0
The routing table on the virtual machine is:
$ route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
0.0.0.0 192.168.122.1 0.0.0.0 UG 0 0 0 ens3
169.254.0.0 0.0.0.0 255.255.0.0 U 1000 0 0 ens3
192.168.122.0 0.0.0.0 255.255.255.0 U 0 0 0 ens3
routing nat
My local Lubuntu's wifi IP address is 192.168.1.97
A remote Lubuntu's wifi IP address is 192.168.1.198,
A virtual machine running on the remote Lubuntu has IP address 192.168.122.169.
I can access the virtual machine from my local machine, indirectly by ssh to the remote by ssh t@192.168.1.198
, and then ssh to the virtual machine by ssh t@192.168.122.169
.
I can access the local machine from the virtual machine, directly by ssh t@192.168.1.97
.
Because of the routing table on my local Lubuntu, I can't access the virtual machine directly from my local machine
$ ssh t@192.168.122.169
ssh: connect to host 192.168.122.169 port 22: No route to host
Can I access the virtual machine directly from my local Lubuntu?
Do I have to modify the routing tables of my local Lubuntu and the remote Lubuntu?
Can NAT help?
Thanks.
The routing table on the local Lubuntu is
$ route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
0.0.0.0 192.168.1.1 0.0.0.0 UG 600 0 0 wlx801f02b5c389
172.17.0.0 0.0.0.0 255.255.0.0 U 0 0 0 docker0
192.168.1.0 0.0.0.0 255.255.255.0 U 600 0 0 wlx801f02b5c389
192.168.122.0 0.0.0.0 255.255.255.0 U 0 0 0 virbr0
The routing table on the remote Lubuntu is
$ route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
0.0.0.0 192.168.1.1 0.0.0.0 UG 600 0 0 wlp5s0
192.168.1.0 0.0.0.0 255.255.255.0 U 600 0 0 wlp5s0
192.168.122.0 0.0.0.0 255.255.255.0 U 0 0 0 virbr0
The routing table on the virtual machine is:
$ route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
0.0.0.0 192.168.122.1 0.0.0.0 UG 0 0 0 ens3
169.254.0.0 0.0.0.0 255.255.0.0 U 1000 0 0 ens3
192.168.122.0 0.0.0.0 255.255.255.0 U 0 0 0 ens3
routing nat
routing nat
edited Mar 28 at 12:05
GAD3R
28.1k1958114
28.1k1958114
asked Mar 28 at 11:57
TimTim
28.5k79269491
28.5k79269491
1
IMHO this is a question about networking rather than about Unix or Linux. You either bridge the network interface on the VM (so it shares the same address range as the host) or forward across the NAT. See for example Introduction to Networking Modes in particular the "VM←Net/LAN" column of Table 6.1
– steeldriver
Mar 28 at 12:51
I am using kvm.
– Tim
Mar 28 at 12:54
AFAIK the principle is the same regardless of the particular VM platform - if you believe that is not the case, please edit your question to make that clear.
– steeldriver
Mar 28 at 12:56
add a comment |
1
IMHO this is a question about networking rather than about Unix or Linux. You either bridge the network interface on the VM (so it shares the same address range as the host) or forward across the NAT. See for example Introduction to Networking Modes in particular the "VM←Net/LAN" column of Table 6.1
– steeldriver
Mar 28 at 12:51
I am using kvm.
– Tim
Mar 28 at 12:54
AFAIK the principle is the same regardless of the particular VM platform - if you believe that is not the case, please edit your question to make that clear.
– steeldriver
Mar 28 at 12:56
1
1
IMHO this is a question about networking rather than about Unix or Linux. You either bridge the network interface on the VM (so it shares the same address range as the host) or forward across the NAT. See for example Introduction to Networking Modes in particular the "VM←Net/LAN" column of Table 6.1
– steeldriver
Mar 28 at 12:51
IMHO this is a question about networking rather than about Unix or Linux. You either bridge the network interface on the VM (so it shares the same address range as the host) or forward across the NAT. See for example Introduction to Networking Modes in particular the "VM←Net/LAN" column of Table 6.1
– steeldriver
Mar 28 at 12:51
I am using kvm.
– Tim
Mar 28 at 12:54
I am using kvm.
– Tim
Mar 28 at 12:54
AFAIK the principle is the same regardless of the particular VM platform - if you believe that is not the case, please edit your question to make that clear.
– steeldriver
Mar 28 at 12:56
AFAIK the principle is the same regardless of the particular VM platform - if you believe that is not the case, please edit your question to make that clear.
– steeldriver
Mar 28 at 12:56
add a comment |
1 Answer
1
active
oldest
votes
Use ProxyJump
or ProxyCommand
.
Add this to your ~/.ssh/config
:
Host vmhost
User t
Hostname 192.168.1.198
Host vm
Hostname 192.168.122.169
User t
ProxyJump vmhost
or for older versions of ssh
instead ProxyJump vmhost
:
ProxyCommand ssh -q -W 192.168.122.169:22 vmhost
Connect using:
ssh vm
Thanks. Is there a solution which is no ssh specific?
– Tim
Mar 28 at 12:35
This should work forscp
andssh
. But for general routing, you somehow need to setup a proxy on the vm host.
– RoVo
Mar 28 at 12:36
Thanks. How do you setup a proxy on the vm host?
– Tim
Mar 28 at 12:40
Sorry, don't know how to do it. Maybe network bridge is enough. Might be worth a second question.
– RoVo
Mar 28 at 12:48
Is the way in your reply called SSH local port forwarding, or something else?
– Tim
Mar 28 at 12:50
|
show 5 more comments
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%2f509195%2fhow-can-i-access-a-virtual-machine-running-on-a-remote-machine-directly%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
Use ProxyJump
or ProxyCommand
.
Add this to your ~/.ssh/config
:
Host vmhost
User t
Hostname 192.168.1.198
Host vm
Hostname 192.168.122.169
User t
ProxyJump vmhost
or for older versions of ssh
instead ProxyJump vmhost
:
ProxyCommand ssh -q -W 192.168.122.169:22 vmhost
Connect using:
ssh vm
Thanks. Is there a solution which is no ssh specific?
– Tim
Mar 28 at 12:35
This should work forscp
andssh
. But for general routing, you somehow need to setup a proxy on the vm host.
– RoVo
Mar 28 at 12:36
Thanks. How do you setup a proxy on the vm host?
– Tim
Mar 28 at 12:40
Sorry, don't know how to do it. Maybe network bridge is enough. Might be worth a second question.
– RoVo
Mar 28 at 12:48
Is the way in your reply called SSH local port forwarding, or something else?
– Tim
Mar 28 at 12:50
|
show 5 more comments
Use ProxyJump
or ProxyCommand
.
Add this to your ~/.ssh/config
:
Host vmhost
User t
Hostname 192.168.1.198
Host vm
Hostname 192.168.122.169
User t
ProxyJump vmhost
or for older versions of ssh
instead ProxyJump vmhost
:
ProxyCommand ssh -q -W 192.168.122.169:22 vmhost
Connect using:
ssh vm
Thanks. Is there a solution which is no ssh specific?
– Tim
Mar 28 at 12:35
This should work forscp
andssh
. But for general routing, you somehow need to setup a proxy on the vm host.
– RoVo
Mar 28 at 12:36
Thanks. How do you setup a proxy on the vm host?
– Tim
Mar 28 at 12:40
Sorry, don't know how to do it. Maybe network bridge is enough. Might be worth a second question.
– RoVo
Mar 28 at 12:48
Is the way in your reply called SSH local port forwarding, or something else?
– Tim
Mar 28 at 12:50
|
show 5 more comments
Use ProxyJump
or ProxyCommand
.
Add this to your ~/.ssh/config
:
Host vmhost
User t
Hostname 192.168.1.198
Host vm
Hostname 192.168.122.169
User t
ProxyJump vmhost
or for older versions of ssh
instead ProxyJump vmhost
:
ProxyCommand ssh -q -W 192.168.122.169:22 vmhost
Connect using:
ssh vm
Use ProxyJump
or ProxyCommand
.
Add this to your ~/.ssh/config
:
Host vmhost
User t
Hostname 192.168.1.198
Host vm
Hostname 192.168.122.169
User t
ProxyJump vmhost
or for older versions of ssh
instead ProxyJump vmhost
:
ProxyCommand ssh -q -W 192.168.122.169:22 vmhost
Connect using:
ssh vm
edited Mar 28 at 12:35
answered Mar 28 at 12:33
RoVoRoVo
3,522317
3,522317
Thanks. Is there a solution which is no ssh specific?
– Tim
Mar 28 at 12:35
This should work forscp
andssh
. But for general routing, you somehow need to setup a proxy on the vm host.
– RoVo
Mar 28 at 12:36
Thanks. How do you setup a proxy on the vm host?
– Tim
Mar 28 at 12:40
Sorry, don't know how to do it. Maybe network bridge is enough. Might be worth a second question.
– RoVo
Mar 28 at 12:48
Is the way in your reply called SSH local port forwarding, or something else?
– Tim
Mar 28 at 12:50
|
show 5 more comments
Thanks. Is there a solution which is no ssh specific?
– Tim
Mar 28 at 12:35
This should work forscp
andssh
. But for general routing, you somehow need to setup a proxy on the vm host.
– RoVo
Mar 28 at 12:36
Thanks. How do you setup a proxy on the vm host?
– Tim
Mar 28 at 12:40
Sorry, don't know how to do it. Maybe network bridge is enough. Might be worth a second question.
– RoVo
Mar 28 at 12:48
Is the way in your reply called SSH local port forwarding, or something else?
– Tim
Mar 28 at 12:50
Thanks. Is there a solution which is no ssh specific?
– Tim
Mar 28 at 12:35
Thanks. Is there a solution which is no ssh specific?
– Tim
Mar 28 at 12:35
This should work for
scp
and ssh
. But for general routing, you somehow need to setup a proxy on the vm host.– RoVo
Mar 28 at 12:36
This should work for
scp
and ssh
. But for general routing, you somehow need to setup a proxy on the vm host.– RoVo
Mar 28 at 12:36
Thanks. How do you setup a proxy on the vm host?
– Tim
Mar 28 at 12:40
Thanks. How do you setup a proxy on the vm host?
– Tim
Mar 28 at 12:40
Sorry, don't know how to do it. Maybe network bridge is enough. Might be worth a second question.
– RoVo
Mar 28 at 12:48
Sorry, don't know how to do it. Maybe network bridge is enough. Might be worth a second question.
– RoVo
Mar 28 at 12:48
Is the way in your reply called SSH local port forwarding, or something else?
– Tim
Mar 28 at 12:50
Is the way in your reply called SSH local port forwarding, or something else?
– Tim
Mar 28 at 12:50
|
show 5 more comments
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%2f509195%2fhow-can-i-access-a-virtual-machine-running-on-a-remote-machine-directly%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
-nat, routing
1
IMHO this is a question about networking rather than about Unix or Linux. You either bridge the network interface on the VM (so it shares the same address range as the host) or forward across the NAT. See for example Introduction to Networking Modes in particular the "VM←Net/LAN" column of Table 6.1
– steeldriver
Mar 28 at 12:51
I am using kvm.
– Tim
Mar 28 at 12:54
AFAIK the principle is the same regardless of the particular VM platform - if you believe that is not the case, please edit your question to make that clear.
– steeldriver
Mar 28 at 12:56