Link to home
Start Free TrialLog in
Avatar of fosiul01
fosiul01Flag for United Kingdom of Great Britain and Northern Ireland

asked on

nc and dd not working

hi

Receiving server :

 nc -l -p 1234 | dd of=/dev/sda

netstat -ant
tcp        0      0 0.0.0.0:1234            0.0.0.0:*               LISTEN


Sending Server :

dd if=/dev/hda | nc 192.0.0.33 1234


but it does not do any transfer ..


while investigating i can see it connects ..

example :

After typing both command in both server ..

if i press Ctrl + c  ( to break the connection)

now if i do netstat in receiving server

tcp        0      0 192.0.0.33:1234        192.0.0.11:52288        ESTABLISHED

i can see there is establish connection , its only after pressing "control C"

when i will press Again Control +c.
then receiving server

 nc -l -p 1234 | dd of=/dev/sda
128+0 records in
128+0 records out
65536 bytes (66 kB) copied, 96.2275 s, 0.7 kB/s


so the connection establisehd after pressing Control +c Second time .. data does not transfer..


is there any bug or something ??

this command works :

Sending server :  cat backup.sh | nc -vv -l -p 3333

Receving server : nc 192.0.0.137 3333 > backup.sh


both server has same version of nc running ..

any workway round will be really usefull

thanks



SOLUTION
Avatar of Daniel McAllister
Daniel McAllister
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of fosiul01

ASKER

hi Sorry did not see the post ..



if i use live cd example
knoppix in both server then i use command


Receiving server :

 nc -l -p 1234 | dd of=/dev/sda

netstat -ant
tcp        0      0 0.0.0.0:1234            0.0.0.0:*               LISTEN


Sending Server :

dd if=/dev/hda | nc 192.0.0.33 1234


it works perfectly ..

but lenny its not working ..
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Hi WMP

yes, just remembered about that post..

i will try with that again to see how it works.. but because i did not have time .. i had to take both server offline then use live CD and then use dd + netcat to copy data

its works fine with live cd (knopxis)