LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 08-01-2008, 06:43 AM   #1
jonaskellens
Member
 
Registered: Jul 2008
Location: Ghent, Belgium
Distribution: Fedora, CentOS
Posts: 632

Rep: Reputation: 33
cannot ssh virtual machine


My host (XP) is on the network 192.168.4.0.
My virtual machine (Fedora) is in the network 10.0.2.0 (NAT)

When I try to gain access via ssh from my virtual machine to one of the clients on the 192.168.4-network, I succeed.

ssh 192.168.4.8 (success)

When I try to gain access via ssh from one of the clients on the 192.168.4-network to my virtual machine, it doesn't work.

ssh 10.0.2.15 (fail)

There is a webserver on my fedora virtual machine that I would like to access from the 192.168.4.0 -network, but that doens't work.

Anyone knows why I fail to talk to my virtual Fedora ? Cause the opposite way works fine.

Last edited by jonaskellens; 08-01-2008 at 06:44 AM.
 
Old 08-01-2008, 06:45 AM   #2
billymayday
LQ Guru
 
Registered: Mar 2006
Location: Sydney, Australia
Distribution: Fedora, CentOS, OpenSuse, Slack, Gentoo, Debian, Arch, PCBSD
Posts: 6,678

Rep: Reputation: 122Reputation: 122
Well it depends why it isn't working. Do you know if the virtual machine has a firewall runnin?

What is the exact message when you try to ssh in?
 
Old 08-01-2008, 06:49 AM   #3
jonaskellens
Member
 
Registered: Jul 2008
Location: Ghent, Belgium
Distribution: Fedora, CentOS
Posts: 632

Original Poster
Rep: Reputation: 33
ssh 10.0.2.15 takes forever...

port 80 is open, also ssh is permitted on the firewall of my fedora virtual machine.

edit : after minutes of trying I get :
connect to host 10.0.2.15 port 22 : connection timed out

Last edited by jonaskellens; 08-01-2008 at 06:53 AM.
 
Old 08-01-2008, 07:00 AM   #4
billymayday
LQ Guru
 
Registered: Mar 2006
Location: Sydney, Australia
Distribution: Fedora, CentOS, OpenSuse, Slack, Gentoo, Debian, Arch, PCBSD
Posts: 6,678

Rep: Reputation: 122Reputation: 122
What's port 80 got to do with it? ssh works on port 22
 
Old 08-01-2008, 07:08 AM   #5
jonaskellens
Member
 
Registered: Jul 2008
Location: Ghent, Belgium
Distribution: Fedora, CentOS
Posts: 632

Original Poster
Rep: Reputation: 33
Quote:
Originally Posted by billymayday View Post
What's port 80 got to do with it? ssh works on port 22
To access the webserver...
 
Old 08-01-2008, 08:21 AM   #6
Brian1
LQ Guru
 
Registered: Jan 2003
Location: Seymour, Indiana
Distribution: Distribution: RHEL 5 with Pieces of this and that. Kernel 2.6.23.1, KDE 3.5.8 and KDE 4.0 beta, Plu
Posts: 5,700

Rep: Reputation: 62
So you are trying to connect from another machine to a machine that is running a virtual server on it. What should happen is the machine needs to have a port open like 22 open and then be able to forward that port to the virtual server port 22. Now if the the host machine is running ssh on port 22 then set the virtual to another port or vice a versa. Then you can forward that port to the virtual.

Brian
 
Old 08-01-2008, 08:26 AM   #7
billymayday
LQ Guru
 
Registered: Mar 2006
Location: Sydney, Australia
Distribution: Fedora, CentOS, OpenSuse, Slack, Gentoo, Debian, Arch, PCBSD
Posts: 6,678

Rep: Reputation: 122Reputation: 122
Quote:
Originally Posted by jonaskellens View Post
To access the webserver...
Focus on one issue at a time - you start talking about ssh and then throw http in as an aside. Keep issues clear
 
Old 08-01-2008, 08:38 AM   #8
jonaskellens
Member
 
Registered: Jul 2008
Location: Ghent, Belgium
Distribution: Fedora, CentOS
Posts: 632

Original Poster
Rep: Reputation: 33
Quote:
Originally Posted by Brian1 View Post
So you are trying to connect from another machine to a machine that is running a virtual server on it. What should happen is the machine needs to have a port open like 22 open and then be able to forward that port to the virtual server port 22. Now if the the host machine is running ssh on port 22 then set the virtual to another port or vice a versa. Then you can forward that port to the virtual.

Brian

Fedora 8 is running as virtual machine on windows XP pro with VirtualBox (virtualisation soft). The virtual machine uses NAT to be able to connect to the outside world.

Isn't NAT responsible for mapping packets that arrive at my host (XP) to my virtual machine (Fedora) ? I suppose that al the routes in the ip-tables are set correct ?!

