Debian

nmap 似乎沒有找到所有打開的埠

  • May 21, 2020

嗨,我有一個小設置,我有一台執行 virtualbox 的 debian 機器,它也是 debian 機器。我在來賓機器上安裝了 apache,現在想看看我的主機是否可以找到該服務,但它沒有

在來賓機器上,我用 進行了檢查nmap localhost,結果如下:

$ nmap localhost

Starting Nmap 6.40 ( http://nmap.org ) at 2020-05014 19:23 UTC
Nmap scan report for localhost (127.0.0.1)
Host is up (0.00045s latency).
Other addresses for localhost (not scanned): 127.0.0.1
Not shown: 989 closed ports
PORT     STATE SERVICE
21/tcp   open  ftp
22/tcp   open  ssh
80/tcp   open  http
111/tcp  open  rpcbind
139/tcp  open  netbios-ssn
445/tcp  open  microsoft-ds
631/tcp  open  ipp
3000/tcp open  ppp
3306/tcp open  mysql
6667/tcp open  irc
8181/tcp open  unknown

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

apache也在執行:

$ sudo service apache2 status
* apache2 is running

並在埠 80 上監聽:

$ sudo netstat -anp | grep apache
tcp6     0     0  :::80               :::*          LISTEN     3280/apache2

現在我想看看我是否可以從主機遠端看到打開的埠。進行掃描我得到以下輸出:

$ nmap 10.0.2.15
Starting Nmap 7.80 ( https://nmap.org ) at 2020-05-14 15:18 EDT
Nmap scan report for 10.0.2.15
Nost is up (0.000039s latency).
Not shown: 999 closed ports
PORT   STATE SERVICE
22/tcp open  ssh

雙方可以互相ping通。它僅將埠 22 顯示為打開。訪客防火牆設置如下:

# iptables --list
Chain INPUT (policy ACCEPT)
target    prot opt source          destination
ACCEPT    tcp  --  anywhere        anywhere         tcp dpt:http flags:FIN,SYN,RST,ACK/SYN
ACCEPT    all  -- anywhere         anywhere
ACCEPT    all  -- anywhere         anywhere         ctstate RELATED,ESTABLISHED
ACCEPT    tcp  -- anywhere         anywhere         tcp dpt:ipp
ACCEPT    tcp  -- anywhere         anywhere         tcp dpt:http
ACCEPT    tcp  -- anywhere         anywhere         tcp dpt:6697
ACCEPT    tcp  -- anywhere         anywhere         tcp dpt:ftp
ACCEPT    tcp  -- anywhere         anywhere         tcp dpt:mysql
ACCEPT    tcp  -- anywhere         anywhere         tcp dpt:http
ACCEPT    tcp  -- anywhere         anywhere         tcp dpt:3000
ACCEPT    tcp  -- anywhere         anywhere         tcp dpt:3500
ACCEPT    tcp  -- anywhere         anywhere         tcp dpt:8181
ACCEPT    tcp  -- anywhere         anywhere         tcp dpt:microsoft-ds
ACCEPT    tcp  -- anywhere         anywhere         tcp dpt:ssh

Chain FORWARD (policy DROP)
target    prot opt source          destination
DOCKER-USER all -- anywhere          anywhere
DOCKER-ISOLATION-STAGE-1  all  --  anywhere            anywhere
ACCEPT    all  --   anywhere       anywhere         ctstate RELATED,ESTABLISHED
ACCEPT    all  --   anywhere       anywhere
DOCKER    all  --   anywhere       anywhere
ACCEPT    all  --   anywhere       anywhere
ACCEPT    all  --   anywhere       anywhere

Chain OUTPUT (policy ACCEPT)
target    prot opt source          destination

我錯過了什麼?對於上下文:我在 kalilinux 主機上使用 metsploitable3 Vagrant-box。

您好,感謝您的回复。通過再次查看它,我將其縮小到由 virtualbox 的嵌套使用和橋接網路的 vagrants 使用引起的一些問題。

我通過將案例更改為在 nat 網路中使用兩個虛擬機來解決它。它解決了這個問題。

引用自:https://unix.stackexchange.com/questions/586694