在计算机之间发送数据包

在计算机之间发送数据包

我有两台计算机,A 和 B。我已使用telnet和成功将数据包从 B 发送到 A。netcat当我尝试反向操作时,它不起作用。我不确定我在两者之间做了什么不同,而且我甚至不确定如何首先诊断问题。

正确行为示例

计算机A:

mathgirl277@computer-a:~$ telnet -l serveral 192.168.1.215 443
Trying 192.168.1.215...
Connected to 192.168.1.215.
Escape character is '^]'.
hello
I am talking from afar.
^]

telnet> Connection closed.

计算机B:

serveral@computer-b:~$ sudo nc -lkv 443
[sudo] password for serveral: 
Listening on [0.0.0.0] (family 0, port 443)
Connection from [192.168.1.243] port 443 [tcp/https] accepted (family 2, sport 33704)
hello
I am talking from afar.
Connection closed, listening again.
^C

错误行为示例

计算机A:

mathgirl277@computer-a:~$ sudo nc -lkv 443
[sudo] password for mathgirl277: 
Listening on [0.0.0.0] (family 0, port 443)

计算机B:

serveral@computer-b:~$ telnet -l mathgirl277 192.168.1.243 443
Trying 192.168.1.243...
telnet: Unable to connect to remote host: Connection refused

我认为 NAT 配置可能出了问题,导致我可以从一个方向访问,而不能从另一个方向访问。另一方面,它们都在同一个网络上,我感觉 NAT 应该不相关。

我应该采取什么步骤来诊断和解决问题?


输出iptables -nvL

Chain INPUT (policy ACCEPT 1 packets, 443 bytes)
 pkts bytes target     prot opt in     out     source               destination         
    0     0            all  --  *      *       192.168.1.215        192.168.1.243       

Chain FORWARD (policy ACCEPT 0 packets, 0 bytes)
 pkts bytes target     prot opt in     out     source               destination         

Chain OUTPUT (policy ACCEPT 0 packets, 0 bytes)
 pkts bytes target     prot opt in     out     source               destination         

相关内容