Don't tell me I need to open port 22 on my XP host to be able to speak to my virtual machine. Does it work like that ?
XP and his ports normally have nothing to do with packets that are destinated for my virtual machine, no ?!

I've added a route on host 192.168.4.8 that tells to forward packets for the 10.0.2.0-network directly to host 192.168.4.123 (my XP host that is running the virtual Fedora), but that didn't help much.

Thx all for your reply.
 
Old 08-01-2008, 08:48 AM   #9
billymayday
LQ Guru
 
Registered: Mar 2006
Location: Sydney, Australia
Distribution: Fedora, CentOS, OpenSuse, Slack, Gentoo, Debian, Arch, PCBSD
Posts: 6,678

Rep: Reputation: 122Reputation: 122
If the network clients are going via your windows machine then of course the windows host needs to allow port 22 through. Maybe I'm not following your setup, but this is what I understand from the OP
 
Old 08-01-2008, 09:15 AM   #10
jonaskellens
Member
 
Registered: Jul 2008
Location: Ghent, Belgium
Distribution: Fedora, CentOS
Posts: 632

Original Poster
Rep: Reputation: 33
Quote:
Originally Posted by billymayday View Post
If the network clients are going via your windows machine then of course the windows host needs to allow port 22 through. Maybe I'm not following your setup, but this is what I understand from the OP
So for every service that I want to run (web, ftp, ssh,...) on my virtual machine Fedora, the corresponding ports need to be open on my hostmachine XP ?
 
Old 08-01-2008, 09:33 AM   #11
klearview
Member
 
Registered: Aug 2006
Location: London
Distribution: Debian, Kubuntu
Posts: 572

Rep: Reputation: 75
change the ip address of your virtual machine - put it on the same network as others (i.e. give it 192.168.4.13 address)
 
Old 08-01-2008, 09:36 AM   #12
jonaskellens
Member
 
Registered: Jul 2008
Location: Ghent, Belgium
Distribution: Fedora, CentOS
Posts: 632

Original Poster
Rep: Reputation: 33
Quote:
Originally Posted by klearview View Post
change the ip address of your virtual machine - put it on the same network as others (i.e. give it 192.168.4.13 address)
I'm working with Network Address Translation. What difference does it make whether I put it in a B-class subnet or a C-class ?
 
Old 08-01-2008, 04:51 PM   #13
billymayday
LQ Guru
 
Registered: Mar 2006
Location: Sydney, Australia
Distribution: Fedora, CentOS, OpenSuse, Slack, Gentoo, Debian, Arch, PCBSD
Posts: 6,678

Rep: Reputation: 122Reputation: 122
Quote:
Originally Posted by jonaskellens View Post
So for every service that I want to run (web, ftp, ssh,...) on my virtual machine Fedora, the corresponding ports need to be open on my hostmachine XP ?
Only if I understand your setup correctly and you're routing through the windows box
 
Old 08-02-2008, 08:19 PM   #14
Brian1
LQ Guru
 
Registered: Jan 2003
Location: Seymour, Indiana
Distribution: Distribution: RHEL 5 with Pieces of this and that. Kernel 2.6.23.1, KDE 3.5.8 and KDE 4.0 beta, Plu
Posts: 5,700

Rep: Reputation: 62
Setup network as nat requires mapping ports from the external IP and external port of the host server to the guest OS, IP, and port. Same setup like a plain generic store bought router. If you set the network to bridge then it is seen as directly on the same network. No portforwarding required there.

Brian
 
Old 08-03-2008, 02:38 AM   #15
r3sistance
Senior Member
 
Registered: Mar 2004
Location: UK
Distribution: CentOS 6/7
Posts: 1,375

Rep: Reputation: 217Reputation: 217Reputation: 217
Please can you run a "sudo /etc/init.d/iptables status" and copy and paste the results here, remember to place code tags around them.

Also run a "sudo /etc/init.d/sshd status" and confirm that sshd is actually running. If sshd is not then type "sudo /etc/init.d/sshd start". There will be a few minor configuration changes needed if that's the case as ssh won't come back-up should the VM need rebooting/restarting.

If your logging in as root you won't need the sudo parts, if you aren't you need privilages to run sudo.

Last edited by r3sistance; 08-03-2008 at 02:40 AM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
file sharing between a virtual machine and the host machine okok Linux - Networking 3 06-21-2013 01:42 AM
machine not allowing login thru virtual console, only thru ssh dsids Linux - Newbie 2 01-15-2007 12:46 PM
SSH remote login fails after moving virtual machine novice_mage Linux - Networking 7 12-31-2006 07:53 AM
SSH back to virtual machine 07mackenzie Linux - General 1 12-13-2006 11:17 AM
SSH forward from a Windows machine to a Linux machine isn't working nickj6282 Linux - Networking 3 08-13-2006 03:47 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 11:40 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration