Score:0

How do I use PuTTY to connect through SSH to Ubuntu Server 20.04.3 LTS

ru flag

I'm trying to connect to my server terminal thru SSH, before at my home everything worked fine, on my Ubuntu server terminal I did ifconfig, get the ipv4 IP address and connect to it. Now I brought my laptop to my workplace and tried to do the same, but can't connect to the server. This time when checking the IP address of my Ubuntu server I get the below ifconfig result:

Screenshot 1

It seems that this time it uses an Ipv6 address, there are two fields inet6 and ether, I tried both still can't connect. I referred to this solution, but no result. I tried also to disable ipv6 in my server, but no result as well:

Screenshot 2

What should I type in PuTTY as an IP address? Which port should I use?
Note that my Ubuntu server runs on Oracle VM.

in flag
Are you connecting to the VM over the network? Or is it VM Host ⇢ VM Client?
NSA NSA avatar
ru flag
@matigo I'm connecting to VM from the host(Windows) by using PuTTY software (SSH client)
in flag
In that case, consider setting up [a Host-Only network connection](https://www.virtualbox.org/manual/ch06.html#network_hostonly) on a second virtual network device. This will allow you to have a consistent IPv4 address to the VM regardless of which network you may be on. This is how I get around similar issues
NSA NSA avatar
ru flag
@matigo in case you or others wondering why I connect from host to VM is the ubuntu server doesn't have a shared clipboard with host OS so, in order to copy/paste, one of the solutions is to use PuTTY. [reference link](https://superuser.com/a/640810)
NSA NSA avatar
ru flag
thnx @matigo, i will try now
NSA NSA avatar
ru flag
May I ask, what do you mean by second virtual network device? @matigo
Score:2
br flag

Your server is completely without usable IP address. It should have a valid IPv4 address and optionally valid non-local IPv6 address(es) too. But I see no IPv4 and only one local IPv6 starting FE:80:... This IPv6 address type can be used only for communication in local broadcast domain (with devices reachable directly, not behind router ). It is not reachable from other network segments (neither from LAN nor WAN). Especially if your laptop is in another network segment, you cannot connect to server by any way if server IP settings remain as you show in snapshot.

My recommendation: Set IPv4 address (and network mask and gateway) of your server manually. Or try to get address from DHCP server if it is present in server network segment. But if no IPv4 address is obtained it looks no DHCP is there. Manual setting is only solution.

You can use IPv6 only setting too (without IPv4). But if you are not familiar with IPv6 address types, it could be little bit complicated for you. Therefore I recommend to start by IPv4.

The connection works in your home network because there is running DHCP server and your nodes get IPv4 addresses dynamically. But in your workplace is different situation. Ask your workplace LAN administrator for information concerning your network:

  • What is LAN segment IPv4 address (incl. mask and GW)
  • Whether is there DHCP server in the LAN
  • What an IPv4 address is free for you to be set in your server (prevent address collision!!!)
  • Whether you can connect your server to LAN in workplace and what conditions must bee met etc.

Answer extension (after reaction in comment)

There are two main ways how to connect virtual machine to host and through it to external network in virtual environment. Both depend on host networking setting, which must be prepared. Third possibility is to use virtual machine in local isolated network. There are some disadvantages in this way.

  1. Bridge mode
  2. NAT mode = network address translation
  3. (Isolated local network segment)

#1

A host networking is set with at least one bridge segment which is connected to external LAN and is assigned as available for virtual machines (VM's) too. A VM interface must be connected (set in VM settings) to this bridged segment. IP address can be assigned either by DHCP server sitting in LAN outside of the host, or manually. The VM has own IP address different from host IP address. It means 2 different addresses are used in LAN. The VM can connect directly to LAN and is reachable on its address for incoming connections.

#2

The host networking is set with at least one NAT segment. The segment uses LAN IP address of host as an outside address and an internal new network segment as a local net for VM(s). This local net usually include own default DHCP server which assigns addresses to VM(s). Address translation is enabled by default. All VM's are hidden behind IP address of host. No special IP address for VM in LAN is necessary. The VM can communicate with outside addresses via NAT. But VM is not reachable from LAN for incoming connections. There is no easy way how to start connection from LAN to VM which is in NAT net segment.

#3

Isolated local network segment in host is similar to option #2 (NAT). But no NAT or other way exists to connect from VM to outside network. Isolated network includes local default DHCP server usually. Main disadvantage is the isolation. Any VM's in this local isolated net cannot connect to Internet (and other resources ). No updates, no public web access etc. is possible. Only host IP interface laying in the isolated network is reachable to get some data e.g. via SMB sharing.

NSA NSA avatar
ru flag
thnx for the detailed answer. However, I want to ask, since my Ubuntu server is just for testing purposes (to create and test web services, DB manipulation, etc.), can I just use my host IP address as my guest IP address? Can I somehow bind my host IP address to my server IP address, so that I can connect to my server and webservices thru that host IP?
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.