gns3-web-ui icon indicating copy to clipboard operation
gns3-web-ui copied to clipboard

Unable to add additional servers, "Cannot connect to the server: Error: Server is unreachable"

Open eantowne opened this issue 3 years ago • 55 comments

  • GNS3 Server:
    • Version: 2.2.21
    • Operating System: Pop-OS 20.10 (Ubuntu derivative) Kernel: 5.11.0-7614-generic
    • Additional Operating Systems affected: Ubuntu Server 20.04 LTS Kernel: 5.4.0-73-generic
  • Client OS: Pop-OS 20.10

When attempting to add additional servers, receiving error of "Cannot connect to the server: Error: Server is unreachable". The remote server IS running, and I can access it via it's own Web-UI.

Remote-Server-Web-UI Unable-to-add-additional-server

eantowne avatar May 19 '21 14:05 eantowne

Hi @eantowne, thanks for reporting please check if host & port have correct values

piotrpekala7 avatar May 19 '21 14:05 piotrpekala7

They do, please refer to the screenshots below to verify that they do match.

Host-Port-for-Remote-Server Unable-to-add-additional-server

eantowne avatar May 19 '21 14:05 eantowne

Ok. Is authorization enabled on the server side?

piotrpekala7 avatar May 19 '21 14:05 piotrpekala7

Additionally, there is no issue adding additional servers via the Desktop GUI, but even then they do not show up in the Web-GUI. If I create a project in the Desktop GUI with multiple servers, I am able to open that project in the Web-GUI, and all of the servers display in the server list for that project, but not in the overall server list.

eantowne avatar May 19 '21 14:05 eantowne

No authorization is not enabled. When I enter the 192.168.1.31:3080 into the address bar of the browser, the authentication dialog does not appear, and it takes me directly to the "Projects" page. Also, HTTPS is NOT enabled as you can see from the remote Web-UI screenshot.

eantowne avatar May 19 '21 14:05 eantowne

Ok, so there is problem with checking server version, look here https://github.com/GNS3/gns3-web-ui/blob/master/src/app/components/servers/add-server-dialog/add-server-dialog.component.ts#L155

piotrpekala7 avatar May 19 '21 14:05 piotrpekala7

that's why this message https://github.com/GNS3/gns3-web-ui/blob/master/src/app/components/servers/add-server-dialog/add-server-dialog.component.ts#L166 appears

piotrpekala7 avatar May 19 '21 14:05 piotrpekala7

Request to /version endpoint https://github.com/GNS3/gns3-web-ui/blob/master/src/app/services/server.service.ts#L151 throws exception

piotrpekala7 avatar May 19 '21 14:05 piotrpekala7

check this endpoint in postman if you can or simply in browser (open developer tools -> network)

piotrpekala7 avatar May 19 '21 14:05 piotrpekala7

if this endpoint doesn't work you won't be able to add server, we have to check server version while adding cause there are differences in features

piotrpekala7 avatar May 19 '21 14:05 piotrpekala7

What is the full URL for the "/version", as http://:/version returns 404 using curl? These servers are all running the same version, as a side note.

eantowne avatar May 19 '21 14:05 eantowne

wait hang on...something weird. Give me one second.

eantowne avatar May 19 '21 14:05 eantowne

Version listed under "Release Notes" of Web-UI says current version is 2.2.19, however installed gns3-server from PPA is 2.2.21. Even if the version was 2.2.19, it should not matter, as they both display 2.2.19.

eantowne avatar May 19 '21 15:05 eantowne

Using this: http://192.168.1.31:3080/static/web-ui/version as URL returns 404.

eantowne avatar May 19 '21 15:05 eantowne

web UI version is visible in the footer of servers page and should be GNS3 Web UI © 2020 - v2.2.21 in your case

piotrpekala7 avatar May 19 '21 15:05 piotrpekala7

Using this: http://192.168.1.31:3080/static/web-ui/version as URL returns 404.

There is no such endpoint in web UI so it should return 404. It's correct

piotrpekala7 avatar May 19 '21 15:05 piotrpekala7

Ok, so, both are running 2.2.21 (just checked). So, why is it throwing an error when checking the server version?

eantowne avatar May 19 '21 15:05 eantowne

Is there a log I can look at? No applicable entries in /var/log/gns3/gns3.log, just shows "GET" to remote server with no real info.

"GET /v2/version HTTP/1.1" 200 228 "http://192.168.1.31:3080/" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:88.0) Gecko/20100101 Firefox/88.0"

This GET was from the .32 server

eantowne avatar May 19 '21 15:05 eantowne

