在我的 Ubuntu 12.04 VM 上,当本地使用时,应用程序 (Tryton) 在端口 8000 上正常运行。但是,从外部我无法通过 Internet 连接到端口 8000。(之前,我使用的是具有用户友好端点配置的 Windows Azure。)
Netstat,在本地运行,将端口报告为正在侦听:(我将此 VM 称为“NoConnection”,以便与下面区分)
root@NoConnection:~# netstat -tupan | grep 8000
tcp 0 0 127.0.0.1:8000 0.0.0.0:* LISTEN
10051/python
tcp 0 0 127.0.0.1:8000 127.0.0.1:58160 ESTABLISHED
10051/python
tcp 0 0 127.0.0.1:58160 127.0.0.1:8000 ESTABLISHED
10860/python
使用 nmap 在本地检查似乎也可以:
root@NoConnection:~# nmap -v -A -PN localhost
Starting Nmap 5.21 ( http://nmap.org ) at 2014-03-05 09:55 EST
NSE: Loaded 36 scripts for scanning.
Initiating SYN Stealth Scan at 09:55
Scanning localhost (127.0.0.1) [1000 ports]
Discovered open port 22/tcp on 127.0.0.1
Discovered open port 3389/tcp on 127.0.0.1
Discovered open port 8000/tcp on 127.0.0.1
Discovered open port 631/tcp on 127.0.0.1
Discovered open port 5432/tcp on 127.0.0.1
Discovered open port 5910/tcp on 127.0.0.1
Completed SYN Stealth Scan at 09:55, 0.03s elapsed (1000 total ports)
PORT STATE SERVICE VERSION
22/tcp open ssh OpenSSH 5.9p1 Debian 5ubuntu1.1 (protocol 2.0)
631/tcp open ipp CUPS 1.5
3389/tcp open microsoft-rdp xrdp
5432/tcp open postgresql PostgreSQL DB
5910/tcp open vnc VNC (protocol 3.8)
8000/tcp open http-alt?
顺便说一句,端口 8000 是 Tryton ERP,但 nmap 不知道这一点。
但是,来自不同机器的 nmap 扫描*没有* 找到打开的端口:
root@WorksRight:~# nmap -v -A -PN IP_of_NoConnect_VM
Starting Nmap 5.21 ( http://nmap.org ) at 2014-03-05 15:00 UTC
NSE: Loaded 36 scripts for scanning.
Initiating Parallel DNS resolution of 1 host. at 15:00
Completed Parallel DNS resolution of 1 host. at 15:00, 0.08s elapsed
Initiating SYN Stealth Scan at 15:00
Scanning IP_of_NoConnect_VM [1000 ports]
Discovered open port 22/tcp on IP_of_NoConnect_VM
Discovered open port 3389/tcp on IP_of_NoConnect_VM
Discovered open port 5910/tcp on IP_of_NoConnect_VM
Completed SYN Stealth Scan at 15:00, 0.13s elapsed (1000 total ports)
我想这不是 Tryton 应用程序特有的,而是 Linux VM 使用其端口设置的方式。
作为参考,在正确配置 Tryton 并可通过端口 8000 访问的不同 VM(在 Windows Azure 上)上,端口 8000 的 netstat 输出显示为:
root@WorksRight:~# netstat -tupan | grep 8000
tcp6 0 0 :::8000 :::* LISTEN
1310/python
tcp6 0 0 127.0.0.1:8000 127.0.0.1:36818 TIME_WAIT
-
tcp6 0 0 127.0.0.1:8000 127.0.0.1:36820 TIME_WAIT
-
tcp6 0 0 127.0.0.1:8000 127.0.0.1:36814 TIME_WAIT
-
tcp6 0 0 127.0.0.1:8000 127.0.0.1:36813 TIME_WAIT
-
在未连接的虚拟机上,它显示:
root@NoConnection:~# netstat -tupan | grep 8000
tcp 0 0 127.0.0.1:8000 0.0.0.0:* LISTEN
10051/python
tcp 0 0 127.0.0.1:8000 127.0.0.1:58160 ESTABLISHED
10051/python
tcp 0 0 127.0.0.1:58160 127.0.0.1:8000 ESTABLISHED
10860/python
当然,是的,我已经检查过了,两台机器都在特定于应用程序的 trytond.conf 文件中打开了端口:
#This file is part of Tryton. The COPYRIGHT file at the top level of
#this repository contains the full copyright notices and license terms.
[options]
# Activate the json-rpc protocol
jsonrpc = *:8000