why `nmap 192.168.1.97` returns less services than `nmap 127.0.0.1`? [duplicate] Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30pm US/Eastern) 2019 Community Moderator Election Results Why I closed the “Why is Kali so hard” questionDifference between `nmap local-IP-address` and `nmap localhost`Doing nmap on a networkCan you send a TCP packet with RST flag set using IPTABLES as a way to trick NMAP into thinking a port is closed?How to tell stateful vs stateless firewall with nmap ACK scanWhy nmap closed my connection?telnet to an host/port works while no service on this host listening on this portnmap raw packet privileges not working (“operation not permitted”, even as root)Why REJECT slows nmap?Exhaustive list of REASONs why a host/server might be down (nmap --reason)What are those “unknown” services listed by nmap?

What does the writing on Poe's helmet say?

"Destructive power" carried by a B-52?

Marquee sign letters

How to make triangles with rounded sides and corners? (squircle with 3 sides)

3D Masyu - A Die

A proverb that is used to imply that you have unexpectedly faced a big problem

Is "ゲーム中に使用する" a descriptor in "ゲーム中に使用する最大HPを書き写す"?

When does a function NOT have an antiderivative?

Weaponising the Grasp-at-a-Distance spell

In musical terms, what properties are varied by the human voice to produce different words / syllables?

Is Normal(mean, variance) mod x still a normal distribution?

latest version of QGIS fails to edit attribute table of GeoJSON file

As a dual citizen, my US passport will expire one day after traveling to the US. Will this work?

Flight departed from the gate 5 min before scheduled departure time. Refund options

Why BitLocker does not use RSA

.bashrc alias for a command with fixed second parameter

Maximum duration for Canada's short term visas?

Did John Wesley plagiarize Matthew Henry...?

What are some likely causes to domain member PC losing contact to domain controller?

Why not use the yoke to control yaw, as well as pitch and roll?

Should a wizard buy fine inks every time he want to copy spells into his spellbook?

Is the time—manner—place ordering of adverbials an oversimplification?

How does the body cool itself in a stillsuit?

How could a hydrazine and N2O4 cloud (or it's reactants) show up in weather radar?



why `nmap 192.168.1.97` returns less services than `nmap 127.0.0.1`? [duplicate]



Announcing the arrival of Valued Associate #679: Cesar Manara
Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30pm US/Eastern)
2019 Community Moderator Election Results
Why I closed the “Why is Kali so hard” questionDifference between `nmap local-IP-address` and `nmap localhost`Doing nmap on a networkCan you send a TCP packet with RST flag set using IPTABLES as a way to trick NMAP into thinking a port is closed?How to tell stateful vs stateless firewall with nmap ACK scanWhy nmap closed my connection?telnet to an host/port works while no service on this host listening on this portnmap raw packet privileges not working (“operation not permitted”, even as root)Why REJECT slows nmap?Exhaustive list of REASONs why a host/server might be down (nmap --reason)What are those “unknown” services listed by nmap?



.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








7
















This question already has an answer here:



  • Difference between `nmap local-IP-address` and `nmap localhost`

    3 answers



According to https://networkengineering.stackexchange.com/a/57909/, a packet sent to 192.168.1.97 "doesn't leave the host but is treated like a packet received from the network, addressed to 192.168.1.97." So same as sending a packet to loop back 127.0.0.1.



why does nmap 127.0.0.1 return more services than nmap 192.168.1.97?



Does nmap 127.0.0.1 necessarily also return those services returned by nmap 192.168.1.97? Does a server listening at 192.168.1.97 necessarily also listen at 127.0.0.1?



$ nmap -p0-65535 192.168.1.97

