在 Linux/Debian 上開啟連接埠 7(echo 連接埠)

在 Linux/Debian 上開啟連接埠 7(echo 連接埠)

我需要在我的 Linux/Debian 上有一個 echo 伺服器用於調試目的,我意識到“/etc/services”中已經顯示了一個分配的連接埠來執行此操作,它是連接埠 7 TCP/UDP。

是否可以在 Linux (Debian) 上開啟此連接埠?如果沒有,有什麼替代方案?

答案1

要在 Debian 中設定 echo 服務,您可以安裝xinetd

apt-get install xinetd

比你必須將disable指令改為noin /etc/xinetd.d/echo;或者,如果該文件不存在,請按如下所示建立它:

# default: off
# description: An xinetd internal service which echo's characters back to
# clients.
# This is the tcp version.
service echo
{
    disable     = no
    type        = INTERNAL
    id      = echo-stream
    socket_type = stream
    protocol    = tcp
    user        = root
    wait        = no
}

# This is the udp version.
service echo
{
    disable     = yes
    type        = INTERNAL
    id      = echo-dgram
    socket_type = dgram
    protocol    = udp
    user        = root
    wait        = yes
}

設定disable = no或建立檔案後,重新啟動xinetd

sudo service xinetd restart

測試echoTCP 服務:

$nc localhost echo
testing...
testing...
xxxx
xxxx
^C

相關內容