网络访问和管理
安全远程连接 - ssh。
[root ~]$ ssh root@120.77.222.217
The authenticity of host '120.77.222.217 (120.77.222.217)' can't be established.
ECDSA key fingerprint is SHA256:BhUhykv+FvnIL03I9cLRpWpaCxI91m9n7zBWrcXRa8w.
ECDSA key fingerprint is MD5:cc:85:e9:f0:d7:07:1a:26:41:92:77:6b:7f:a0:92:65.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '120.77.222.217' (ECDSA) to the list of known hosts.
root@120.77.222.217's password:
通过网络获取资源 - wget。
- -b 后台下载模式
- -O 下载到指定的目录
- -r 递归下载
发送和接收邮件 - mail。
网络配置工具(旧) - ifconfig。
[root ~]# ifconfig eth0
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 172.18.61.250 netmask 255.255.240.0 broadcast 172.18.63.255
ether 00:16:3e:02:b6:46 txqueuelen 1000 (Ethernet)
RX packets 1067841 bytes 1296732947 (1.2 GiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 409912 bytes 43569163 (41.5 MiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions
网络配置工具(新) - ip。
[root ~]# ip address
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN qlen 1
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
link/ether 00:16:3e:02:b6:46 brd ff:ff:ff:ff:ff:ff
inet 172.18.61.250/20 brd 172.18.63.255 scope global eth0
valid_lft forever preferred_lft forever
网络可达性检查 - ping。
[root ~]# ping www.baidu.com -c 3
PING www.a.shifen.com (220.181.111.188) 56(84) bytes of data.
64 bytes from 220.181.111.188 (220.181.111.188): icmp_seq=1 ttl=51 time=36.3 ms
64 bytes from 220.181.111.188 (220.181.111.188): icmp_seq=2 ttl=51 time=36.4 ms
64 bytes from 220.181.111.188 (220.181.111.188): icmp_seq=3 ttl=51 time=36.4 ms
--- www.a.shifen.com ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2002ms
rtt min/avg/max/mdev = 36.392/36.406/36.427/0.156 ms
显示或管理路由表 - route。
查看网络服务和端口 - netstat / ss。
[root ~]# netstat -nap | grep nginx
网络监听抓包 - tcpdump。
安全文件拷贝 - scp。
[root ~]# scp root@1.2.3.4:/root/guido.jpg hellokitty@4.3.2.1:/home/hellokitty/pic.jpg
文件同步工具 - rsync。
说明:使用
rsync
可以实现文件的自动同步,这个对于文件服务器来说相当重要。关于这个命令的用法,我们在后面讲项目部署的时候为大家详细说明。安全文件传输 - sftp。
[root ~]# sftp root@1.2.3.4
root@1.2.3.4's password:
Connected to 1.2.3.4.
sftp>
help
:显示帮助信息。ls
/lls
:显示远端/本地目录列表。cd
/lcd
:切换远端/本地路径。mkdir
/lmkdir
:创建远端/本地目录。pwd
/lpwd
:显示远端/本地当前工作目录。get
:下载文件。put
:上传文件。rm
:删除远端文件。bye
/exit
/quit
:退出sftp。