LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 02-29-2012, 04:11 PM   #1
Halobok
LQ Newbie
 
Registered: Feb 2012
Posts: 15

Rep: Reputation: Disabled
netcat, does it verifies/comfirms packages?


I searched the web alot but cannot find an answer. When I pipe something big over nc, does it makes sure everything is went through? I mean is there any checksum/verification mechanism against missing packages?
 
Old 02-29-2012, 04:15 PM   #2
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
This is not nc's business. that's TCP's responsibility as a network stack level.
 
1 members found this post helpful.
Old 02-29-2012, 04:30 PM   #3
anomie
Senior Member
 
Registered: Nov 2004
Location: Texas
Distribution: RHEL, Scientific Linux, Debian, Fedora
Posts: 3,935
Blog Entries: 5

Rep: Reputation: Disabled
Exactly what acid_kewpie said. (Except it's transport layer. )

--
edit: Ah, I think you meant "network stack level" to describe OSI. Never mind me.
 
Old 02-29-2012, 04:40 PM   #4
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
Ahh I wasn't talking models, just "not the programs problem"
 
Old 02-29-2012, 05:23 PM   #5
jefro
Moderator
 
Registered: Mar 2008
Posts: 21,980

Rep: Reputation: 3624Reputation: 3624Reputation: 3624Reputation: 3624Reputation: 3624Reputation: 3624Reputation: 3624Reputation: 3624Reputation: 3624Reputation: 3624Reputation: 3624
In some ways, netcat can be thought of as a cable. It just moves data. Doesn't care about it at all.
 
Old 03-01-2012, 03:34 PM   #6
Halobok
LQ Newbie
 
Registered: Feb 2012
Posts: 15

Original Poster
Rep: Reputation: Disabled
So TCP takes care of it? So I can dump a huge hdd over nc using dd and I can be sure that everything will go through?
 
Old 03-01-2012, 03:49 PM   #7
anomie
Senior Member
 
Registered: Nov 2004
Location: Texas
Distribution: RHEL, Scientific Linux, Debian, Fedora
Posts: 3,935
Blog Entries: 5

Rep: Reputation: Disabled
If the TCP conversation successfully completes (and nc(1) appears to be good about warning you if it does not), you should be all set. If you really, really want to be sure, then use a cryptographic digest to confirm.

BTW, why use nc(1) for this? What about scp(1)?

---

edit: Or if you don't want to create a large file locally, then pipe your dd(1) to ssh(1) a la:
Code:
dd if=/dev/zero bs=512K count=2 | ssh guy@host.local 'cat > baz.zero'

Last edited by anomie; 03-01-2012 at 03:58 PM.
 
Old 03-01-2012, 09:59 PM   #8
jefro
Moderator
 
Registered: Mar 2008
Posts: 21,980

Rep: Reputation: 3624Reputation: 3624Reputation: 3624Reputation: 3624Reputation: 3624Reputation: 3624Reputation: 3624Reputation: 3624Reputation: 3624Reputation: 3624Reputation: 3624
For some reason the link I got this from is down so I can't quote it.

"
Using DD over Netcat
Netcat opens an encryption-less connection from one host to another, which is why it outperforms SSH. If using the netcat method, take a moment to consider the implications of sending raw, unecrypted data over your network. We strongly recommend against using this method for WAN data transfers, unless you are doing so over an encrypted tunnel (e.g. VPN).
We will assume for the purposes of this tutorial that you have the nc version of netcat. If you have the the other, then the command line options will be slightly different but the idea is the same. You set up a listening server on the destination, and then you send data to the port you've specified form the source. Let's assume we are transferring a full disk image from serverA (/dev/sda) to serverB (dev/sdb). We are going to assume block size of incoming data for dd will be 16MB and that it will be bzip compressed. On serverB we would run the following:
nc -l 19000|bzip2 -d|dd bs=16M of=/dev/sdb
This tells netcat to listen on port 19000 for incoming data, then pipe that data to bzip for decompression, and then finally pipe the decompressed data to dd to be written to /dev/sdb.
Once we have this listening (you won't see any output after you hit Enter), we can move on to starting the data transfer on serverA:
dd bs=16M if=/dev/sda|bzip2 -c|nc serverB.example.net 19000
You again will not see any output after you've hit Enter, but do not fret! You can start another session (or launch the netcat in a screen session and back out), and run a tcpdump on port 19000 on serverB to ensure that traffic is indeed flowing. You'll get a DD output on both ends summarizing the read/write time and bytes transferred when the process is complete. In this case no additional configuration is needed. /dev/sdb is a mountable and readable block device that's ready for use!
"
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Create a bash script that verifies an existing directory? AB1826 Linux - Newbie 11 12-13-2011 09:49 AM
[SOLVED] Sendmail as a client always verifies certificates even with TLSSrv_options set to V fast-reflexes Linux - Server 1 09-11-2010 07:06 AM
Need program that verifies email sender before delivering. 360 Linux - Software 0 03-06-2006 12:41 PM
How YOU (Yast Online Update) verifies package integrity before installation? tux_addicted SUSE / openSUSE 2 09-16-2005 04:25 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 08:31 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration