Transfer files over an Ethernet patch cable

(maurycyz.com)

177 points | by jllyhill 1 day ago

25 comments

  • rmunn 1 day ago
    That used to require a crossover cable; I've done precisely that (with a crossover cable) back before https://en.wikipedia.org/wiki/Medium-dependent_interface#Aut... became widespread. With a straight-through cable, you'd be connecting the Transmit (TX) pin of one adapter to the TX pin of the other one, and the Receive (RX) pin of one to the RX pin of the other — and neither device would "hear" the messages the other one was sending. A crossover cable flipped those wires, so each device's TX pin was connected to the RX pin on the other end, and both devices could "hear" each other.

    But with auto MDI-X, each device would notice "hey, I'm sending but not receiving anything," and would try flipping its Transmit and Receive functions around (transmitting on the RX pin and receiving on the TX pin). Since each device waited a random period before doing that, it was very unlikely (nigh-impossible) that they would both flip at the exact same moment. And if they did, the second interval would most likely not be identical either.

    I'm simplifying a bit in the explanation above, but that's the broad strokes. And that's how my carefully-labeled crossover cables started gathering dust. (And then I realized "hey wait, I can just use these as normal cables now", and pulled them back out of storage and mixed them with my normal patch cables).

    • jonah-archive 21 hours ago
      Still very much a thing in the world of optical networking ("rolling the cable", i.e. switching the two sides at one end to match tx/rx up correctly, is a common first step in debugging a link that won't come up -- standard fiber patch cables are effectively crossover cables but when you're running through patch panels, have multiple cables in the path, etc it can end up mismatched). Some plants have primarily switched to bidirectional (bidi) transceivers that transmit and receive on two different wavelengths on the same strand, but that also requires matching optics at the other end with the tx/rx frequencies reversed.
    • teeray 21 hours ago
      My first Ethernet cable was a crossover cable I used to link my original Xbox with my friend’s. We’d haul another tube TV down to the basement and LAN party all night.
      • nkrisc 20 hours ago
        I remember being at a tech-oriented summer camp for teenagers at a university and one of our classes was about networking and included practice making Ethernet cables so we made a bunch of different length crossover cables so we could connect the Xboxes a few of the kids brought to the dorms and play Halo.
    • rootsudo 1 day ago
      Basically beat me to writing this, but I wouldn’t have made it so eloquent of an explanation.
    • soundworlds 1 day ago
      That wasn't that long ago was it..?

      /looks longingly out the window, and catch my aging face in the reflection

      • abrookewood 1 day ago
        Yup ... still have some old 'xover' cables lying around - all of which are RED in colour to explicitly declare their usage
        • dcl 1 day ago
          I believe a lot of NIC's could autodetect and adapt to the cable? I'm pretty sure I had 2 computers connected to each other using a regular network cable.
          • nom 23 hours ago
            Yeah it died out because the hardware advanced and could just switch automatically.

            With 1gig Ethernet it became a requirement, the definite end of existence for crossover cables.

            • minetest2048 14 hours ago
              Not just a requirement, 1gig ethernet transmit and receive at all of those 4 pairs simultaneously to get the throughput
        • valleyer 1 day ago
          Interesting. I don't remember my crossover cables being marked that way; you had to read the dot-matrix printing along the side to know. Color would have been way more handy.
          • rmunn 1 day ago
            I added labels (just a piece of paper under some clear tape) saying "CROSSOVER" at both ends of the cables, so that if I ever plugged a crossover cable into a place where I needed a straight-through, the label would be right there next to the plug.
          • tedeh 1 day ago
            Well I have to add that was interesting too. Because I remember you had to hold the ends up next to each other and compare the order of the colored wires. Same order left-to-right, not cross-over. Anything else, cross-over.
          • zeristor 1 day ago
            I seem to recall crossover cables being yellow.
            • nubinetwork 1 day ago
              The ones at $dayjob were blue, but we used to tape post-it notes to the ends to make sure we didn't lose them.
            • Symbiote 1 day ago
              Mine were mixed colours, the cable was grey but the "boot" and connector were black.
            • Hikikomori 1 day ago
              Purple cables are faster.
          • jalk 1 day ago
            I had quite a few cables with a yellow crimp "jackets" just behind the RJ45. IIRC they came with DSL modems / routers
      • mr_toad 1 day ago
        > That wasn't that long ago was it..?

        Last time I used a crossover cable I was still using dialup, probably about 20 years ago. Once I had DSL I also had a router, so the crossover cable became redundant.

      • bombcar 20 hours ago
        I still have a null modem adapter somewhere, and a null modem cable (and they were REAL not the "fake" ones).
        • deepspace 20 hours ago
          I have been struggling to get serial comms going with a TESmart KVM because the ethernet interface is stupid and I lost comms after a misconfiguration and there is no way to factory reset the device. That was not going any better and I ended up purchasing a null modem adapter (at an eye-wateringly high price) because of course I threw away a drawer full of serial adapters a decade ago.
  • yjftsjthsd-h 1 day ago
    I am 95% confident you don't actually need to assign IPs. Do this:

      # ping all link-local devices on an interface:
      ping ff02::1%eth0
    
    And then do your socat/rsync/whatever to the only IP that responds.
    • MayeulC 1 day ago
      Oh, I had no idea you could perform such a "broadcast" ping on link-local addresses. Now, that is a nice trick that will save me some typing between computers.

      mDNS / Avahi is also great if the machine advertises itself: just use machinename.local after plugging it.

      Though the interface needs to be configured for link-local addresses. In my experience, NetworkManager now periodically resets the link if it can't get a DHCP server to respond. I understand the rationale, but it used to be simpler to plug into a headless machine and be confident that you could just ssh in.

      • alright2565 20 hours ago
        > just use machinename.local after plugging it.

        If only :)

        This should work, but glibc has a bug where it doesn't support communicating a link-local scope ID in its name resolution subsystem. So you will have to first manually resolve the name, and then use the IPv6 LL address with scope ID directly.

    • steve1977 1 day ago
      I would assume so as well, I'm not sure if all host operating systems act the same though. But you could probably just wait a couple of seconds and the interfaces would have assigned themselves link-local addresses.
      • QuantumNomad_ 1 day ago
        > I'm not sure if all host operating systems act the same though

        I have two USB-C Ethernet adapters laying around that I bought some time ago. I connected one of them to a Linux machine and the other to my MacBook Pro and experimented a little bit.

        All of the following commands and outputs are from the MacBook Pro. The USB-C Ethernet interface is en8.

        On the macOS side, I can see that a 169.254.xx.xxx/16 IPv4 address has been assigned by macOS as there is no DHCP running on the link, and it has an fe80::xxxx:xxxx:xxxx:xxxx%en8/64 IPv6 address assigned by macOS as well. (The x-es in the aforementioned IPv4 and IPv6 addresses were put there by me in this text. On the system they are decimal and hexadecimal digits in the IPv4 and IPv6 addresses respectively.)

        The first attempts, relating to ssh, maybe would not work on any system anyway? Not sure how the ff02 multicast prefix for link-local scope works exactly and what its limitations are.

          % ssh ff02::1%en8
          ssh: connect to host ff02::1%en8 port 22: Address family not supported by protocol family
        
          % ssh -6 ff02::1%en8
          ssh: connect to host ff02::1%en8 port 22: Address family not supported by protocol family
        
          % ssh -B en8 -6 ff02::1%en8
          ssh: connect to host ff02::1%en8 port 22: Address family not supported by protocol family
        
          % ssh -B en8 -6 ff02::1
          ssh: connect to host ff02::1 port 22: Address family not supported by protocol family
        
        Trying ping:

          % ping ff02::1%en8
          ping: cannot resolve ff02::1%en8: Unknown host
        
        I then tried a couple more variations with ping similar to the variations I did with ssh, before moving on to ping6. Seems that the ping command on macOS is IPv4 only. I don't see any -6 flag for the ping command in the man page on macOS. But there is the ping6 command for IPv6, which I have used before (just not with ff02 addresses).

        Finally, ping6:

          % ping6 ff02::1%en8
          PING6(56=40+8+8 bytes) fe80::xxxx:xxxx:xxxx:xxxx%en8 --> ff02::1%en8
          16 bytes from fe80::xxxx:xxxx:xxxx:xxxx%en8, icmp_seq=0 hlim=64 time=10.893 ms
          16 bytes from fe80::yyy:yyy:yyyy:yyyy%en8, icmp_seq=0 hlim=64 time=14.365 ms
          16 bytes from fe80::xxxx:xxxx:xxxx:xxxx%en8, icmp_seq=1 hlim=64 time=0.511 ms
          16 bytes from fe80::yyy:yyy:yyyy:yyyy%en8, icmp_seq=1 hlim=64 time=2.467 ms
          16 bytes from fe80::xxxx:xxxx:xxxx:xxxx%en8, icmp_seq=2 hlim=64 time=0.440 ms
          16 bytes from fe80::yyy:yyy:yyyy:yyyy%en8, icmp_seq=2 hlim=64 time=2.393 ms
          ^C
          --- ff02::1%en8 ping6 statistics ---
          3 packets transmitted, 3 packets received, +3 duplicates, 0.0% packet loss
          round-trip min/avg/max/std-dev = 0.440/5.178/14.365/5.422 ms
        
        Worthy of note is that when I ping6 ff02::1%en8, I get responses from both side of the connection (the ones I substituted with fe80::xxxx:xxxx:xxxx:xxxx%en8 are the same IPv6 address that I see for the en8 interface in ifconfig output on my MacBook Pro, and the ones I substituted with fe80::yyy:yyy:yyyy:yyyy%en8 are the IPv6 address of the other end of the link-local connection).

        Attempting to ssh to the IPv6 address from the ping6 output, making sure to pick the one that is not the IPv6 address of the ethernet interface that is connected on the MacBook Pro side itself:

          ssh fe80::yyy:yyy:yyyy:yyyy%en8
        
        Output of that I will omit for brevity, but it is the standard question about accepting the ssh fingerprint of the machine and letting me know that this fingerprint is previously known by another name, as I have previously ssh'd into that machine from this one but using the .local mDNS hostname rather than this fe80 IPv6 address.

        So it seems that having ping6 ff02::1%en8 up the sleeve is useful indeed on macOS too, as long as one knows to use ping6 and not just ping, and that attempting to ssh to ff02::1%en8 does not work directly from macOS at least not for me.

        • steve1977 23 hours ago
          This is all working as expected.

          You cannot ssh to a multicast address. More generally, you cannot set up a TCP connection to a multicast address. So that explains why your first ssh attempts failed.

          And as you noticed, ping on macOS is IPv4 only, hence the "Unknown host" error, because it actually tries to resolve "ff02::1%en8" as a host name, it doesn't even recognize it as an IPv6 address.

          You then ping6 the multicast address and get replies back from all nodes in the multicast group, which includes your MBP.

          You then ssh to the link-local unicast address fe80::something, which finally works.

  • brandolini10x 1 day ago
    I wonder how we managed to invent the Internet before this trick. Next week's front page will be "Amazing trick: connect two wheels with a platform and you can ride instead of walk"
  • SillyUsername 1 day ago
    You can also pipe it through zstd on the fly, for data that compresses well you'll often see 1.5 to 3× the raw throughput, so a gigabit link can effectively move 165–330MB/s.

    Receiver: socat -u TCP6-LISTEN:1234,reuseaddr STDOUT | zstd -d -c | tar -xpf - -C /destination

    Sender: tar -C /source -cf - directory | zstd -T0 -6 -c | socat -u STDIN 'TCP6:[fd42:dead:beef::2]:1234'

    -T0 uses all cores. Bump the level above -6 for more compression, drop it for more speed, but if your CPU can't keep up, high levels will actually slow it down. Already compressed data won't see much benefit.

    • effdee 19 hours ago
      Btw, tar(1) on MacOS shows the file currently being processed when you hit Ctrl-T (i.e. when it receives SIGINFO).

      And talking about signals, dd(1) can show the amount of data it has processed as well as the throughput. The signal depends on the implementation(e.g. SIGINFO for MacOS, SIGUSR1 for GNU).

    • ElectricalUnion 1 day ago
      If you're using specifically zstd, on the sender side, instead of tweaking the whole tunnel once, you can use --adapt to dynamically adjust to i/o conditions.
  • yitchelle 1 day ago
    This remind myself the good old 8bit days of using a cross-over RS232 cable to send a file from one computer to another. even at 30bps, it was much more reliable than write my data to a cassette tape on one computer and then reading on the other.
    • hdgvhicv 1 day ago
      232 crossover was still going in the PC era with laplink. Parallel was an option too if I remember.

      Used to play Duke Nukem 3D over a null modem serial cable.

      In the days of the spectrum where you loaded via an analog audio input from a tape, and saved via the output, you could move from one to another in the same way, skipping the tape.

      Apparently this was about 1kbit per second.

    • ErroneousBosh 1 day ago
      I have plugged two ZX Spectrums together and done LOAD "" on one and SAVE "THING" on the other to transfer data.

      If you get away from BASIC commands and copy the tape routines up into RAM you can mess with the timing values, and with care you can get it from an average of 1800bps up to around IIRC 12000bps before things really fall apart. Probably with better interfacing you'd get even faster.

      With more conservative values, this is how "speedloaders" worked. In the late 80s or early 90s one publisher released games on CD where it would load in the loader at normal rate then ramp up to some unholy speed that CD had the bandwidth and stability for but tape did not.

    • thenthenthen 1 day ago
      Yeah! Werent these also called NULL-modem cables?
      • myself248 1 day ago
        Because if you had modems between the computers, you used straight-through RS232 cables -- the PC would have its Tx/Rx pins according to DTE standard, and the modem would have its Tx/Rx pins according to DCE standard. The modems did the "swap" themselves by choosing tones at dial/answer/negotiate time, then the other modem-to-terminal link was likewise straight-through.

        But if you were connecting two terminals directly with no modems, thus the modem was "null", you needed the cable to do the signal swap instead. Hence the name!

    • inigyou 1 day ago
      But did you ever plug one computer's cassette out directly to another computer's cassette in?
      • yitchelle 1 day ago
        Not possible on my system. It was only computer<->cassette connection.
        • inigyou 21 hours ago
          You weren't thinking like a hacker.
  • awruko 1 day ago
    I literally had to cross over the cable once. It was some sort of demo and the cross over cable was missing. The local computer stores didn’t have one and under the time pressure … I have used the pocket knife and convert the cable. It was before 2000 so the speed was limited to 10/100 Mbit - ifconfig did’t report errors and demo went smooth.
  • 1vuio0pswjnm7 23 hours ago
    "I think it's underappreciated for non-internet applications and doesn't even need a local network: point to point wiring is perfectly fine."

    In the 1990s I used crossover cable for years with Apple computers that I bought for music production

    To keep the disk drives "clean", I never connected these computers to the internet

    If I needed to transfer files to or from Apple computers I connected them to a laptop with crossover cable

    I grew up using Apple computers that had no internet connection at home and school so this seemed perfectly natural

    I used computers running Windows 3.11 that had no internet connection, only LAN

    Needless to say, "Big Tech" companies like Apple are not what they used to be

    These companies don't really produce anything to be used "offline" anymore. Watching the default network traffic from "Big Tech" marketed computers and software is sad

    Not automatically trying to phone home is bad for the "business" of data collection, surveillance and ad services

    There used to be a different attitude toward the internet; there was less trust. I can still find traces of this in the archives at textfiles.com

  • nkurz 1 day ago
    It would be nice if this article defined a "ethernet patch cable". I think he's just using "patch" as a slang term for a short cable and it actually works with any length of standard cable, but I'm not certain.

    Traditionally (pre-2000?), one had to use a special "crossover cable" to do direct connections like this, but apparently modern Gigabit ethernet adapters are able to detect this situation automatically?

    • rmunn 1 day ago
      https://en.wikipedia.org/wiki/Medium-dependent_interface#Aut... is what allowed the switchover to happen automatically, and it got folded into the 1000BASE-T standard. So yes, crossover cables are no longer required because the two Ethernet adapters at either end can negotiate between them to have one of them "flip" the meaning of its Receive (RX) and Transmit (TX) pins.
    • pezezin 1 day ago
      Gigabit Ethernet doesn't need to detect anything because it sends and receive over the 4 pairs simultaneously using echo cancellation.
    • bronlund 1 day ago
      The way I learned this, is that patch cables use stranded wires, but ethernet cables use solid wires.
      • globular-toast 1 day ago
        They are all just twisted pair cables, probably Cat5e or Cat6 etc. The solid ones are usually used for structured cabling, inside walls and trunking, that doesn't often move. Structured cabling is terminated into keystones or patch panels, the "female" end.

        Patch cables are outside of walls and designed to be moved around and plugged and replugged. They are terminated with 8p8c "male" connectors, commonly called rj45. Stranded cable is used because it's much more flexible.

    • lstodd 1 day ago
      IIRC crossovers are pre-2000, yes. "Fast Ethernet" or 100Base-T adapters usually could talk over straight link.

      edit: as for length, it depends. you won't get a gigabit over 150m of crap cat3, but you will get a link, even if it's 10 half-duplex.

    • facepalmz 1 day ago
      [flagged]
      • steve1977 1 day ago
        No, traditionally a patch cable is a cable that you would use in a networking rack to connect (to "patch") from say a network switch to the desk outlets or to another switch. A patch cable would explicitly be NOT a crossover.

        The main difference between patch and "normal" is that the former is using stranded conductors and the latter solid conductors.

        That makes the patch cable more flexible (physically)

        • justsomehnguy 1 day ago
          I have a feeling this is some re-invention of the definitions happening.

          It's just a holdover from the telephone networks, where you used a short cable to actually phsyically connect - patch[0] - two lines. Therefore - patch-panel and patch-cord or patch-cable.

          https://www.merriam-webster.com/dictionary/patch

        • Ekaros 1 day ago
          Is the cable connected from say desktop computer to wall socket a patch cable? Or does that only apply to those used in server rooms or switch cabinets?
          • dboreham 1 day ago
            They're the same thing.
        • Melatonic 1 day ago
          Wouldn't most patch cables also be double male ends ?

          Also probably a more flexible jacket and thinner. Vs fire resistant / plénum cables for fixed / in wall stuff.

          • steve1977 1 day ago
            Ethernet cables are usually always male-male
            • kube-system 1 day ago
              Patch cables are differentiated from bulk/structured cabling which is installed into a building unterminated, and is most commonly terminated after installation into patch panels or keystone jacks.
        • ButlerianJihad 1 day ago
          I am not sure that I know of any Ethernet (IEEE 802.3) standard cabling which uses solid-core wires rather than twisted-pair stranded wires. I can understand and see that many people consider "structured cabling" to consist of the former, but this article does not seem to mandate that construction, and indeed includes many types of twisted-pair and "patch" cables in the list of acceptable "structured cabling solutions."

          https://en.wikipedia.org/wiki/Structured_cabling

          So I believe that, in the realm of Ethernet in particular, "patch" vs. "structured" is not a useful distinction.

          • globular-toast 1 day ago
            Yeah, it's not patch vs structured. Patch cables are part of structured cabling. But you won't generally find solid core wires outside of structured cabling, because they are inflexible, unwieldly and in many cases can't even be terminated with RJ45 plugs anyway (they are often too thick).

            To regular people it's probably enough just to say Ethernet cable. Outside of structured cabling you don't really need to care and probably don't have a choice anyway. If someone says patch cable they probably know a bit about structured cabling and couldn't help themselves.

            Within structured cabling the rabbit hole is quite deep. Even within a single standard like Cat6 there are many possible cable constructions with different types of shielding and wire gauge etc. It becomes important when you need the network to certify as Cat6 and support PoE in a high noise industrial environment, for example. And, of course, Ethernet can run over other cable types anyway, like fibre.

        • Hikikomori 1 day ago
          A patch cable is just a terminated cable with multi strand leads (as opposed to solid leads in installation cable), it could be straight patch or crossover.
        • globular-toast 1 day ago
          Actually, switch to switch would be a crossover cable (pre auto MDI-X, of course). The rule was a crossover would connect devices of the same type, e.g. computer to computer, hub to hub, switch to switch; and patch for devices of different type, like switch to computer. So if you wanted to just plug a hub into the wall you would use a crossover cable, for example.
          • justsomehnguy 1 day ago
            Or a straight cable to the "Uplink" port.

            And some had a switch to select the mode of the uplink port.

        • facepalmz 1 day ago
          yes, they're typically very short cables connecting things like routers and switches, it does not imply any sort of type of cable or wire.
    • dboreham 1 day ago
      Seriously people? HN doesn't know what a patch cable is??
      • dang 20 hours ago
        "Please don't sneer, including at the rest of the community." It's reliably a marker of bad comments and worse threads.

        https://news.ycombinator.com/newsguidelines.html

        (More at https://news.ycombinator.com/item?id=49512349)

      • nkurz 1 day ago
        There doesn't seem to be agreement as to exactly what one is, with several definitions already appearing in the comments here. Do you agree with one of them and think everyone else is wrong? Or do you have yet another standard definition that we should all be using?

        My problem with the article was that "patch" doesn't seem to add any useful information. Unless he was using a restrictive definition intending to exclude things like crossover cables (which still work), he could have just as well said "transfer files over a blue Ethernet cable" with equal precision.

        If he meant to say that at this point in time "you can use _any_ ethernet cable to transfer files directly between two computers", I think it would have been better to say that rather than appearing to add a restriction on the type of cable required.

  • Yannik_Sc 1 day ago
    The USB/Thunderbolt one is a nice catch and good to know if you want to move you data to a new PC. Dell XPS (with soldered SSD) to Framework move just took a few minutes by dd'ing through the created network interfaces (it's different from the tbstream). The limiting factor was the Dell's SSD actually.
    • johnwalkr 1 day ago
      I've been doing this for years between MacBooks with a thunderbolt 4 cable. It's very fast and unlike 10Gbps ethernet, doesn't require a bulky, power-hungry[1] adapter. MacOS also will use thunderbolt automatically for Migration Assistant if available.

      [1]Most people don't realise how much power ethernet consumes. Even 100Mbps ethernet consumes about 0.5W per port and it goes up with higher speeds.

      • drnick1 6 hours ago
        Indeed, 10Gbps cards and adapters run very hot. I placed an 80mm right under the card in a PCI fan mount to keep the expansion card cool. The fan does not need to spin fast, but some directed airflow seems absolutely necessary.
  • 3r7j6qzi9jvnve 1 day ago
    tbstream looks fun, but hard to use for the casual user -- not sure if it'll get simpler but I don't think I'll remember messing in configfs just to transfer a file:

    https://git.kernel.org/pub/scm/linux/kernel/git/westeri/thun...

  • icar 5 hours ago
    I remember doing this at uni, networking labs
  • throwaway67743 18 hours ago
    But... link local precludes the need to configure addressing, even without v6, broadcast ethernet frames exist... why do people keep posting dumb solutions to already solved problems?
  • yonatan8070 19 hours ago
    My usual method for this is to spin up a small webserver using the built-in Python module:

        python -m http.server
    
    Then just wget the file I need from the other system.
    • bitpush 19 hours ago
      But that requires both the machines to be on a network right? I believe what OP is demonstrating two (isolated) machines talking to each other.
      • yonatan8070 19 hours ago
        It works just as well if they're on a direct link as demonstrated in the OP, as long as there's working IP connectivity.

        This isn't to say the way it's done in the OP is wrong, socat is also great, and you can also compress them on the fly by piping through zstd as others mentioned in this thread.

        • bitpush 14 hours ago
          Apologies if this is obvious but I'm not following it.

          > as long as there's working IP connectivity.

          Dont you need to be on a network to get 'IPs'. It is usually a router's job to setup the network, and also provision IPs.

          Two devices, not connected to a LAN has nothing. No IP, except 127.0.0.1 and localhost. So then, how do you talk to another device. There isnt an address.

          OP's article is essentially setting up a P2P connection when there's no third party (router)

          • zamadatix 13 hours ago
            Two devices connected to each other are just another form of LAN - one with 2 nodes instead of many. You can manually configure IPs without a router exactly as this article demonstrates:

              # On sender...
              ip address add dev eth0 fd42:dead:beef::1/48
              ip link set dev eth0 up
              # On receiver...
              ip address add dev eth0 fd42:dead:beef::2/48
              ip link set dev eth0 up
            
            The first 2 lines are run on one host and the second two lines on the second host. The 1st line of each segment sets the IPv6 address to use and the second line of each segment makes the adapter enabled. Plug an ethernet cable in and they can reach each other. As to why, just think of it as "the same way the computer would figure out how to send a packet to the gateway, just to another client in the network segment instead"

            You only need a router set up to go to a different subnet. If both hosts are in the same subnet then it's just a neighbor resolution (well, you can do neighbor discovery manually too if you really want... but, since it's automatic, no reason too) followed by ethernet bridging.

            Two hosts with nothing else just plugged into each other should actually already have assigned themselves IPs you could use for this though. They are known as IPv6's link local addresses and are explicitly meant for communication on the local subnet.

            Ethernet & IP are fun abstractions to really get into the weeds about. When it comes to running networks it's actually a bit of a fight to try to make sure only the addresses the router allows can be used! A whole bevy of technologies address that for the different protocols.

          • Hikikomori 4 hours ago
            On windows you get 169.254 addresses if you don't get a dhcp response. And with ipv6 you get link local address by default and you can use that to communicate with another link local.
  • pcblues 1 day ago
    Yup.

    "Computer to computer should not be seen without a device in between (unless playing ROTT with your housemates)"

    35 years ago maybe :) I had serial and parallel socket, and routerless networking happening on my home systems :)

    Use cases? Emergencies and maybe dedicated backup.

  • sgt 1 day ago
    Even easier on macOS.

    Something like this should work:

      ifconfig enX inet6 fd42:dead:beef::1 prefixlen 48
    
    No ned to bring it up as it should already be up. enX should be your USB/thunderbolt ethernet adapter, e.g. en6.

    Then you can go ahead and transfer with socat to your other machine, even if it's a Linux machine. I tend to use nc but socat will definitely be faster.

    Why the deadbeef network one might wonder? It's private space so won't conflict with public addresses.

    That being said though, in 99% cases of big files I'll just airdrop the files!

    • Steltek 1 day ago
      ifconfig still probably works on Linux too but it's discouraged because, frankly, it sucks compared to ipconfig2. Most of macOS' CLI feels old and crusty. Which makes sense when you realize it's a fossilized niche BSD from the early 00's.
      • sgt 19 hours ago
        ifconfig(8) is meant for low level stuff. What Linux did was replace ifconfig with another low level (e.g. ipconfig2), which makes more sense there I suppose. But don't get the impression that ifconfig is the easiest way in macOS on the CLI, it's networksetup(8).
    • ButlerianJihad 23 hours ago
      It seems quite strange to me that hackers have adopted "0xdeadbeef" as some sort of generic hex string to use in production.

      AFAIK, "0xDEADBEEF" originated as a "magic number" in systems like IBM RS/6000 and Solaris, and it was a red-flag number! It meant something in your system was wrong and you'd better check it out!

      https://en.wikipedia.org/wiki/Magic_number_(programming)#Deb...

      Surely there are more pleasant, vegan hex strings to use, if you want to indicate an ephemeral IPv6 address?

      • effdee 20 hours ago
        How about 0x2007BEE2?
      • picofarad 21 hours ago
        CAFEBABE?

        Sexist, so thats out.

        FACEB00C?

        In use.

        Darn this is hard.

        • sgt 18 hours ago
          CAFEBABE has Java all over it.
  • riobard 1 day ago
    For the time spent finding the ethernet adapter, plugging the cable, configuring IP addresses, and testing with pings, any decent portable SSD drives should have finished copying tens of GB of data.
    • yjftsjthsd-h 1 day ago
      As the article says,

      > Removable storage is quite slow unless you are willing to spend a lot of money.

      An SSD good enough to copy tens of GB quickly is not cheap.

      • riobard 1 day ago
        At this particular point in time, yes SSD is expensive. But 5~10Gbps USB 3.0 SSD had been very affordable for a long time before 2025.
        • debugnik 1 day ago
          Unluckily for us, and the author at the time of writing, we're in 2026.
          • riobard 7 hours ago
            If you haven't yet got any portable drives in the drawer, chances are high that you rarely need to copy large amount of files around anyway. In which case free tier of cloud sync services would be preferred for the majority of users.
          • Dylan16807 11 hours ago
            You can still get a drive that will beat the ethernet connection by a lot for $50.

            But also I'd feel weird if I didn't have at least one good flash drive somewhere, so anyone like me would already have it.

            I'm going to ignore the part where the USB port described in the article sounds broken. A 100% functioning cable, especially a short one for a drive, is not hard to find.

  • lstodd 1 day ago
    I remember we played warcraft 2 over ~15m of cat3 cable stretched outside between two flats on 6th floor. Those were the times, lol.
    • bronlund 1 day ago
      I remember playing over a 9-pin RS232 null cable - but I guess that is telling about my age :D

      Not Warcraft though - some ancient DOS game.

      • croon 1 day ago
        I believe the first Command & Conquer was the one I played that way. But I'm young, so it can't possibly be the same, can it?
        • doublerabbit 18 hours ago
          The original CnC allowed you to play 1v1 via telephone number. Being 15, that was absolute wizardry.

          It would still works today if both parties have a landline.

          • me-vs-cat 4 hours ago
            Landline? I don't understand. If both parties have a LAN line, shouldn't they use that to communicate?
      • inigyou 1 day ago
        Before the world standardized on Ethernet/IP, Microsoft had an abstraction layer called DirectPlay. ("Direct" was that era's "Copilot" word for Microsoft)
        • pezezin 1 day ago
          FYI, EtherNet/IP is an industrial control protocol, not TCP/IP over Ethernet. Yes, that is the real name of the protocol, a more confusing name could not have been chosen...

          https://en.wikipedia.org/wiki/EtherNet/IP

          • idiotsecant 21 hours ago
            I use E/IP all the time and if i had a nickel for every time i had to explain this to people I wouldnt have to use E/IP anymore.
          • inigyou 21 hours ago
            FYI, IP is a phonetic acronym for "I pee", meaning "I urinate"

            Two letters can have more than one meaning!

      • Hikikomori 1 day ago
        Played Doom over null cable at home.
    • sgt 1 day ago
      When I did LAN parties we had 10base2 over thin coax. Terminators at each end. Of course it was unstable because people kept disconnecting and everyone lost connection.
    • ButlerianJihad 1 day ago
      For anyone today who's got copper wire stretched between any buildings, you are in danger and your configuration is quite unwise.

      For every standalone building that has a ground, that building also has an electrical potential. This potential is not necessarily the same between two neighboring buildings. When you stretch a copper line between them, you are tempting fate, electrically, not to mention the dangers of lightning strikes and the elements attacking that connection.

      It is generally recognized that fiber optics are not only very efficient and durable, but also impervious to electrical troubles of the type that may plague inter-building connections. Simply grab switches or routers that support at least one fiber-optic connection, and link up!

      • johnwalkr 1 day ago
        Ethernet is electrically isolated at every port (unless you really go out of your way in to design it otherwise in an internal design). Your advice is still correct but it's more about lightning or something gone wrong, it's not an immediate risk.
        • oasisaimlessly 19 hours ago
          Most equipment connects the shield of all ethernet ports to chassis ground, so you're back to zero isolation if you use shielded cables.
        • pezezin 1 day ago
          I don't remember how it happened, but I have seen faulty Ethernet devices suffering a power surge that burned the switch port they were connected to, so be careful.
          • johnwalkr 21 hours ago
            Inductance coils (usually inside the RJ45 jack itself) are what provides isolation. They are made from very thin wires so if something goes wrong this is the first and hopefully only thing that will break. If you apply enough voltage of course you can break things beyond this.
      • EvanAnderson 1 day ago
        I did work for a small community college back in the 90s that had expanded their building multiple times since the 70s. The electrical potential between different parts of the building was significant enough to make wired Ethernet unreliable. (I never did understand why this was-- multiple electric service entrances with separate grounds, I assume.)

        Because of this they were an early adopter of fiber-based networking. I remember being wowed by ATM over fiber running between closets at a blazing 155Mbps (with tons of 10BASE-T clients connected to FORE chassis switches).

      • MayeulC 19 hours ago
        I think it's generally OK if you leave the shielding unconnected at one end (good practice anyway to avoid ground loops). There is an electrically-insulating transformer in the connector (nothing that would resist a lightning strike, of course, though some surge protectors have 8P8C connectors).

        +1 for fiber though. Long fibers are cheaper, SFP connectors and modules are commonplace and have become quite cheap. Just need to learn a few new things, such as simplex/BiDi vs duplex fiber, and multimode vs mono mode.

      • lstodd 1 day ago
        Who cared, we were 15 at the time.

        Besides you worry too much. Entire cities were wired with cat5 hanged off steel cable between 9 to 15 story buildings in early 2000s, before fiber. Nothing burned down.

        • inigyou 1 day ago
          If your cable is shielded it's liable to spark and trip breakers. Happened to me when one building was horribly miswired (someone swapped live and ground somewhere) and fried part of my computer before the breaker tripped. In the worst case there isn't actually any breaker in the path (they are only on live wires and the worry here is ground loops) so your cable just melts. That didn't happen to me.

          Unshielded cable is theoretically isolated at both ends but who actually knows with some chinesium equipment?

  • constantlm 13 hours ago
    If this doesn't work, you could always try Laplink with a parallel cable
  • superdisk 1 day ago
    I used to do this to play Minecraft with my cousin without a router.
  • theodric 23 hours ago
    "Plug two computers into each other with a network cable and staticly configure the IP addresses" should not be a novel or notable enough idea to trend on HN! This is boggling.
    • federiconafria 20 hours ago
      I thought what made the article special was the use of a "patch" cable but the network cards should be able to negotiate anyway, I was very confused about what was the notable thing.
      • theodric 16 hours ago
        Auto-MDI/X (auto-crossover) was codified in IEEE 802.3ab-1999, the specifcation for gigE, 27 years ago
        • a96 2 hours ago
          And it's even been supported really well for almost as long.
  • ButlerianJihad 1 day ago
    It seems a strange choice, for the demo and for the script, to manually configure addresses on both ends. If your TCP/IP stack is functioning properly, this will not be necessary. Once DHCP fails, you should get a pair of 169.254.0.0/16 (APIPA) addresses, and then Bob's your uncle.

    Configuring all this manually adds extra complexity when it seems that the goal is simply to connect up your cable and let 'er fly.

    • rmunn 1 day ago
      Back in my college days, 169.254.x.y addresses were the bane of my existence, because my job was getting students' computers set up with the brand-new Ethernet connection in their dorm room. This usually required a tech to come out to their room and configure Windows 95 properly, with IP and DHCP instead of Novell Netware and IPX (I don't remember why Netware/IPX was the default on so many Windows 95 installs, but that was definitely what I found most often when I went to look at someone's computer that "wasn't connecting to the Internet".)

      Occasionally we had someone who knew what they were doing and had their Windows 95 settings set up correctly, and then all we had to do was activate their room's Ethernet port and add their MAC address to the DHCP server's list of authorized MACs. But most often I or one of the other techs had to head down to the person's dorm room and set up their computer's network settings correctly before it would work. Once the 169.254 address was replaced by 192.168, my job was finally done. But there were times when that took some doing.

      • kjs3 16 hours ago
        I don't remember why Netware/IPX was the default on so many Windows 95 installs

        Because Quake multiplayer originally used IPX, not TCP. At least, that's why I had IPX loaded...

    • ma2kx 1 day ago
      And if you prefer ipv6 you can as well just ping -6 ff02::1%eth0 (or eno1 or whatever your devices name in the particular subnet is) and receive all fe80 addresses of other hosts in the subnet.

      Also, why is he talking about "ethernet"? Its the IP layer, not the ethernet layer...

    • inigyou 1 day ago
      You still need to know what the address is.
    • preisschild 1 day ago
      Or just hostnames (mDNS configured to resolve/advertise on ipv6 link-local addresses)
  • ltbarcly3 1 day ago
    Ok is there a version for usb-c? Because that would be 10x or more faster and I have a usb-c port and a usb-c cable at all times.
    • johnwalkr 1 day ago
      Depends on the device, in principle if both have thunderbolt and you use a thunderbolt cable it should work. I've done it between 2 macbooks many times.
    • okanat 1 day ago
      There is, if said USB-C ports are both Thunderbolt 3+ or USB4. Thunderbolt will create a ad-hoc 10G network device between two hosts.
    • Ballas 1 day ago
      If one of the devices support DRD (OTG), but unless one of them is an ARM device, chances are slim.
      • rcxdude 1 day ago
        With USB-C this is a lot more likely, the main issue is going to be software support (Decent chance you could hack something up if one of the devices is running linux. No idea if anything exists for windows).
      • xuhu 1 day ago
        Could a smartphone sit between 2 regular laptops to achieve this with 3 USB cables and a hub ?
        • rcxdude 1 day ago
          You would need a USB hub that could turn a USB device into two USB device ports, which I don't think exists. (hubs are essentially only a host-side thing).
    • preisschild 1 day ago
      You can use USB4STREAM on linux if its USB4 https://www.phoronix.com/news/Intel-Linux-USB4STREAM
    • kotaKat 1 day ago
      • johnwalkr 1 day ago
        What a clever idea. I carry an ethernet dongle but this one is just the male end and a female usb-c port, meaning your existing usb-c cable is useful and you don't need to carry an ethernet cable.
      • Steltek 1 day ago
        Oh. My. God. I thought you were just going to link a network dongle. "Yeah, I have a drawer of those". It never occurred to me that you could point it in the other direction.

        I'm ordering a dozen. Okay, maybe 3. But still, those look amazing.

        • johnwalkr 21 hours ago
          Me too, I always have a dongle and an ethernet cable just in case but this removes the need for a cable (I always have 2+ usb-c cables). I've also just found something similar for HDMI, also removing the need to carry an HDMI cable. Trying to think of more things, not sure why I didn't think of searching for these before because I have made something similar for the console serial port connector for raspberry pi and Jetson boards.
        • kotaKat 1 day ago
          I have been using USB-C dongles like this for a hot minute now paired with a nice retractable travel cable. I have a couple of these, an HDMI male one, a DisplayPort male one - I can plug basically into any hotel TV or monitor in my travels and run a laptop, phone, whatever off of the cables in my bag for charging, data, or video.
          • Steltek 1 day ago
            Yeah, I discovered the same concept for HDMI and USB C->A. The HDMI one is especially useful.

            It'd be super handy to have a wired failsafe while traveling without dragging an ethernet cable around for no reason.

  • doublerabbit 17 hours ago
    Next up, token ring networks.

    Remove one cable and the network falls flat, or I thinking of another topology?

    I do wonder sometimes how the world would be operating if IPX was the primary ethernet. I never got to play with it.

  • slipperybeluga 20 hours ago
    [dead]
  • steve1977 1 day ago
    People discovering that network cables can be used to network things. And then calling it a "trick" (I'm surprised it's not a "hack" actually).
    • dang 20 hours ago
      "Please don't sneer, including at the rest of the community." (https://news.ycombinator.com/newsguidelines.html) It's reliably a marker of bad comments and worse threads.

      If you know more than others, that's great! but in that case please share some of what you know so the rest of us can learn. Here, for example, it could be possible to add related facts about networking, other ways of connecting computers, obscure details, war stories, bits of history - who knows? All such things could make the discussion more interesting and fun.

      (Edit: here's a great example of what I mean. This comment is currently at the top of the thread, which is what we want here: https://news.ycombinator.com/item?id=49506392.)

      By contrast, dyspeptic supercilious putdowns do no good, other than perhaps providing a temporary internal status hit (at others' expense).

      https://hn.algolia.com/?dateRange=all&page=0&prefix=true&que...

    • puzzlingcaptcha 1 day ago
      "It's possible to just connect two computers together with Ethernet" - on the front page of hackernews. Incredible. Ethernet over USB4 interdomain protocol at least had some novelty, but this...
      • dang 20 hours ago
        Can you please see https://news.ycombinator.com/item?id=49512349 and, in the future, share some of what you know instead of putting down others (including the community)?
      • hdgvhicv 1 day ago
        HN has very little understanding of networking in general.
        • dang 20 hours ago
          Can you please see https://news.ycombinator.com/item?id=49512349 and, in the future, share some of what you know instead of putting down others (including the community)?
        • rcxdude 1 day ago
          It does seem to be a surprisingly common blindspot of programmers in general. I strongly recommend programmers learn it, it can save a lot of headaches in system architecture.
          • jcalx 22 hours ago
            Any recommendations on a good path to learn this — curious if you have any personal, opinionated thoughts on this.
            • Gud 21 hours ago
              Buy some cheap computer, pop in a few NICs, setup a FreeBSD or OpenBSD gateway, including DNS and some other goodies.

              And by cheap, any $10 relic will do.

              You’ll find their manuals very informative.

        • bombcar 20 hours ago
          Especially since most machines will just WORK with auto-assigned magic weird IPs and you'll actually be able to share files directly via the OS if you do this, no need for Linux netcat tricks at all.

          Now I still remember when target disk mode over ethernet was being talked about.

        • inigyou 1 day ago
          Programmers have very little understanding of computers, in general.

          They'll think hard about a beautiful unrealistic idealisation of the problem, and/or treat a software abstraction as if it's the underlying reality, e.g. (of the latter) thinking networking starts with HTTP and languages start with JavaScript.

          • dang 20 hours ago
            Can you please see https://news.ycombinator.com/item?id=49512349 and, in the future, share some of what you know instead of putting down others?
            • inigyou 20 hours ago
              Just read the contract from the other side! If focusing on idealistic software abstractions instead of the problem is bad, the implication is that focusing on the problem is good. If treating a software abstraction as the underlying reality is bad, the implication is that looking below it to the actual underlying reality is good.
          • abanana 1 day ago
            Agreed, except IME this is "junior web developers" rather "(real) programmers" in general.
            • inigyou 21 hours ago
              Mel wouldn't. But Mel isn't programmers.
        • dewey 21 hours ago
          HN has very little understanding of many things, especially if you are familiar with <specific thing>.

          https://en.wiktionary.org/wiki/Gell-Mann_Amnesia_effect

    • concerned_user 1 day ago
      Back in the day you needed a modified cable for this with RX/TX swapped on one end but nowadays probably all nic chips have auto-detect so you can take a normal patch cable and do it.
      • pezezin 1 day ago
        Gigabit Ethernet sends and receive over the 4 pairs simultaneously using echo cancellation, so it doesn't need crossover cables.
      • bronlund 1 day ago
        Yeah, I remember those. When setting up an ad-hoc network, you were like; "where the eff is the crossover cable!" :D
        • luz666 1 day ago
          it was the red one, right?
          • bronlund 1 day ago
            Mine was just a custom made gray one, but I have seen those red ones, yes :D
            • Ekaros 1 day ago
              I bought bunch of ready made 10 meter cables for lan party dunno 15 or 20 years ago... Used with switch... Grey with nice paper label at end with "Cross over"...

              Haven't had any issues with them ever in regular use... So pointless even back then...

              • bronlund 1 day ago
                If using a switch, there isn't any need for crossover cables, is it?
          • ErroneousBosh 1 day ago
            Mine were grey same as the normal patch cables but had red Hellerman sleeves at the ends.

            Look at you with your fancy red Cat5 ;-)

      • steve1977 1 day ago
        Yeah so called crossover cables. But that's like decades ago.
        • johnwalkr 1 day ago
          Yeah it's been about 20 years since there was a risk this didn't work.
      • dolmen 1 day ago
        In fact you just need one of the two ends to be able to auto swap RX/TX.
        • myself248 1 day ago
          When I hacked a USB2-GigE adapter into my old Toughbook CF-m34 to replace the stock 10/100 adapter, it wasn't for the speed. I didn't need the speed, and of course USB2 wouldn't let me use the whole gig anyway.

          But GigE uses all four pairs, so the hardware has transceivers behind all four pairs, which means even when they're running at 10 or 100, the chipset can choose which pairs to transmit and receive on. Thus all GigE adapters are Auto-MDIX, and it meant I no longer needed to carry a crossover cable, no matter what other device I was talking to.

          It's funny how 10/100 cards with Auto-MDIX capability were exotic and expensive, but once GigE had it by default, it became ubiquitous, cheap, and quickly forgotten.

      • Hikikomori 1 day ago
        Not really modified, you could buy them pre terminated or put on your own rj45 and just wire it as crossover.
    • alnwlsn 21 hours ago
      There is always some young person or new to the field learning for the first time. Post like this are exactly how I learned.
    • yjftsjthsd-h 1 day ago
      If you're used to a "normal" network with a router, it's a revelation that you can go direct.
      • anon35 1 day ago
        Exactly. No need to get cynical about this being news. Maybe not news to you (or me, I'm old) but it could be really interesting news to others. See also: https://xkcd.com/1053/
    • teeray 20 hours ago
      Some of my favorite content are those that are like “hey, there’s no magic here.” See also: all of Ben Eater’s videos.
    • j1elo 1 day ago
      On related news, you can talk point to point with just a pair of copper wires that physically connects with a device on the other side!

      Wait there's more: a couple of simple plastic glasses joined with a string under tension also does the trick.

      However more seriously, while being snarky about "obvious" things can be fun, we should all remember to acknowledge the xkcd's "Ten Thousand" effect as a very real law of life.

      • abanana 1 day ago
        > xkcd's "Ten Thousand" effect

        True in general, but Hacker News isn't a school for beginners to technology.