Operations Tool NC

Source: Internet
Author: User
Tags echo info

The full name of the NC command, Netcat, reads and writes data from the network via TCP or UDP.

1. Transferring files

Use <> Redirect (single file Only, not recommended, failed ">" to produce empty pieces)

Nc-l 8888 > Demo.txt # Listening for TCP connections on native 8888 ports, writing incoming data to a text file

NC IP 8888 < demo.txt # put the file contents through the network "cat" to the remote

Transferring files using tar (recommended, the benefit is preserving the original directory structure and permissions)

Tar cz demo1.txt demo_dir/| Nc-l 8888 # Listening on 8888 ports, there is a connection when starting tar packaging and "cat" to the remote

NC IP 8888 | Tar ZX # Connect, receive data, unzip one step into place.


2. Establish Network pipeline

NC-L 8888 # Receiving messages

echo MSG | NC IP 8888 # Send Message


3, the transfer of production room data to the test room (operation and maintenance of computer-built pipeline)

Tar cz demo1.txt demo_dir/| Nc-l 8888 # Production Room IPA

Nc-l 8888 | Tar ZX # test Room IPB

NC IpA 8888 | NC IpB 8888 # OPS PC, connecting the 8888 ports of the two machines.


4, test network connectivity (troubleshooting LBG forwarding UDP problem in the test room)

Curl Debugs http, that is, the 7 layer is very efficient. But how do you debug a 4-tier network? The answer is NC.

Test room LBG do a public network UDP service mapping, but test students found that the program error, suspected network problems, find operation and maintenance of students to troubleshoot.

Nc-ul 9999 # service IPS listening 9999 port mapped to public network Ipvs:portvs

NC-ZUV IPs 9999 # Intranet UDP connectivity successfully displayed connection to IpS 9999 port [udp/*] succeeded!

NC-ZUV IpVS Portvs # Public network UDP connectivity failure display connection to IpVS Portvs port [udp/*] fail!

First, on how to check TCP? The above parameter u is removed, the default is TCP.

Second, further write the Nagios plug-in, check the UDP service port (to deploy in the UDP message push monitoring of PP)


5, instead of Telnet, Test MC, clouds and so on.

Echo Stats | NC IpS PORTMC # non-switched view MC status.

echo INFO | NC IpS Portredis # Non-switched view of the status of Redis.

Non-commutative set, get Check Cloud DS # has been deployed to PP for cloud monitoring.



6, the use of NC e-mail, the occurrence of HTTP requests, such as rebound shell, port forwarding, etc., please man NC

Echo-e "get/http/1.0\r\n" | NC uc.cn 80

Operations Tool NC

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.