I have tried using nc to chat and transfer files over my local network. However, I am having trouble doing it over internet (with my friend). While doing it locally, i would be using ifconfig to view my ip address. I see only one ipv4 address. I am pretty sure this address cannot be used to connect to my friend, as I have tried. Is it their public ip address we have to use in order to establish a connection? If yes, I've tried that too. My main problem is to find out which ip address to use for connection over internet. BTW I am listening while my friend is connecting to my open port.

  • freedns.afraid.org – George Vasiliou May 5 '17 at 21:18
  • while creating the dns, it used my public ip address. i tried connecting from an external device to it, it did not work. – TBT May 5 '17 at 21:41
  • 1
    @TBT Is there a router between your computer and the internet? If so: port forwarding. Is there a firewall between your computer and the internet? If so: make sure the port is unblocked – Fox May 5 '17 at 21:49
  • @Fox I have disabled the firewall as I tried connecting. Will try port forwarding now. Thanks everyone for your replies. – TBT May 5 '17 at 21:54

The IP address you see using ifconfig is your IP address for your local network only. It is a private address (192.168, right?) and can not be used to communicate over the internet. Your router performs Network Address Translation to convey data between sites you visit and your computer. What you and your friend would have to do is set up port forwarding between your modem/router/etc to your respective computers, both of which are running netcat.

  • Yes, it is 192.168.*.* .Will try port forwarding, but still a doubt remains. Which IP address do I use? – TBT May 5 '17 at 21:56
  • @TBT On your router, the target of the forwarding is the one in the network. Attempts to reach your public address will reach your router, which will then forward the traffic to you – Fox May 5 '17 at 22:01
  • 1
    You will connect to your friends public IP address once port forwarding has been enabled. Likewise, he or she will use your public IP address. – vespid May 5 '17 at 22:01
  • @TBT Use the domain name that you had been given by freedns like nc myfreednsdomain.org – George Vasiliou May 5 '17 at 22:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.