我试图理解为什么 netcat 正在监听任何地址。这是我给出的命令和我得到的响应
# nc -l -p 9500 -vvu 172.24.176.221 9500
Warning: Inverse name lookup failed for `172.24.176.221'
Listening on any address 9500
有几点需要注意:
- 我正在自定义板上运行此命令,目前无法升级我的 netcat。
- 这是输出
nc --version
。
netcat (The GNU Netcat) 0.7.1
Copyright (C) 2002 - 2003 Giovanni Giacobbi
This program comes with NO WARRANTY, to the extent permitted by law.
You may redistribute copies of this program under the terms of
the GNU General Public License.
For more information about these matters, see the file named COPYING.
Original idea and design by Avian Research <[email protected]>,
Written by Giovanni Giacobbi <[email protected]>.
- 这是我的输出
uname -a
。
Linux bpu-modem-21 4.14.0-xilinx-v2018.2 #1 SMP PREEMPT Thu Nov 8 15:48:00 PST 2018 armv7l armv7l armv7l GNU/Linux
4.这是我的输出cat /proc/sys/kernel/osrelease
,
4.14.0-xilinx-v2018.2
问题是:如何让 netcat 监听特定地址?
答案1
男人网猫:
-s ADDRESS --source=ADDRESS Specifies the source address used for creating sockets. In listen mode and tunnel mode this switch specifies the bound address, and it is generally a good idea not to specify this, which causes net‐ cat to bind to a generic interface. In the connect mode, this switch is used to specify the source address for connecting to the outside world. Again, if it's not specified a proper address for the destination route will be used.