Starting Nmap 7.60 ( https://nmap.org ) at 2019-03-23 19:18 EDT
Nmap scan report for ocean (192.168.1.97)
Host is up (0.00039s latency).
Not shown: 65532 closed ports
PORT STATE SERVICE
22/tcp open ssh
111/tcp open rpcbind
3306/tcp open mysql
33060/tcp open mysqlx

Nmap done: 1 IP address (1 host up) scanned in 9.55 seconds

$ nmap -p0-65535 localhost

Starting Nmap 7.60 ( https://nmap.org ) at 2019-03-23 19:18 EDT
Nmap scan report for localhost (127.0.0.1)
Host is up (0.00033s latency).
Other addresses for localhost (not scanned):
Not shown: 65529 closed ports
PORT STATE SERVICE
22/tcp open ssh
111/tcp open rpcbind
631/tcp open ipp
3306/tcp open mysql
5432/tcp open postgresql
9050/tcp open tor-socks
33060/tcp open mysqlx

Nmap done: 1 IP address (1 host up) scanned in 5.39 seconds


Thanks.










share|improve this question















marked as duplicate by Jeff Schaller, Michael Homer, Stephen Harris, jimmij, Gilles Mar 24 at 23:30


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.


















  • Because not all services are listening on the external interface?

    – Kusalananda
    Mar 23 at 22:57











  • Seems to me that Rui's Answer there applies here.

    – Jeff Schaller
    Mar 23 at 23:20











  • @Kusalananda In particular, does nmap 127.0.0.1 necessarily also return those services returned by nmap 192.168.1.97? Does a server listening at 192.168.1.97 necessarily also listen at 127.0.0.1?

    – Tim
    Mar 23 at 23:21












  • They're different addresses, why would a server listening at 192.168.1.97 necessarily also listen at 127.0.0.1?

    – 炸鱼薯条德里克
    Mar 24 at 1:35











  • Somehow, I don't think the other guy on Network Engineering answered correctly. When you specify an ip address to send packet, it would have to go to router to be . . . routed, duh. But localhost would be resolved to 127.0.0.1 just like 127.0.0.1 itself would be understood as loopback.

    – Sergiy Kolodyazhnyy
    Mar 24 at 5:03

















7
















This question already has an answer here:



  • Difference between `nmap local-IP-address` and `nmap localhost`

    3 answers



According to https://networkengineering.stackexchange.com/a/57909/, a packet sent to 192.168.1.97 "doesn't leave the host but is treated like a packet received from the network, addressed to 192.168.1.97." So same as sending a packet to loop back 127.0.0.1.



why does nmap 127.0.0.1 return more services than nmap 192.168.1.97?



Does nmap 127.0.0.1 necessarily also return those services returned by nmap 192.168.1.97? Does a server listening at 192.168.1.97 necessarily also listen at 127.0.0.1?



$ nmap -p0-65535 192.168.1.97

Starting Nmap 7.60 ( https://nmap.org ) at 2019-03-23 19:18 EDT
Nmap scan report for ocean (192.168.1.97)
Host is up (0.00039s latency).
Not shown: 65532 closed ports
PORT STATE SERVICE
22/tcp open ssh
111/tcp open rpcbind
3306/tcp open mysql
33060/tcp open mysqlx

Nmap done: 1 IP address (1 host up) scanned in 9.55 seconds

$ nmap -p0-65535 localhost

Starting Nmap 7.60 ( https://nmap.org ) at 2019-03-23 19:18 EDT
Nmap scan report for localhost (127.0.0.1)
Host is up (0.00033s latency).
Other addresses for localhost (not scanned):
Not shown: 65529 closed ports
PORT STATE SERVICE
22/tcp open ssh
111/tcp open rpcbind
631/tcp open ipp
3306/tcp open mysql
5432/tcp open postgresql
9050/tcp open tor-socks
33060/tcp open mysqlx

Nmap done: 1 IP address (1 host up) scanned in 5.39 seconds


Thanks.










share|improve this question















marked as duplicate by Jeff Schaller, Michael Homer, Stephen Harris, jimmij, Gilles Mar 24 at 23:30


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.


















  • Because not all services are listening on the external interface?

    – Kusalananda
    Mar 23 at 22:57











  • Seems to me that Rui's Answer there applies here.

    – Jeff Schaller
    Mar 23 at 23:20











  • @Kusalananda In particular, does nmap 127.0.0.1 necessarily also return those services returned by nmap 192.168.1.97? Does a server listening at 192.168.1.97 necessarily also listen at 127.0.0.1?

    – Tim
    Mar 23 at 23:21












  • They're different addresses, why would a server listening at 192.168.1.97 necessarily also listen at 127.0.0.1?

    – 炸鱼薯条德里克
    Mar 24 at 1:35











  • Somehow, I don't think the other guy on Network Engineering answered correctly. When you specify an ip address to send packet, it would have to go to router to be . . . routed, duh. But localhost would be resolved to 127.0.0.1 just like 127.0.0.1 itself would be understood as loopback.

    – Sergiy Kolodyazhnyy
    Mar 24 at 5:03













7












7








7









This question already has an answer here:



  • Difference between `nmap local-IP-address` and `nmap localhost`

    3 answers



According to https://networkengineering.stackexchange.com/a/57909/, a packet sent to 192.168.1.97 "doesn't leave the host but is treated like a packet received from the network, addressed to 192.168.1.97." So same as sending a packet to loop back 127.0.0.1.



why does nmap 127.0.0.1 return more services than nmap 192.168.1.97?



Does nmap 127.0.0.1 necessarily also return those services returned by nmap 192.168.1.97? Does a server listening at 192.168.1.97 necessarily also listen at 127.0.0.1?



$ nmap -p0-65535 192.168.1.97

Starting Nmap 7.60 ( https://nmap.org ) at 2019-03-23 19:18 EDT
Nmap scan report for ocean (192.168.1.97)
Host is up (0.00039s latency).
Not shown: 65532 closed ports
PORT STATE SERVICE
22/tcp open ssh
111/tcp open rpcbind
3306/tcp open mysql
33060/tcp open mysqlx

Nmap done: 1 IP address (1 host up) scanned in 9.55 seconds

$ nmap -p0-65535 localhost

Starting Nmap 7.60 ( https://nmap.org ) at 2019-03-23 19:18 EDT
Nmap scan report for localhost (127.0.0.1)
Host is up (0.00033s latency).
Other addresses for localhost (not scanned):
Not shown: 65529 closed ports
PORT STATE SERVICE
22/tcp open ssh
111/tcp open rpcbind
631/tcp open ipp
3306/tcp open mysql
5432/tcp open postgresql
9050/tcp open tor-socks
33060/tcp open mysqlx

Nmap done: 1 IP address (1 host up) scanned in 5.39 seconds


Thanks.










share|improve this question

















This question already has an answer here:



  • Difference between `nmap local-IP-address` and `nmap localhost`

    3 answers



According to https://networkengineering.stackexchange.com/a/57909/, a packet sent to 192.168.1.97 "doesn't leave the host but is treated like a packet received from the network, addressed to 192.168.1.97." So same as sending a packet to loop back 127.0.0.1.



why does nmap 127.0.0.1 return more services than nmap 192.168.1.97?



Does nmap 127.0.0.1 necessarily also return those services returned by nmap 192.168.1.97? Does a server listening at 192.168.1.97 necessarily also listen at 127.0.0.1?



$ nmap -p0-65535 192.168.1.97

Starting Nmap 7.60 ( https://nmap.org ) at 2019-03-23 19:18 EDT
Nmap scan report for ocean (192.168.1.97)
Host is up (0.00039s latency).
Not shown: 65532 closed ports
PORT STATE SERVICE
22/tcp open ssh
111/tcp open rpcbind
3306/tcp open mysql
33060/tcp open mysqlx

Nmap done: 1 IP address (1 host up) scanned in 9.55 seconds

$ nmap -p0-65535 localhost

Starting Nmap 7.60 ( https://nmap.org ) at 2019-03-23 19:18 EDT
Nmap scan report for localhost (127.0.0.1)
Host is up (0.00033s latency).
Other addresses for localhost (not scanned):
Not shown: 65529 closed ports
PORT STATE SERVICE
22/tcp open ssh
111/tcp open rpcbind
631/tcp open ipp
3306/tcp open mysql
5432/tcp open postgresql
9050/tcp open tor-socks
33060/tcp open mysqlx

Nmap done: 1 IP address (1 host up) scanned in 5.39 seconds


Thanks.





This question already has an answer here:



  • Difference between `nmap local-IP-address` and `nmap localhost`

    3 answers







nmap ip-address loopback






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Mar 24 at 21:48







Tim

















asked Mar 23 at 22:52









TimTim

28.9k79270495




28.9k79270495




marked as duplicate by Jeff Schaller, Michael Homer, Stephen Harris, jimmij, Gilles Mar 24 at 23:30


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.









marked as duplicate by Jeff Schaller, Michael Homer, Stephen Harris, jimmij, Gilles Mar 24 at 23:30


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.














  • Because not all services are listening on the external interface?

    – Kusalananda
    Mar 23 at 22:57











  • Seems to me that Rui's Answer there applies here.

    – Jeff Schaller
    Mar 23 at 23:20











  • @Kusalananda In particular, does nmap 127.0.0.1 necessarily also return those services returned by nmap 192.168.1.97? Does a server listening at 192.168.1.97 necessarily also listen at 127.0.0.1?

    – Tim
    Mar 23 at 23:21












  • They're different addresses, why would a server listening at 192.168.1.97 necessarily also listen at 127.0.0.1?

    – 炸鱼薯条德里克
    Mar 24 at 1:35











  • Somehow, I don't think the other guy on Network Engineering answered correctly. When you specify an ip address to send packet, it would have to go to router to be . . . routed, duh. But localhost would be resolved to 127.0.0.1 just like 127.0.0.1 itself would be understood as loopback.

    – Sergiy Kolodyazhnyy
    Mar 24 at 5:03

















  • Because not all services are listening on the external interface?

    – Kusalananda
    Mar 23 at 22:57











  • Seems to me that Rui's Answer there applies here.

    – Jeff Schaller
    Mar 23 at 23:20











  • @Kusalananda In particular, does nmap 127.0.0.1 necessarily also return those services returned by nmap 192.168.1.97? Does a server listening at 192.168.1.97 necessarily also listen at 127.0.0.1?

    – Tim
    Mar 23 at 23:21












  • They're different addresses, why would a server listening at 192.168.1.97 necessarily also listen at 127.0.0.1?

    – 炸鱼薯条德里克
    Mar 24 at 1:35











  • Somehow, I don't think the other guy on Network Engineering answered correctly. When you specify an ip address to send packet, it would have to go to router to be . . . routed, duh. But localhost would be resolved to 127.0.0.1 just like 127.0.0.1 itself would be understood as loopback.

    – Sergiy Kolodyazhnyy
    Mar 24 at 5:03
















Because not all services are listening on the external interface?

– Kusalananda
Mar 23 at 22:57





Because not all services are listening on the external interface?

– Kusalananda
Mar 23 at 22:57













Seems to me that Rui's Answer there applies here.

– Jeff Schaller
Mar 23 at 23:20





Seems to me that Rui's Answer there applies here.

– Jeff Schaller
Mar 23 at 23:20













@Kusalananda In particular, does nmap 127.0.0.1 necessarily also return those services returned by nmap 192.168.1.97? Does a server listening at 192.168.1.97 necessarily also listen at 127.0.0.1?

– Tim
Mar 23 at 23:21






@Kusalananda In particular, does nmap 127.0.0.1 necessarily also return those services returned by nmap 192.168.1.97? Does a server listening at 192.168.1.97 necessarily also listen at 127.0.0.1?

– Tim
Mar 23 at 23:21














They're different addresses, why would a server listening at 192.168.1.97 necessarily also listen at 127.0.0.1?

– 炸鱼薯条德里克
Mar 24 at 1:35





They're different addresses, why would a server listening at 192.168.1.97 necessarily also listen at 127.0.0.1?

– 炸鱼薯条德里克
Mar 24 at 1:35













Somehow, I don't think the other guy on Network Engineering answered correctly. When you specify an ip address to send packet, it would have to go to router to be . . . routed, duh. But localhost would be resolved to 127.0.0.1 just like 127.0.0.1 itself would be understood as loopback.

– Sergiy Kolodyazhnyy
Mar 24 at 5:03





Somehow, I don't think the other guy on Network Engineering answered correctly. When you specify an ip address to send packet, it would have to go to router to be . . . routed, duh. But localhost would be resolved to 127.0.0.1 just like 127.0.0.1 itself would be understood as loopback.

– Sergiy Kolodyazhnyy
Mar 24 at 5:03










4 Answers
4






active

oldest

votes


















8














In short, they are two different interfaces (192.168.1.97 vs 127.0.0.1), and may have different firewall rules applied and/or services listening. Being on the same machine means relatively little.






share|improve this answer























  • Thanks. Does nmap -p0-65535 0.0.0.0 scan all the IP addresses on the local host, and report services listening at ports at all these IP addresses including 192.168.1.97 and 127.0.0.1?

    – Tim
    Mar 24 at 21:53











  • No. It scans only a single IP address, 0.0.0.0. Which is not really a valid host IP.

    – John
    Mar 25 at 1:39


















7














No, a service listening to a port on an external interface does not necessarily also listen on that port on localhost.



You can test this with something like



nc -l external-ip-address port-number


Then run nmap against localhost, then against the external IP address.






share|improve this answer























  • Thanks. What do you mean by an "external interface"? What is an "internal interface"? The IP address 192.168.1.97 in my post is private (internal), not public (external).

    – Tim
    Mar 24 at 21:50












  • @Tim By "external" interface, I meant "an interface that is accessible from the outside", as opposed to an internal interface, the loopback interface. I believe I might have used the terms quite loosely to differentiate externally available services (services listening to an address that is externally visible) and services only available on 127.0.0.1.

    – Kusalananda
    Mar 24 at 21:54


















6















why does nmap 127.0.0.1 return more services than nmap 192.168.1.97?




Because to improve security many services are configured by default to only listen on 127.0.0.1 (and/or the IPv6 equivilent ::1)




Does a server listening at 192.168.1.97 necessarily also listen at 127.0.0.1?




No



Generally a service can create a listening socket to listen on.



  1. A specific IP, such a listening socket will only accept traffic destined for that specific IP.

  2. 0.0.0.0 , this will accept traffic to all IPv4 IPs assigned to the machine.

  3. :: this will accept traffic to all IPv6 IPs assigned to the machine. It may or may not accept traffic destined to IPv4 IPs on the machine depending on the particular OS, system wide configuration and socket-specific options.





share|improve this answer






























    2














    The 127-type of address is internal only, as per RFC1122:




    Internal host loopback address. Addresses of this form
    MUST NOT appear outside a host.




    This means that those services are listening locally. The 192.168.1.97 is your public-facing address, and that's how router and other computers know you. The 127.0.0.1/8 in a sense is a "simulation" of a network. You can test things with it, you can run local services on and exchange packets between them - essentially same things as you'd do with an actual internet resource. In fact, that's what web developers do: they set up local environment and run XAMP or LAMP stack locally before moving on to production environment when polished product will actually face the internet.



    Now, it should not happen that you receive a packet from 127.x.x.x type of address on public facing interface like eth0 or wlan0. If that happens, this is called Martian packet, and it's likely that someone is trying to attack your host or network.



    In a certain sense you could make it an analogy between your router and your computer. On LAN, your router has 192.168.1.0 address, but to the internet it is known as 68.125.xx.yy ( disclamer: random example, not an actual IP address intended here ). The router might expose to the internet only port 53 ( DNS ), but internally you could have port 80 ( HTTP control panel ) and 53. Same idea with your computer.



    Of course, the services would have to be configured to listen on either public or local interface only. For instance, Redis server comes preconfigured to listen only on 127.0.0.1, because security reasons.



    See also



    • What is the difference between 0.0.0.0 and a loopback IP address?

    • Wikipedia's article about localhost





    share|improve this answer





























      4 Answers
      4






      active

      oldest

      votes








      4 Answers
      4






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes









      8














      In short, they are two different interfaces (192.168.1.97 vs 127.0.0.1), and may have different firewall rules applied and/or services listening. Being on the same machine means relatively little.






      share|improve this answer























      • Thanks. Does nmap -p0-65535 0.0.0.0 scan all the IP addresses on the local host, and report services listening at ports at all these IP addresses including 192.168.1.97 and 127.0.0.1?

        – Tim
        Mar 24 at 21:53











      • No. It scans only a single IP address, 0.0.0.0. Which is not really a valid host IP.

        – John
        Mar 25 at 1:39















      8














      In short, they are two different interfaces (192.168.1.97 vs 127.0.0.1), and may have different firewall rules applied and/or services listening. Being on the same machine means relatively little.






      share|improve this answer























      • Thanks. Does nmap -p0-65535 0.0.0.0 scan all the IP addresses on the local host, and report services listening at ports at all these IP addresses including 192.168.1.97 and 127.0.0.1?

        – Tim
        Mar 24 at 21:53











      • No. It scans only a single IP address, 0.0.0.0. Which is not really a valid host IP.

        – John
        Mar 25 at 1:39













      8












      8








      8







      In short, they are two different interfaces (192.168.1.97 vs 127.0.0.1), and may have different firewall rules applied and/or services listening. Being on the same machine means relatively little.






      share|improve this answer













      In short, they are two different interfaces (192.168.1.97 vs 127.0.0.1), and may have different firewall rules applied and/or services listening. Being on the same machine means relatively little.







      share|improve this answer












      share|improve this answer



      share|improve this answer










      answered Mar 24 at 0:16









      JohnJohn

      11.9k11931




      11.9k11931












      • Thanks. Does nmap -p0-65535 0.0.0.0 scan all the IP addresses on the local host, and report services listening at ports at all these IP addresses including 192.168.1.97 and 127.0.0.1?

        – Tim
        Mar 24 at 21:53











      • No. It scans only a single IP address, 0.0.0.0. Which is not really a valid host IP.

        – John
        Mar 25 at 1:39

















      • Thanks. Does nmap -p0-65535 0.0.0.0 scan all the IP addresses on the local host, and report services listening at ports at all these IP addresses including 192.168.1.97 and 127.0.0.1?

        – Tim
        Mar 24 at 21:53











      • No. It scans only a single IP address, 0.0.0.0. Which is not really a valid host IP.

        – John
        Mar 25 at 1:39
















      Thanks. Does nmap -p0-65535 0.0.0.0 scan all the IP addresses on the local host, and report services listening at ports at all these IP addresses including 192.168.1.97 and 127.0.0.1?

      – Tim
      Mar 24 at 21:53





      Thanks. Does nmap -p0-65535 0.0.0.0 scan all the IP addresses on the local host, and report services listening at ports at all these IP addresses including 192.168.1.97 and 127.0.0.1?

      – Tim
      Mar 24 at 21:53













      No. It scans only a single IP address, 0.0.0.0. Which is not really a valid host IP.

      – John
      Mar 25 at 1:39





      No. It scans only a single IP address, 0.0.0.0. Which is not really a valid host IP.

      – John
      Mar 25 at 1:39













      7














      No, a service listening to a port on an external interface does not necessarily also listen on that port on localhost.



      You can test this with something like



      nc -l external-ip-address port-number


      Then run nmap against localhost, then against the external IP address.






      share|improve this answer























      • Thanks. What do you mean by an "external interface"? What is an "internal interface"? The IP address 192.168.1.97 in my post is private (internal), not public (external).

        – Tim
        Mar 24 at 21:50












      • @Tim By "external" interface, I meant "an interface that is accessible from the outside", as opposed to an internal interface, the loopback interface. I believe I might have used the terms quite loosely to differentiate externally available services (services listening to an address that is externally visible) and services only available on 127.0.0.1.

        – Kusalananda
        Mar 24 at 21:54















      7














      No, a service listening to a port on an external interface does not necessarily also listen on that port on localhost.



      You can test this with something like



      nc -l external-ip-address port-number


      Then run nmap against localhost, then against the external IP address.






      share|improve this answer























      • Thanks. What do you mean by an "external interface"? What is an "internal interface"? The IP address 192.168.1.97 in my post is private (internal), not public (external).

        – Tim
        Mar 24 at 21:50












      • @Tim By "external" interface, I meant "an interface that is accessible from the outside", as opposed to an internal interface, the loopback interface. I believe I might have used the terms quite loosely to differentiate externally available services (services listening to an address that is externally visible) and services only available on 127.0.0.1.

        – Kusalananda
        Mar 24 at 21:54













      7












      7








      7







      No, a service listening to a port on an external interface does not necessarily also listen on that port on localhost.



      You can test this with something like



      nc -l external-ip-address port-number


      Then run nmap against localhost, then against the external IP address.






      share|improve this answer













      No, a service listening to a port on an external interface does not necessarily also listen on that port on localhost.



      You can test this with something like



      nc -l external-ip-address port-number


      Then run nmap against localhost, then against the external IP address.







      share|improve this answer












      share|improve this answer



      share|improve this answer










      answered Mar 23 at 23:35









      KusalanandaKusalananda

      143k18266443




      143k18266443












      • Thanks. What do you mean by an "external interface"? What is an "internal interface"? The IP address 192.168.1.97 in my post is private (internal), not public (external).

        – Tim
        Mar 24 at 21:50












      • @Tim By "external" interface, I meant "an interface that is accessible from the outside", as opposed to an internal interface, the loopback interface. I believe I might have used the terms quite loosely to differentiate externally available services (services listening to an address that is externally visible) and services only available on 127.0.0.1.

        – Kusalananda
        Mar 24 at 21:54

















      • Thanks. What do you mean by an "external interface"? What is an "internal interface"? The IP address 192.168.1.97 in my post is private (internal), not public (external).

        – Tim
        Mar 24 at 21:50












      • @Tim By "external" interface, I meant "an interface that is accessible from the outside", as opposed to an internal interface, the loopback interface. I believe I might have used the terms quite loosely to differentiate externally available services (services listening to an address that is externally visible) and services only available on 127.0.0.1.

        – Kusalananda
        Mar 24 at 21:54
















      Thanks. What do you mean by an "external interface"? What is an "internal interface"? The IP address 192.168.1.97 in my post is private (internal), not public (external).

      – Tim
      Mar 24 at 21:50






      Thanks. What do you mean by an "external interface"? What is an "internal interface"? The IP address 192.168.1.97 in my post is private (internal), not public (external).

      – Tim
      Mar 24 at 21:50














      @Tim By "external" interface, I meant "an interface that is accessible from the outside", as opposed to an internal interface, the loopback interface. I believe I might have used the terms quite loosely to differentiate externally available services (services listening to an address that is externally visible) and services only available on 127.0.0.1.

      – Kusalananda
      Mar 24 at 21:54





      @Tim By "external" interface, I meant "an interface that is accessible from the outside", as opposed to an internal interface, the loopback interface. I believe I might have used the terms quite loosely to differentiate externally available services (services listening to an address that is externally visible) and services only available on 127.0.0.1.

      – Kusalananda
      Mar 24 at 21:54











      6















      why does nmap 127.0.0.1 return more services than nmap 192.168.1.97?




      Because to improve security many services are configured by default to only listen on 127.0.0.1 (and/or the IPv6 equivilent ::1)




      Does a server listening at 192.168.1.97 necessarily also listen at 127.0.0.1?




      No



      Generally a service can create a listening socket to listen on.



      1. A specific IP, such a listening socket will only accept traffic destined for that specific IP.

      2. 0.0.0.0 , this will accept traffic to all IPv4 IPs assigned to the machine.

      3. :: this will accept traffic to all IPv6 IPs assigned to the machine. It may or may not accept traffic destined to IPv4 IPs on the machine depending on the particular OS, system wide configuration and socket-specific options.





      share|improve this answer



























        6















        why does nmap 127.0.0.1 return more services than nmap 192.168.1.97?




        Because to improve security many services are configured by default to only listen on 127.0.0.1 (and/or the IPv6 equivilent ::1)




        Does a server listening at 192.168.1.97 necessarily also listen at 127.0.0.1?




        No



        Generally a service can create a listening socket to listen on.



        1. A specific IP, such a listening socket will only accept traffic destined for that specific IP.

        2. 0.0.0.0 , this will accept traffic to all IPv4 IPs assigned to the machine.

        3. :: this will accept traffic to all IPv6 IPs assigned to the machine. It may or may not accept traffic destined to IPv4 IPs on the machine depending on the particular OS, system wide configuration and socket-specific options.





        share|improve this answer

























          6












          6








          6








          why does nmap 127.0.0.1 return more services than nmap 192.168.1.97?




          Because to improve security many services are configured by default to only listen on 127.0.0.1 (and/or the IPv6 equivilent ::1)




          Does a server listening at 192.168.1.97 necessarily also listen at 127.0.0.1?




          No



          Generally a service can create a listening socket to listen on.



          1. A specific IP, such a listening socket will only accept traffic destined for that specific IP.

          2. 0.0.0.0 , this will accept traffic to all IPv4 IPs assigned to the machine.

          3. :: this will accept traffic to all IPv6 IPs assigned to the machine. It may or may not accept traffic destined to IPv4 IPs on the machine depending on the particular OS, system wide configuration and socket-specific options.





          share|improve this answer














          why does nmap 127.0.0.1 return more services than nmap 192.168.1.97?




          Because to improve security many services are configured by default to only listen on 127.0.0.1 (and/or the IPv6 equivilent ::1)




          Does a server listening at 192.168.1.97 necessarily also listen at 127.0.0.1?




          No



          Generally a service can create a listening socket to listen on.



          1. A specific IP, such a listening socket will only accept traffic destined for that specific IP.

          2. 0.0.0.0 , this will accept traffic to all IPv4 IPs assigned to the machine.

          3. :: this will accept traffic to all IPv6 IPs assigned to the machine. It may or may not accept traffic destined to IPv4 IPs on the machine depending on the particular OS, system wide configuration and socket-specific options.






          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Mar 24 at 1:03









          plugwashplugwash

          1,950619




          1,950619





















              2














              The 127-type of address is internal only, as per RFC1122:




              Internal host loopback address. Addresses of this form
              MUST NOT appear outside a host.




              This means that those services are listening locally. The 192.168.1.97 is your public-facing address, and that's how router and other computers know you. The 127.0.0.1/8 in a sense is a "simulation" of a network. You can test things with it, you can run local services on and exchange packets between them - essentially same things as you'd do with an actual internet resource. In fact, that's what web developers do: they set up local environment and run XAMP or LAMP stack locally before moving on to production environment when polished product will actually face the internet.



              Now, it should not happen that you receive a packet from 127.x.x.x type of address on public facing interface like eth0 or wlan0. If that happens, this is called Martian packet, and it's likely that someone is trying to attack your host or network.



              In a certain sense you could make it an analogy between your router and your computer. On LAN, your router has 192.168.1.0 address, but to the internet it is known as 68.125.xx.yy ( disclamer: random example, not an actual IP address intended here ). The router might expose to the internet only port 53 ( DNS ), but internally you could have port 80 ( HTTP control panel ) and 53. Same idea with your computer.



              Of course, the services would have to be configured to listen on either public or local interface only. For instance, Redis server comes preconfigured to listen only on 127.0.0.1, because security reasons.



              See also



              • What is the difference between 0.0.0.0 and a loopback IP address?

              • Wikipedia's article about localhost





              share|improve this answer



























                2














                The 127-type of address is internal only, as per RFC1122:




                Internal host loopback address. Addresses of this form
                MUST NOT appear outside a host.




                This means that those services are listening locally. The 192.168.1.97 is your public-facing address, and that's how router and other computers know you. The 127.0.0.1/8 in a sense is a "simulation" of a network. You can test things with it, you can run local services on and exchange packets between them - essentially same things as you'd do with an actual internet resource. In fact, that's what web developers do: they set up local environment and run XAMP or LAMP stack locally before moving on to production environment when polished product will actually face the internet.



                Now, it should not happen that you receive a packet from 127.x.x.x type of address on public facing interface like eth0 or wlan0. If that happens, this is called Martian packet, and it's likely that someone is trying to attack your host or network.



                In a certain sense you could make it an analogy between your router and your computer. On LAN, your router has 192.168.1.0 address, but to the internet it is known as 68.125.xx.yy ( disclamer: random example, not an actual IP address intended here ). The router might expose to the internet only port 53 ( DNS ), but internally you could have port 80 ( HTTP control panel ) and 53. Same idea with your computer.



                Of course, the services would have to be configured to listen on either public or local interface only. For instance, Redis server comes preconfigured to listen only on 127.0.0.1, because security reasons.



                See also



                • What is the difference between 0.0.0.0 and a loopback IP address?

                • Wikipedia's article about localhost





                share|improve this answer

























                  2












                  2








                  2







                  The 127-type of address is internal only, as per RFC1122:




                  Internal host loopback address. Addresses of this form
                  MUST NOT appear outside a host.




                  This means that those services are listening locally. The 192.168.1.97 is your public-facing address, and that's how router and other computers know you. The 127.0.0.1/8 in a sense is a "simulation" of a network. You can test things with it, you can run local services on and exchange packets between them - essentially same things as you'd do with an actual internet resource. In fact, that's what web developers do: they set up local environment and run XAMP or LAMP stack locally before moving on to production environment when polished product will actually face the internet.



                  Now, it should not happen that you receive a packet from 127.x.x.x type of address on public facing interface like eth0 or wlan0. If that happens, this is called Martian packet, and it's likely that someone is trying to attack your host or network.



                  In a certain sense you could make it an analogy between your router and your computer. On LAN, your router has 192.168.1.0 address, but to the internet it is known as 68.125.xx.yy ( disclamer: random example, not an actual IP address intended here ). The router might expose to the internet only port 53 ( DNS ), but internally you could have port 80 ( HTTP control panel ) and 53. Same idea with your computer.



                  Of course, the services would have to be configured to listen on either public or local interface only. For instance, Redis server comes preconfigured to listen only on 127.0.0.1, because security reasons.



                  See also



                  • What is the difference between 0.0.0.0 and a loopback IP address?

                  • Wikipedia's article about localhost





                  share|improve this answer













                  The 127-type of address is internal only, as per RFC1122:




                  Internal host loopback address. Addresses of this form
                  MUST NOT appear outside a host.




                  This means that those services are listening locally. The 192.168.1.97 is your public-facing address, and that's how router and other computers know you. The 127.0.0.1/8 in a sense is a "simulation" of a network. You can test things with it, you can run local services on and exchange packets between them - essentially same things as you'd do with an actual internet resource. In fact, that's what web developers do: they set up local environment and run XAMP or LAMP stack locally before moving on to production environment when polished product will actually face the internet.



                  Now, it should not happen that you receive a packet from 127.x.x.x type of address on public facing interface like eth0 or wlan0. If that happens, this is called Martian packet, and it's likely that someone is trying to attack your host or network.



                  In a certain sense you could make it an analogy between your router and your computer. On LAN, your router has 192.168.1.0 address, but to the internet it is known as 68.125.xx.yy ( disclamer: random example, not an actual IP address intended here ). The router might expose to the internet only port 53 ( DNS ), but internally you could have port 80 ( HTTP control panel ) and 53. Same idea with your computer.



                  Of course, the services would have to be configured to listen on either public or local interface only. For instance, Redis server comes preconfigured to listen only on 127.0.0.1, because security reasons.



                  See also



                  • What is the difference between 0.0.0.0 and a loopback IP address?

                  • Wikipedia's article about localhost






                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Mar 24 at 4:52









                  Sergiy KolodyazhnyySergiy Kolodyazhnyy

                  10.7k42765




                  10.7k42765













                      Popular posts from this blog

                      Færeyskur hestur Heimild | Tengill | Tilvísanir | LeiðsagnarvalRossið - síða um færeyska hrossið á færeyskuGott ár hjá færeyska hestinum

                      He _____ here since 1970 . Answer needed [closed]What does “since he was so high” mean?Meaning of “catch birds for”?How do I ensure “since” takes the meaning I want?“Who cares here” meaningWhat does “right round toward” mean?the time tense (had now been detected)What does the phrase “ring around the roses” mean here?Correct usage of “visited upon”Meaning of “foiled rail sabotage bid”It was the third time I had gone to Rome or It is the third time I had been to Rome

                      Slayer Innehåll Historia | Stil, komposition och lyrik | Bandets betydelse och framgångar | Sidoprojekt och samarbeten | Kontroverser | Medlemmar | Utmärkelser och nomineringar | Turnéer och festivaler | Diskografi | Referenser | Externa länkar | Navigeringsmenywww.slayer.net”Metal Massacre vol. 1””Metal Massacre vol. 3””Metal Massacre Volume III””Show No Mercy””Haunting the Chapel””Live Undead””Hell Awaits””Reign in Blood””Reign in Blood””Gold & Platinum – Reign in Blood””Golden Gods Awards Winners”originalet”Kerrang! Hall Of Fame””Slayer Looks Back On 37-Year Career In New Video Series: Part Two””South of Heaven””Gold & Platinum – South of Heaven””Seasons in the Abyss””Gold & Platinum - Seasons in the Abyss””Divine Intervention””Divine Intervention - Release group by Slayer””Gold & Platinum - Divine Intervention””Live Intrusion””Undisputed Attitude””Abolish Government/Superficial Love””Release “Slatanic Slaughter: A Tribute to Slayer” by Various Artists””Diabolus in Musica””Soundtrack to the Apocalypse””God Hates Us All””Systematic - Relationships””War at the Warfield””Gold & Platinum - War at the Warfield””Soundtrack to the Apocalypse””Gold & Platinum - Still Reigning””Metallica, Slayer, Iron Mauden Among Winners At Metal Hammer Awards””Eternal Pyre””Eternal Pyre - Slayer release group””Eternal Pyre””Metal Storm Awards 2006””Kerrang! Hall Of Fame””Slayer Wins 'Best Metal' Grammy Award””Slayer Guitarist Jeff Hanneman Dies””Bullet-For My Valentine booed at Metal Hammer Golden Gods Awards””Unholy Aliance””The End Of Slayer?””Slayer: We Could Thrash Out Two More Albums If We're Fast Enough...””'The Unholy Alliance: Chapter III' UK Dates Added”originalet”Megadeth And Slayer To Co-Headline 'Canadian Carnage' Trek”originalet”World Painted Blood””Release “World Painted Blood” by Slayer””Metallica Heading To Cinemas””Slayer, Megadeth To Join Forces For 'European Carnage' Tour - Dec. 18, 2010”originalet”Slayer's Hanneman Contracts Acute Infection; Band To Bring In Guest Guitarist””Cannibal Corpse's Pat O'Brien Will Step In As Slayer's Guest Guitarist”originalet”Slayer’s Jeff Hanneman Dead at 49””Dave Lombardo Says He Made Only $67,000 In 2011 While Touring With Slayer””Slayer: We Do Not Agree With Dave Lombardo's Substance Or Timeline Of Events””Slayer Welcomes Drummer Paul Bostaph Back To The Fold””Slayer Hope to Unveil Never-Before-Heard Jeff Hanneman Material on Next Album””Slayer Debut New Song 'Implode' During Surprise Golden Gods Appearance””Release group Repentless by Slayer””Repentless - Slayer - Credits””Slayer””Metal Storm Awards 2015””Slayer - to release comic book "Repentless #1"””Slayer To Release 'Repentless' 6.66" Vinyl Box Set””BREAKING NEWS: Slayer Announce Farewell Tour””Slayer Recruit Lamb of God, Anthrax, Behemoth + Testament for Final Tour””Slayer lägger ner efter 37 år””Slayer Announces Second North American Leg Of 'Final' Tour””Final World Tour””Slayer Announces Final European Tour With Lamb of God, Anthrax And Obituary””Slayer To Tour Europe With Lamb of God, Anthrax And Obituary””Slayer To Play 'Last French Show Ever' At Next Year's Hellfst””Slayer's Final World Tour Will Extend Into 2019””Death Angel's Rob Cavestany On Slayer's 'Farewell' Tour: 'Some Of Us Could See This Coming'””Testament Has No Plans To Retire Anytime Soon, Says Chuck Billy””Anthrax's Scott Ian On Slayer's 'Farewell' Tour Plans: 'I Was Surprised And I Wasn't Surprised'””Slayer””Slayer's Morbid Schlock””Review/Rock; For Slayer, the Mania Is the Message””Slayer - Biography””Slayer - Reign In Blood”originalet”Dave Lombardo””An exclusive oral history of Slayer”originalet”Exclusive! Interview With Slayer Guitarist Jeff Hanneman”originalet”Thinking Out Loud: Slayer's Kerry King on hair metal, Satan and being polite””Slayer Lyrics””Slayer - Biography””Most influential artists for extreme metal music””Slayer - Reign in Blood””Slayer guitarist Jeff Hanneman dies aged 49””Slatanic Slaughter: A Tribute to Slayer””Gateway to Hell: A Tribute to Slayer””Covered In Blood””Slayer: The Origins of Thrash in San Francisco, CA.””Why They Rule - #6 Slayer”originalet”Guitar World's 100 Greatest Heavy Metal Guitarists Of All Time”originalet”The fans have spoken: Slayer comes out on top in readers' polls”originalet”Tribute to Jeff Hanneman (1964-2013)””Lamb Of God Frontman: We Sound Like A Slayer Rip-Off””BEHEMOTH Frontman Pays Tribute To SLAYER's JEFF HANNEMAN””Slayer, Hatebreed Doing Double Duty On This Year's Ozzfest””System of a Down””Lacuna Coil’s Andrea Ferro Talks Influences, Skateboarding, Band Origins + More””Slayer - Reign in Blood””Into The Lungs of Hell””Slayer rules - en utställning om fans””Slayer and Their Fans Slashed Through a No-Holds-Barred Night at Gas Monkey””Home””Slayer””Gold & Platinum - The Big 4 Live from Sofia, Bulgaria””Exclusive! Interview With Slayer Guitarist Kerry King””2008-02-23: Wiltern, Los Angeles, CA, USA””Slayer's Kerry King To Perform With Megadeth Tonight! - Oct. 21, 2010”originalet”Dave Lombardo - Biography”Slayer Case DismissedArkiveradUltimate Classic Rock: Slayer guitarist Jeff Hanneman dead at 49.”Slayer: "We could never do any thing like Some Kind Of Monster..."””Cannibal Corpse'S Pat O'Brien Will Step In As Slayer'S Guest Guitarist | The Official Slayer Site”originalet”Slayer Wins 'Best Metal' Grammy Award””Slayer Guitarist Jeff Hanneman Dies””Kerrang! Awards 2006 Blog: Kerrang! Hall Of Fame””Kerrang! Awards 2013: Kerrang! Legend”originalet”Metallica, Slayer, Iron Maien Among Winners At Metal Hammer Awards””Metal Hammer Golden Gods Awards””Bullet For My Valentine Booed At Metal Hammer Golden Gods Awards””Metal Storm Awards 2006””Metal Storm Awards 2015””Slayer's Concert History””Slayer - Relationships””Slayer - Releases”Slayers officiella webbplatsSlayer på MusicBrainzOfficiell webbplatsSlayerSlayerr1373445760000 0001 1540 47353068615-5086262726cb13906545x(data)6033143kn20030215029