One awesome thing about SFTP is that it relies so heavily on SSH,
which almost always works flawlessly with IPv6.
Let's check it out.
Unlike FTP and FTPS,
SFTP is an entirely different protocol and is transported inside SSH.
As such, SFTP as an application doesn't even care about IPv4 or IPv6.
The process is identical.
Let's review the download script first.
Remember, we must use debug 9 to see the low-level SFTP exchanges here.
I'm substituted the IPv4 address for an IPv6 address,
representing the SFTP server.
After changing into the FTP directory, I use the get command to download R1.cfg.
Let's execute the script.
To avoid being too repetitive,
I'll only briefly cover the five main steps in the SFTP download.
The client issues the open message specifying R1.cfg, the file to be downloaded.
The server responds with a handle,
an arbitrary string that gives the client a unique
touch point to access the file.
The handle in this example is eight 0s.
The client issues a read message that specifies the handle behind the scenes.
The server responds with a data message,
which could include several IPv6 packets to carry
the file's contents to the client.
To finish up, the client issues the close message.
The process is identical to IPv4 SFTP.
Easy, right?
Now for the upload.
The script is identical to the previous one,
except for the last line which uses the put command to perform an upload.
Let's see how it works.
Like the download,
the first two steps include the client sending the open message and the
server replying with a handle that represents R3.cfg.
The client sends a write message containing both the
handle and data to be uploaded.
The server acknowledges this by sending a status successful message in response.
Once complete, the client sends a close message that completes the transaction.
Feel free to run these scripts on your own to explore the debug log in greater detail.