1

When I try to ping my apache2 server (running on Ubuntu Server 16.04) with its domain name, it succeeds from any computer.

However, if I try to access it with a browser, or use ssh, the server is not found. Curling doesn't even give an error message, even if I wait a while.

I have a static ip set behind a router. When I curl localhost I get the expected result. When I curl or ping any website other than the server itself I get the expected result.

This problem appeared after adding dns servers to the network configuration file. However, removing that line does not fix the issue, even after multiple reboots.

Edit: I checked that the correct ports were open on the router, the firewall, and used netstat to check that apache was listening on the correct ports.

2
  • 2
    Try to open port 80 and 22 (http/ssh) in your firewall.
    – pa4080
    May 30, 2018 at 7:06
  • 2
    They are open on the firewall and forwarded on the router.
    – A. Powell
    May 30, 2018 at 13:53

3 Answers 3

3

Did you ever try checking the ports with nmap?

nmap -sT <IP-ADRESS>

should show the ports on the server.

e.g.

nmap -sT XXX.XXX.XXX.XXX

Starting Nmap 7.01 ( https://nmap.org ) at 2018-05-30 00:06 CEST
Nmap scan report for XXX.XXX.XXX.XXX
Host is up (0.034s latency).
Not shown: 990 closed ports
PORT     STATE SERVICE
21/tcp   open  ftp
53/tcp   open  domain
80/tcp   open  http
139/tcp  open  netbios-ssn
443/tcp  open  https
445/tcp  open  microsoft-ds
2002/tcp open  globe
5060/tcp open  sip
8089/tcp open  unknown
8181/tcp open  unknown

Nmap done: 1 IP address (1 host up) scanned in 3.84 seconds
1
  • The result with the public ip was "Host seems down. If it is really up, but blocking our ping probes, try -Pn". I tried that, and it just hung for a couple of minutes before I ended it. When I run it using the local ip address it says ssh, http, and https are open.
    – A. Powell
    May 30, 2018 at 13:59
2

The problem was that the IP address changed. Apparently I didn't properly set that up somehow. I could ping because I was pinging some random other computer. If I figure out what was wrong with that I'll add it to this question.

0

Assuming one wants to connect from Windows host to Linux VM, for ssh login or to browse a web server

  • If you are on Virtualbox/VMware, ensure you have selected "Bridged Adapter". This can be usually done by selecting Machine -> Network -> Adapter 1 -> Attached To -> Bridged Adapter.
  • Now on the Linux VM, open Terminal and run the ifconfig command to get its IP address (the inet address may look something like 192.168.1.79)
  • On the same Linux VM, ensure ports are open. On Ubuntu, you can run the below "uncomplicated firewall" commands to open the ports :
sudo -s
ufw allow 22/tcp
ufw allow 3000:9000/tcp

The above lets you login as root, and then allow

  • port 22 for ssh and
  • port range 3000 to 9000 for mysql or any other tcp/http server ports

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .