问题原文
原帖链接 · 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.
摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。
