我在vmware工作站中有一个虚拟机,它是桥接网络和DHCP。 DHCP服务器分配的IP为10.21.245.22。这是我的/ etc / hosts看起来像:
127.0.0.1 hadoop-namenode-01 localhost
我在盒子上运行命令A和B.
命令A:
root @ hadoop-namenode-01:〜#nmap -sT -sU -p- localhost
Starting Nmap 5.21 ( http://nmap.org ) at 2012-08-10 09:32 PDT
Nmap scan report for localhost (127.0.0.1)
Host is up (0.00029s latency).
rDNS record for 127.0.0.1: hadoop-namenode-01
Not shown: 131058 closed ports
PORT STATE SERVICE
22/tcp open ssh
53/tcp open domain
631/tcp open ipp
8020/tcp open unknown
9000/tcp open cslistener
9001/tcp open tor-orport
50070/tcp open unknown
53/udp open|filtered domain
68/udp open|filtered dhcpc
123/udp open ntp
5353/udp open|filtered zeroconf
47982/udp open|filtered unknown
Nmap done: 1 IP address (1 host up) scanned in 12.45 seconds
命令B:
root @ hadoop-namenode-01:〜#nmap -sT -sU -p- 10.21.245.22
Starting Nmap 5.21 ( http://nmap.org ) at 2012-08-10 09:28 PDT
Nmap scan report for wn7x64-3jql0q1.dub.emea.dell.com (10.21.245.22)
Host is up (0.00029s latency).
Not shown: 131065 closed ports
PORT STATE SERVICE
22/tcp open ssh
68/udp open|filtered dhcpc
123/udp open ntp
5353/udp open|filtered zeroconf
47982/udp open|filtered unknown
Nmap done: 1 IP address (1 host up) scanned in 12.20 seconds
我的问题是:
因为我没有防火墙或阻塞端口之类的东西,为什么nmap在针对localhost运行时显示更多端口打开,而当它针对ip运行时显示的端口更少。
答案 0 :(得分:7)
为什么nmap在针对localhost运行时显示更多端口打开 当它与ip运行时显示较少的端口
某些应用程序决定仅在localhost上显式监听(bind
实际上),即127.0.0.1
。您可以执行netstat
检查。
答案 1 :(得分:1)
Linux中的大多数系统运行过程都使用环回(127.0.0.1)ip地址进行相互通信。它不需要在网络外发送数据包。