You can find information about logs here https://docs.gns3.com/docs/using-gns3/administration/running-gns3-server-as-daemon

piotrpekala7 avatar May 19 '21 15:05 piotrpekala7

I am already looking at the log from the service (daemon). There is only one log and it is /var/log/gns3/gns3.log, however it is not providing anything useful.

eantowne avatar May 19 '21 15:05 eantowne

For instance these are the last 10 lines from the log: tail /var/log/gns3/gns3.log 2021-05-19 14:58:12 INFO web_log.py:206 192.168.1.133 [19/May/2021:14:58:12 +0000] "GET /static/web-ui/polyfills.c1fadfb88d7fb5b7f9ac.js HTTP/1.1" 200 45491 "http://192.168.1.32:3080/static/web-ui/bundled" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:88.0) Gecko/20100101 Firefox/88.0" 2021-05-19 14:58:12 INFO web_log.py:206 192.168.1.133 [19/May/2021:14:58:12 +0000] "GET /static/web-ui/styles.333203d05669b9ad3942.css HTTP/1.1" 200 301134 "http://192.168.1.32:3080/static/web-ui/bundled" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:88.0) Gecko/20100101 Firefox/88.0" 2021-05-19 14:58:12 INFO web_log.py:206 192.168.1.133 [19/May/2021:14:58:12 +0000] "GET /static/web-ui/main.2f0314a517dded67879c.js HTTP/1.1" 200 3253180 "http://192.168.1.32:3080/static/web-ui/bundled" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:88.0) Gecko/20100101 Firefox/88.0" 2021-05-19 14:58:12 INFO web_log.py:206 192.168.1.133 [19/May/2021:14:58:12 +0000] "GET /static/web-ui/roboto-latin-400.176f8f5bd5f02b3abfcf.woff2 HTTP/1.1" 200 15977 "http://192.168.1.32:3080/static/web-ui/styles.333203d05669b9ad3942.css" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:88.0) Gecko/20100101 Firefox/88.0" 2021-05-19 14:58:13 INFO web_log.py:206 192.168.1.133 [19/May/2021:14:58:13 +0000] "GET /static/web-ui/roboto-latin-500.f5b74d7ffcdf85b9dd60.woff2 HTTP/1.1" 200 16113 "http://192.168.1.32:3080/static/web-ui/styles.333203d05669b9ad3942.css" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:88.0) Gecko/20100101 Firefox/88.0" 2021-05-19 14:58:13 INFO web_log.py:206 192.168.1.133 [19/May/2021:14:58:13 +0000] "GET /static/web-ui/roboto-latin-700.c18ee39fb002ad58b6dc.woff2 HTTP/1.1" 200 16057 "http://192.168.1.32:3080/static/web-ui/styles.333203d05669b9ad3942.css" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:88.0) Gecko/20100101 Firefox/88.0" 2021-05-19 14:58:13 INFO web_log.py:206 192.168.1.133 [19/May/2021:14:58:13 +0000] "GET /static/web-ui/MaterialIcons-Regular.cff684e59ffb052d72cb.woff2 HTTP/1.1" 200 44541 "http://192.168.1.32:3080/static/web-ui/styles.333203d05669b9ad3942.css" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:88.0) Gecko/20100101 Firefox/88.0" 2021-05-19 14:58:13 INFO web_log.py:206 192.168.1.133 [19/May/2021:14:58:13 +0000] "GET /v2/projects HTTP/1.1" 200 183 "http://192.168.1.32:3080/static/web-ui/server/1/projects" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:88.0) Gecko/20100101 Firefox/88.0" 2021-05-19 15:02:42 INFO web_log.py:206 192.168.1.133 [19/May/2021:15:02:42 +0000] "GET /v2/version HTTP/1.1" 200 228 "http://192.168.1.31:3080/" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:88.0) Gecko/20100101 Firefox/88.0" 2021-05-19 15:02:51 INFO web_log.py:206 192.168.1.133 [19/May/2021:15:02:51 +0000] "GET /v2/version HTTP/1.1" 200 228 "http://192.168.1.32:3080/static/web-ui/servers" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:88.0) Gecko/20100101 Firefox/88.0"

eantowne avatar May 19 '21 15:05 eantowne

It is basically just showing the URL requested and the client ID, no actual diagnostic information.

Turned debugging on for gns3server (not running as daemon). When trying to add new server, same error message in the Web-GUI, but not even a GET to the remote server is shown.

eantowne avatar May 19 '21 15:05 eantowne

Ok, just did a packet capture. When clicking the "Add" button, there is NO traffic outbound to the remote server. I had a ping going at the same time just to verify connectivity. The only entries for the remote IP in the packet capture were the ICMP echo requests and replies.

It appears that the local server is being blocked somehow from even trying to send the query to the remote server.

eantowne avatar May 19 '21 15:05 eantowne

I just tested this again on 2 clean VM's.

Installed Ubuntu Server 20.04.2 (on both) Installed gns3-server from PPA (on both)

Same error received when attempting to add one server to the other. However, in this case, I could see the "GET /v2/version" request be received by the remote server.

I could see the response that was sent back. {'local': False, 'version': '2.2.21'}.

Based on the logic in https://github.com/GNS3/gns3-web-ui/blob/bb2a9632374c8877ad617024d0f2417ec298ca71/src/app/components/servers/add-server-dialog/add-server-dialog.component.ts#L155, then it is not getting the proper information in the "serverInfo" object from the this.serverService.checkServerVersion(server).subscribe() function. Otherwise the split and logic would be working.

Tomorrow I will do some testing with other versions to see if I can see where the difference is.

ean-towne avatar May 20 '21 03:05 ean-towne

More testing completed. Same issue going back for each version since 2.2.18. Did not test further than that.

  • Tested same versions against each other and multiple different versions mix and matched between each other.
  • Tested servers running on same hosts.
  • Tested server running on different hosts.
  • All servers were able to ping each other.
  • IP's and ports verified.

In all cases same result.

eantowne avatar May 20 '21 18:05 eantowne

I'm really thankful for your investigation. Still I have no idea what could be the reason...

piotrpekala7 avatar May 21 '21 13:05 piotrpekala7

I have not yet setup my dev environment completely, so I am unable to execute what I am going to propose, but maybe you could try it?

Add some debug output, or log output, that provides more detail as to what is going on in the entire process to get the serverInfo value. We know that it is reaching out successfully, because the remote server is receiving, not sure if it is responding correctly, other than seeing the value that is sent via debug in the log. I will do a packet capture later and see if I can validate that the response is actually traversing the network correctly. At that point the only thing is to look at what the response received looks like to the primary server.

eantowne avatar May 21 '21 13:05 eantowne

Yes, I added logging in add-server-dialog-component but this doesn't provide me more information

this.serverService.checkServerVersion(server).subscribe(
  (serverInfo) => {
    console.log(serverInfo);
    
    if (serverInfo.version.split('.')[1] >= 2 && serverInfo.version.split('.')[0] >= 2) {
      this.dialogRef.close(server);
      this.toasterService.success(`Server ${server.name} added.`);
    } else {
      this.dialogRef.close();
      this.toasterService.error(`Server version is not supported.`);
    }
  },
  (error) => {
    this.toasterService.error('Cannot connect to the server: ' + error);
  }
);

piotrpekala7 avatar May 24 '21 15:05 piotrpekala7

we should receive

local: false version: "2.2.21"

from server

piotrpekala7 avatar May 24 '21 15:05 piotrpekala7

I am right in the middle of rearranging my office. I forgot to do the packet capture, but will do it in a little while. Do the console.log line under the (error) as your line never gets called due to it retiring I believe.

Get Outlook for iOShttps://aka.ms/o0ukef


From: piotrpekala7 @.> Sent: Monday, May 24, 2021 10:19:09 AM To: GNS3/gns3-web-ui @.> Cc: ean-towne @.>; Comment @.> Subject: Re: [GNS3/gns3-web-ui] Unable to add additional servers, "Cannot connect to the server: Error: Server is unreachable" (#1145)

we should receive

local: false version: "2.2.21"

from server

— You are receiving this because you commented. Reply to this email directly, view it on GitHubhttps://emea01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2FGNS3%2Fgns3-web-ui%2Fissues%2F1145%23issuecomment-847115612&data=04%7C01%7C%7Cb22529cd667a4cafae8908d91ec747be%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637574663506027168%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=3T23TFvo8xZHJeupZ%2FVKl7jNJD4Kt06Xc0hFlyZxOrQ%3D&reserved=0, or unsubscribehttps://emea01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAUERMZURVBFPQ4NY5FLFTZDTPJU63ANCNFSM45E2LRUA&data=04%7C01%7C%7Cb22529cd667a4cafae8908d91ec747be%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637574663506037161%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=Jj%2B9rzYN8BLyiKKn45fyrP38r%2Bp8vDQW4U9H3NUkiPk%3D&reserved=0.

ean-towne avatar May 24 '21 19:05 ean-towne