Difference between `nmap local-IP-address` and `nmap localhost`
The following IP address is for my network interface
$ nmap 192.168.0.142
Starting Nmap 7.60 ( https://nmap.org ) at 2019-03-09 11:33 EST
Nmap scan report for ocean (192.168.0.142)
Host is up (0.00047s latency).
Not shown: 996 closed ports
PORT STATE SERVICE
22/tcp open ssh
80/tcp open http
111/tcp open rpcbind
3306/tcp open mysql
Nmap done: 1 IP address (1 host up) scanned in 0.97 seconds
Are those services shown below but not above exactly those that are closed to the outside but open within my local machine?
Are the services whose security that I should worry about exactly those listed above?
Thanks.
$ nmap localhost
Starting Nmap 7.60 ( https://nmap.org ) at 2019-03-09 11:34 EST
Nmap scan report for localhost (127.0.0.1)
Host is up (0.00046s latency).
Other addresses for localhost (not scanned):
Not shown: 993 closed ports
PORT STATE SERVICE
22/tcp open ssh
80/tcp open http
111/tcp open rpcbind
631/tcp open ipp
3306/tcp open mysql
5432/tcp open postgresql
9050/tcp open tor-socks
Nmap done: 1 IP address (1 host up) scanned in 0.16 seconds
services nmap
add a comment |
The following IP address is for my network interface
$ nmap 192.168.0.142
Starting Nmap 7.60 ( https://nmap.org ) at 2019-03-09 11:33 EST
Nmap scan report for ocean (192.168.0.142)
Host is up (0.00047s latency).
Not shown: 996 closed ports
PORT STATE SERVICE
22/tcp open ssh
80/tcp open http
111/tcp open rpcbind
3306/tcp open mysql
Nmap done: 1 IP address (1 host up) scanned in 0.97 seconds
Are those services shown below but not above exactly those that are closed to the outside but open within my local machine?
Are the services whose security that I should worry about exactly those listed above?
Thanks.
$ nmap localhost
Starting Nmap 7.60 ( https://nmap.org ) at 2019-03-09 11:34 EST
Nmap scan report for localhost (127.0.0.1)
Host is up (0.00046s latency).
Other addresses for localhost (not scanned):
Not shown: 993 closed ports
PORT STATE SERVICE
22/tcp open ssh
80/tcp open http
111/tcp open rpcbind
631/tcp open ipp
3306/tcp open mysql
5432/tcp open postgresql
9050/tcp open tor-socks
Nmap done: 1 IP address (1 host up) scanned in 0.16 seconds
services nmap
add a comment |
The following IP address is for my network interface
$ nmap 192.168.0.142
Starting Nmap 7.60 ( https://nmap.org ) at 2019-03-09 11:33 EST
Nmap scan report for ocean (192.168.0.142)
Host is up (0.00047s latency).
Not shown: 996 closed ports
PORT STATE SERVICE
22/tcp open ssh
80/tcp open http
111/tcp open rpcbind
3306/tcp open mysql
Nmap done: 1 IP address (1 host up) scanned in 0.97 seconds
Are those services shown below but not above exactly those that are closed to the outside but open within my local machine?
Are the services whose security that I should worry about exactly those listed above?
Thanks.
$ nmap localhost
Starting Nmap 7.60 ( https://nmap.org ) at 2019-03-09 11:34 EST
Nmap scan report for localhost (127.0.0.1)
Host is up (0.00046s latency).
Other addresses for localhost (not scanned):
Not shown: 993 closed ports
PORT STATE SERVICE
22/tcp open ssh
80/tcp open http
111/tcp open rpcbind
631/tcp open ipp
3306/tcp open mysql
5432/tcp open postgresql
9050/tcp open tor-socks
Nmap done: 1 IP address (1 host up) scanned in 0.16 seconds
services nmap
The following IP address is for my network interface
$ nmap 192.168.0.142
Starting Nmap 7.60 ( https://nmap.org ) at 2019-03-09 11:33 EST
Nmap scan report for ocean (192.168.0.142)
Host is up (0.00047s latency).
Not shown: 996 closed ports
PORT STATE SERVICE
22/tcp open ssh
80/tcp open http
111/tcp open rpcbind
3306/tcp open mysql
Nmap done: 1 IP address (1 host up) scanned in 0.97 seconds
Are those services shown below but not above exactly those that are closed to the outside but open within my local machine?
Are the services whose security that I should worry about exactly those listed above?
Thanks.
$ nmap localhost
Starting Nmap 7.60 ( https://nmap.org ) at 2019-03-09 11:34 EST
Nmap scan report for localhost (127.0.0.1)
Host is up (0.00046s latency).
Other addresses for localhost (not scanned):
Not shown: 993 closed ports
PORT STATE SERVICE
22/tcp open ssh
80/tcp open http
111/tcp open rpcbind
631/tcp open ipp
3306/tcp open mysql
5432/tcp open postgresql
9050/tcp open tor-socks
Nmap done: 1 IP address (1 host up) scanned in 0.16 seconds
services nmap
services nmap
asked 10 hours ago
TimTim
27.5k78264476
27.5k78264476
add a comment |
add a comment |
3 Answers
3
active
oldest
votes
If you have services that are only bound to the localhost/127.0.0.1 address, they will only show in a 127.0.0.1 nmap
scan, and not in others scans to IP addresses on the same host.
Such is the case usually, for security reasons, of binding to 127.0.0.1, MySQL, postgresql and mongo DBs for only localhost use, redis and others.
Conversely, you can find sometimes other ports on non-localhost IPs, especially when you have vhosts in webservers bound to non-localhost IP addresses, and to only listen on those addresses.
On your specific 192.168.0.142 case, I would enquire wether that MySQL could not also be bound to 127.0.0.1.
PS A very old adage that I was taught when as a trainee, was: "More important than using the tools, is understanding how they work/the data we are given."
Concerning @roaima answer, as an example mentioned on this answer, the default port of a widely used DB, mongodb, is not on the list of ports scanned by default by nmap
.
TLDR It is not a rule that scanning different IP addresses of the same equipment, that all the scanning data/open ports will be the same.
Alas, by network design most often than not, we do not want them to be the same. For instance in firewalls/switching equipment, we define interfaces/VLANs on a specific control network that users cannot reach for having the web management/ssh services active, and only on those interfaces. e.g. normal users cannot reach those services, they can only be reached by a VPN and/or a control room. (this is a more extreme example. I have worked in organisations where the SSH service of VMs is only present via a control network too).
And even if the same port is open on different interfaces, it may not be the same service. I.e. port 443 on a public-facing interface may run your public website, 443 on an internal-facing interface may run the Git server that you use to deploy your website.
– Jörg W Mittag
9 hours ago
@JörgWMittag Good point.
– Rui F Ribeiro
9 hours ago
add a comment |
Almost, but not quite.
By default nmap
scans only 1000 ports for any given protocol (tcp, udp, whatever). So your port scans are subject to that filter. You'll see from the documentation that you can define the set of ports to be scanned with the -p
option, and that -p-
means scan ports 1-65535. (Strangely, out 0 is still omitted; you have to specify it explicitly if you want to include it.)
Thanks. Does-p0,1-65535
scan all possible ports (for any given protocol (tcp, udp, whatever))?
– Tim
10 hours ago
The documentation I linked in my answer shows-p0-
is sufficient.
– roaima
3 hours ago
add a comment |
Also, you appear to only have scanned TCP and not UDP :-). So there might also be UDP services you want to worry about.
UDP scanning has some issues that do not apply to TCP scanning. In either case, I would start by querying the OS instead: How do I list all sockets which are open to remote machines?
Port scanning is still useful as a confirmation though. Port scanning from a different host is a particularly good idea if you have set up a firewall, to confirm that the firewall is doing what you want.
And then the IPsec services ;) the possibilities, my God :) .... +1 (I am joking with serious things. Many people want true and tried recipes for some activities, and the reality is that were wont be a unique way of doing that for two different networks)
– Rui F Ribeiro
9 hours ago
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "106"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f505335%2fdifference-between-nmap-local-ip-address-and-nmap-localhost%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
3 Answers
3
active
oldest
votes
3 Answers
3
active
oldest
votes
active
oldest
votes
active
oldest
votes
If you have services that are only bound to the localhost/127.0.0.1 address, they will only show in a 127.0.0.1 nmap
scan, and not in others scans to IP addresses on the same host.
Such is the case usually, for security reasons, of binding to 127.0.0.1, MySQL, postgresql and mongo DBs for only localhost use, redis and others.
Conversely, you can find sometimes other ports on non-localhost IPs, especially when you have vhosts in webservers bound to non-localhost IP addresses, and to only listen on those addresses.
On your specific 192.168.0.142 case, I would enquire wether that MySQL could not also be bound to 127.0.0.1.
PS A very old adage that I was taught when as a trainee, was: "More important than using the tools, is understanding how they work/the data we are given."
Concerning @roaima answer, as an example mentioned on this answer, the default port of a widely used DB, mongodb, is not on the list of ports scanned by default by nmap
.
TLDR It is not a rule that scanning different IP addresses of the same equipment, that all the scanning data/open ports will be the same.
Alas, by network design most often than not, we do not want them to be the same. For instance in firewalls/switching equipment, we define interfaces/VLANs on a specific control network that users cannot reach for having the web management/ssh services active, and only on those interfaces. e.g. normal users cannot reach those services, they can only be reached by a VPN and/or a control room. (this is a more extreme example. I have worked in organisations where the SSH service of VMs is only present via a control network too).
And even if the same port is open on different interfaces, it may not be the same service. I.e. port 443 on a public-facing interface may run your public website, 443 on an internal-facing interface may run the Git server that you use to deploy your website.
– Jörg W Mittag
9 hours ago
@JörgWMittag Good point.
– Rui F Ribeiro
9 hours ago
add a comment |
If you have services that are only bound to the localhost/127.0.0.1 address, they will only show in a 127.0.0.1 nmap
scan, and not in others scans to IP addresses on the same host.
Such is the case usually, for security reasons, of binding to 127.0.0.1, MySQL, postgresql and mongo DBs for only localhost use, redis and others.
Conversely, you can find sometimes other ports on non-localhost IPs, especially when you have vhosts in webservers bound to non-localhost IP addresses, and to only listen on those addresses.
On your specific 192.168.0.142 case, I would enquire wether that MySQL could not also be bound to 127.0.0.1.
PS A very old adage that I was taught when as a trainee, was: "More important than using the tools, is understanding how they work/the data we are given."
Concerning @roaima answer, as an example mentioned on this answer, the default port of a widely used DB, mongodb, is not on the list of ports scanned by default by nmap
.
TLDR It is not a rule that scanning different IP addresses of the same equipment, that all the scanning data/open ports will be the same.
Alas, by network design most often than not, we do not want them to be the same. For instance in firewalls/switching equipment, we define interfaces/VLANs on a specific control network that users cannot reach for having the web management/ssh services active, and only on those interfaces. e.g. normal users cannot reach those services, they can only be reached by a VPN and/or a control room. (this is a more extreme example. I have worked in organisations where the SSH service of VMs is only present via a control network too).
And even if the same port is open on different interfaces, it may not be the same service. I.e. port 443 on a public-facing interface may run your public website, 443 on an internal-facing interface may run the Git server that you use to deploy your website.
– Jörg W Mittag
9 hours ago
@JörgWMittag Good point.
– Rui F Ribeiro
9 hours ago
add a comment |
If you have services that are only bound to the localhost/127.0.0.1 address, they will only show in a 127.0.0.1 nmap
scan, and not in others scans to IP addresses on the same host.
Such is the case usually, for security reasons, of binding to 127.0.0.1, MySQL, postgresql and mongo DBs for only localhost use, redis and others.
Conversely, you can find sometimes other ports on non-localhost IPs, especially when you have vhosts in webservers bound to non-localhost IP addresses, and to only listen on those addresses.
On your specific 192.168.0.142 case, I would enquire wether that MySQL could not also be bound to 127.0.0.1.
PS A very old adage that I was taught when as a trainee, was: "More important than using the tools, is understanding how they work/the data we are given."
Concerning @roaima answer, as an example mentioned on this answer, the default port of a widely used DB, mongodb, is not on the list of ports scanned by default by nmap
.
TLDR It is not a rule that scanning different IP addresses of the same equipment, that all the scanning data/open ports will be the same.
Alas, by network design most often than not, we do not want them to be the same. For instance in firewalls/switching equipment, we define interfaces/VLANs on a specific control network that users cannot reach for having the web management/ssh services active, and only on those interfaces. e.g. normal users cannot reach those services, they can only be reached by a VPN and/or a control room. (this is a more extreme example. I have worked in organisations where the SSH service of VMs is only present via a control network too).
If you have services that are only bound to the localhost/127.0.0.1 address, they will only show in a 127.0.0.1 nmap
scan, and not in others scans to IP addresses on the same host.
Such is the case usually, for security reasons, of binding to 127.0.0.1, MySQL, postgresql and mongo DBs for only localhost use, redis and others.
Conversely, you can find sometimes other ports on non-localhost IPs, especially when you have vhosts in webservers bound to non-localhost IP addresses, and to only listen on those addresses.
On your specific 192.168.0.142 case, I would enquire wether that MySQL could not also be bound to 127.0.0.1.
PS A very old adage that I was taught when as a trainee, was: "More important than using the tools, is understanding how they work/the data we are given."
Concerning @roaima answer, as an example mentioned on this answer, the default port of a widely used DB, mongodb, is not on the list of ports scanned by default by nmap
.
TLDR It is not a rule that scanning different IP addresses of the same equipment, that all the scanning data/open ports will be the same.
Alas, by network design most often than not, we do not want them to be the same. For instance in firewalls/switching equipment, we define interfaces/VLANs on a specific control network that users cannot reach for having the web management/ssh services active, and only on those interfaces. e.g. normal users cannot reach those services, they can only be reached by a VPN and/or a control room. (this is a more extreme example. I have worked in organisations where the SSH service of VMs is only present via a control network too).
edited 9 hours ago
answered 10 hours ago
Rui F RibeiroRui F Ribeiro
41.3k1481140
41.3k1481140
And even if the same port is open on different interfaces, it may not be the same service. I.e. port 443 on a public-facing interface may run your public website, 443 on an internal-facing interface may run the Git server that you use to deploy your website.
– Jörg W Mittag
9 hours ago
@JörgWMittag Good point.
– Rui F Ribeiro
9 hours ago
add a comment |
And even if the same port is open on different interfaces, it may not be the same service. I.e. port 443 on a public-facing interface may run your public website, 443 on an internal-facing interface may run the Git server that you use to deploy your website.
– Jörg W Mittag
9 hours ago
@JörgWMittag Good point.
– Rui F Ribeiro
9 hours ago
And even if the same port is open on different interfaces, it may not be the same service. I.e. port 443 on a public-facing interface may run your public website, 443 on an internal-facing interface may run the Git server that you use to deploy your website.
– Jörg W Mittag
9 hours ago
And even if the same port is open on different interfaces, it may not be the same service. I.e. port 443 on a public-facing interface may run your public website, 443 on an internal-facing interface may run the Git server that you use to deploy your website.
– Jörg W Mittag
9 hours ago
@JörgWMittag Good point.
– Rui F Ribeiro
9 hours ago
@JörgWMittag Good point.
– Rui F Ribeiro
9 hours ago
add a comment |
Almost, but not quite.
By default nmap
scans only 1000 ports for any given protocol (tcp, udp, whatever). So your port scans are subject to that filter. You'll see from the documentation that you can define the set of ports to be scanned with the -p
option, and that -p-
means scan ports 1-65535. (Strangely, out 0 is still omitted; you have to specify it explicitly if you want to include it.)
Thanks. Does-p0,1-65535
scan all possible ports (for any given protocol (tcp, udp, whatever))?
– Tim
10 hours ago
The documentation I linked in my answer shows-p0-
is sufficient.
– roaima
3 hours ago
add a comment |
Almost, but not quite.
By default nmap
scans only 1000 ports for any given protocol (tcp, udp, whatever). So your port scans are subject to that filter. You'll see from the documentation that you can define the set of ports to be scanned with the -p
option, and that -p-
means scan ports 1-65535. (Strangely, out 0 is still omitted; you have to specify it explicitly if you want to include it.)
Thanks. Does-p0,1-65535
scan all possible ports (for any given protocol (tcp, udp, whatever))?
– Tim
10 hours ago
The documentation I linked in my answer shows-p0-
is sufficient.
– roaima
3 hours ago
add a comment |
Almost, but not quite.
By default nmap
scans only 1000 ports for any given protocol (tcp, udp, whatever). So your port scans are subject to that filter. You'll see from the documentation that you can define the set of ports to be scanned with the -p
option, and that -p-
means scan ports 1-65535. (Strangely, out 0 is still omitted; you have to specify it explicitly if you want to include it.)
Almost, but not quite.
By default nmap
scans only 1000 ports for any given protocol (tcp, udp, whatever). So your port scans are subject to that filter. You'll see from the documentation that you can define the set of ports to be scanned with the -p
option, and that -p-
means scan ports 1-65535. (Strangely, out 0 is still omitted; you have to specify it explicitly if you want to include it.)
answered 10 hours ago
roaimaroaima
45.4k757123
45.4k757123
Thanks. Does-p0,1-65535
scan all possible ports (for any given protocol (tcp, udp, whatever))?
– Tim
10 hours ago
The documentation I linked in my answer shows-p0-
is sufficient.
– roaima
3 hours ago
add a comment |
Thanks. Does-p0,1-65535
scan all possible ports (for any given protocol (tcp, udp, whatever))?
– Tim
10 hours ago
The documentation I linked in my answer shows-p0-
is sufficient.
– roaima
3 hours ago
Thanks. Does
-p0,1-65535
scan all possible ports (for any given protocol (tcp, udp, whatever))?– Tim
10 hours ago
Thanks. Does
-p0,1-65535
scan all possible ports (for any given protocol (tcp, udp, whatever))?– Tim
10 hours ago
The documentation I linked in my answer shows
-p0-
is sufficient.– roaima
3 hours ago
The documentation I linked in my answer shows
-p0-
is sufficient.– roaima
3 hours ago
add a comment |
Also, you appear to only have scanned TCP and not UDP :-). So there might also be UDP services you want to worry about.
UDP scanning has some issues that do not apply to TCP scanning. In either case, I would start by querying the OS instead: How do I list all sockets which are open to remote machines?
Port scanning is still useful as a confirmation though. Port scanning from a different host is a particularly good idea if you have set up a firewall, to confirm that the firewall is doing what you want.
And then the IPsec services ;) the possibilities, my God :) .... +1 (I am joking with serious things. Many people want true and tried recipes for some activities, and the reality is that were wont be a unique way of doing that for two different networks)
– Rui F Ribeiro
9 hours ago
add a comment |
Also, you appear to only have scanned TCP and not UDP :-). So there might also be UDP services you want to worry about.
UDP scanning has some issues that do not apply to TCP scanning. In either case, I would start by querying the OS instead: How do I list all sockets which are open to remote machines?
Port scanning is still useful as a confirmation though. Port scanning from a different host is a particularly good idea if you have set up a firewall, to confirm that the firewall is doing what you want.
And then the IPsec services ;) the possibilities, my God :) .... +1 (I am joking with serious things. Many people want true and tried recipes for some activities, and the reality is that were wont be a unique way of doing that for two different networks)
– Rui F Ribeiro
9 hours ago
add a comment |
Also, you appear to only have scanned TCP and not UDP :-). So there might also be UDP services you want to worry about.
UDP scanning has some issues that do not apply to TCP scanning. In either case, I would start by querying the OS instead: How do I list all sockets which are open to remote machines?
Port scanning is still useful as a confirmation though. Port scanning from a different host is a particularly good idea if you have set up a firewall, to confirm that the firewall is doing what you want.
Also, you appear to only have scanned TCP and not UDP :-). So there might also be UDP services you want to worry about.
UDP scanning has some issues that do not apply to TCP scanning. In either case, I would start by querying the OS instead: How do I list all sockets which are open to remote machines?
Port scanning is still useful as a confirmation though. Port scanning from a different host is a particularly good idea if you have set up a firewall, to confirm that the firewall is doing what you want.
edited 8 hours ago
answered 9 hours ago
sourcejedisourcejedi
24.9k441107
24.9k441107
And then the IPsec services ;) the possibilities, my God :) .... +1 (I am joking with serious things. Many people want true and tried recipes for some activities, and the reality is that were wont be a unique way of doing that for two different networks)
– Rui F Ribeiro
9 hours ago
add a comment |
And then the IPsec services ;) the possibilities, my God :) .... +1 (I am joking with serious things. Many people want true and tried recipes for some activities, and the reality is that were wont be a unique way of doing that for two different networks)
– Rui F Ribeiro
9 hours ago
And then the IPsec services ;) the possibilities, my God :) .... +1 (I am joking with serious things. Many people want true and tried recipes for some activities, and the reality is that were wont be a unique way of doing that for two different networks)
– Rui F Ribeiro
9 hours ago
And then the IPsec services ;) the possibilities, my God :) .... +1 (I am joking with serious things. Many people want true and tried recipes for some activities, and the reality is that were wont be a unique way of doing that for two different networks)
– Rui F Ribeiro
9 hours ago
add a comment |
Thanks for contributing an answer to Unix & Linux Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f505335%2fdifference-between-nmap-local-ip-address-and-nmap-localhost%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown