1.A:接收方 查看ip
ifconfig
192.168.10.181
[root@localhost desktop]# ifconfig
enp0s31f6: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500
ether 00:40:45:3c:e2:4f txqueuelen 1000 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
device interrupt 16 memory 0xdf800000-df820000
enp4s0: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500
ether 00:40:45:3c:e2:50 txqueuelen 1000 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
device memory 0xdf500000-df5fffff
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10<host>
loop txqueuelen 1000 (Local Loopback)
RX packets 5554 bytes 3302393 (3.1 MiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 5554 bytes 3302393 (3.1 MiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
virbr0: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500
inet 192.168.122.1 netmask 255.255.255.0 broadcast 192.168.122.255
ether 52:54:00:23:07:51 txqueuelen 1000 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
wlp3s0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.10.181 netmask 255.255.255.0 broadcast 192.168.10.255
inet6 fe80::6729:1001:c39a:ae3a prefixlen 64 scopeid 0x20<link>
ether 1c:1b:b5:2f:17:87 txqueuelen 1000 (Ethernet)
RX packets 2558630 bytes 2915868941 (2.7 GiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 564724 bytes 83064491 (79.2 MiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
[root@localhost desktop]#
2.B: 发送方 ping 接收方ip
ping 192.168.10.181
ping 192.168.10.181
PING 192.168.10.181 (192.168.10.181) 56(84) bytes of data.
64 bytes from 192.168.10.181: icmp_seq=1 ttl=64 time=7.60 ms
64 bytes from 192.168.10.181: icmp_seq=2 ttl=64 time=3.86 ms
64 bytes from 192.168.10.181: icmp_seq=3 ttl=64 time=3.81 ms
64 bytes from 192.168.10.181: icmp_seq=4 ttl=64 time=5.62 ms
64 bytes from 192.168.10.181: icmp_seq=5 ttl=64 time=3.93 ms
64 bytes from 192.168.10.181: icmp_seq=6 ttl=64 time=4.37 ms
64 bytes from 192.168.10.181: icmp_seq=7 ttl=64 time=4.58 ms
64 bytes from 192.168.10.181: icmp_seq=8 ttl=64 time=3.68 ms
64 bytes from 192.168.10.181: icmp_seq=9 ttl=64 time=30.1 ms
64 bytes from 192.168.10.181: icmp_seq=10 ttl=64 time=4.01 ms
64 bytes from 192.168.10.181: icmp_seq=11 ttl=64 time=4.36 ms
3.发送方 按ctr+c 停止ping
4.发送方 使用scp命令 传递文件
scp /home/admin/Desktop/public-v0.1.tar.gz root@192.168.10.181:/home/admin/desktop/
scp 源文件路径 目标机器用户名@目标机器ip:目标文件夹
[admin@dev Desktop]$ scp /home/admin/Desktop/public-v0.1.tar.gz root@192.168.10.181:/home/admin/desktop/
The authenticity of host '192.168.10.181 (192.168.10.181)' can't be established.
ECDSA key fingerprint is SHA256:GPy5hkuNbwEUAkMSa3a/LX73GcQqV4ID7eBZf14TRwM.
ECDSA key fingerprint is MD5:44:5d:a3:eb:a9:41:aa:1b:12:65:7a:d1:95:f8:d8:16.
Are you sure you want to continue connecting (yes/no)? y
Please type 'yes' or 'no': y
Please type 'yes' or 'no': yes
Warning: Permanently added '192.168.10.181' (ECDSA) to the list of known hosts.
root@192.168.10.181's password:
public-v0.1.tar.gz 100% 203MB 2.9MB/s 01:10
[admin@dev Desktop]$
过程中根据提示输入yes 还有目标机器的密码即可
5.接收方 查看文件
在192.168.10.181 机器上查看传输成功的文件
6.发送方也可以用相对路径发送文件
[admin@dev Desktop]$ scp publicV0.2.tar.gz root@192.168.10.181:/home/admin/desktop
root@192.168.10.181's password:
publicV0.2.tar.gz 100% 204MB 10.7MB/s 00:19
[admin@dev Desktop]$