如何在Ubuntu 12.04上打开端口8000?

时间:2014-03-05 15:22:43

标签: ubuntu port tryton

在我的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 App来说并不是特别的,而是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
-

在未连接的VM上显示:

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

1 个答案:

答案 0 :(得分:0)

事实证明,应用程序服务器刚刚没有正确重新启动,因此无法读取配置文件的更改。

更详细的答案如下: Tryton client doesn't connect via Internet port 8000