1

I have an issue with scp:

scp -pr xyz.zip [email protected]:/home/myuser/tmp/ does not work, while

scp -4 -pr xyz.zip [email protected]:/home/myuser/tmp/ works, what could go wrong here?

My assumption is that scp tries to use IPv6 but the routing is not correctly available? How can I debug this and make it work without the -4 option?

1
  • "Does not work" is vague. What is the exact error message? scp -v may tell you even more about what happens. Aug 12, 2022 at 6:49

1 Answer 1

1

My assumption is that scp tries to use IPv6 but the routing is not correctly available? How can I debug this and make it work without the -4 option?

Since scp runs over SSH, I'd check whether ssh (or perhaps ssh -6) is able to connect to the server. Normally I'd expect it to be broken in the same way. However, if interactive SSH shells work while SCP file transfers freeze mid-transfer, that's likely a MTU problem.

Make sure the IPv6 address found in DNS is actually correct. When running ssh -6 -v server.com, it'll show the address it's connecting to – check if it matches an address seen within the server's ip -6 addr. It's common that people update their A records (for IPv4) but neglect to update AAAA records for IPv6.

Try to ping -6 the server as well. If you also host a website, try to access it with curl -6, and so on. It could be a firewall issue, i.e. there might be a firewall rule allowing SSH access via IPv4 but not via IPv6. (For example, iptables is IPv4-only, while IPv6 rules have to be added using ip6tables – people often forget to add the rule in both places.)

Use tcpdump to see whether your IPv6 packets are received by the server. (For example, tcpdump -n -i eth0 ip6 – as root on the client and on the server, of course.) If the packets are sent by your machine but aren't received by the server, it may be a routing issue or a network-level firewall issue.

(For example, I've just set up a server at Oracle Cloud which recently gained IPv6 support, and although their system issued the server an IPv6 address by default, I still had to manually add an IPv6 default route for the VPC, as well as add IPv6 security group rules.)

If you do a transfer with scp -6 -v and it connects successfully but then freezes mid-transfer, look again at the tcpdump output. If you see a large packet being sent, re-sent, re-re-sent several times but it never arrives at the destination – it's a MTU issue (something is blocking the "Packet Too Big" ICMP errors).

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .