by yonatan8070 · 3mo ago · 0 comments
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.
> 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)
# 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.