大网数据广告活动
服务器运维问答

How to test network connectivity on specific UDP port between 2 linux hosts

· 52CE 我爱测

I am looking for a method to test network connectivity on specific port between 2 linux hosts. Let's say for an example: I am sending syslog events from server A to server B on port 514. However, server B never receive events fro…

问题原文

原帖链接 · Anh · CC BY-SA 4.0

I am looking for a method to test network connectivity on specific port between 2 linux hosts.

Let's say for an example: I am sending syslog events from server A to server B on port 514. However, server B never receive events from Server A. I can confirm server A is sending it and port 514 on server B is opened. For now, I am suspecting that firewall between these servers are blocking 514 connections.

Is there any tool or method that can help to verify if firewall is opened for port 514 in this situation?

已采纳解答

原帖链接 · Itai Ganot · CC BY-SA 3.0

There are a few things you can do.

First, check if the services you believe are running and listening on certain ports are indeed listening, to do that, use netstat:

netstat -plunt

More than that, you can use a packet analyzer like Wireshark or the Linux built-in tool which is called tcpdump.

To analyze all traffic on let's say network interface card named eth0, run:

tcpdump -i eth0 

To analyze all traffic on nic eth0, protocol udp and port 514:

tcpdump -i eth0 -n udp 'port 514'

If you suspect the firewall in one of the machines then you can list all the active rules on the machine by issuing the next command:

sudo iptables -S

More information about iptables command you can run to help you troubleshooting your problem can be found here.

Another troubleshooting step I would take would be to telnet from the syslog sender machine to the syslog receiving machine in port 514:

telnet hostB:514

If your session is opened then it means that hostA can reach hostB in the given port.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2018-02-03)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 4.0 / CC BY-SA 3.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。