CentOS7网络调试
快捷键操作 查看系统的IP地址 增⼤终端字体: "ctrl" + "shfit" + "+" 减⼩终端字体: "ctrl" + "-" 第⼀种⽅式: [root@hangzhouyunjisuan1802 ~]# ip a 1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000 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 inet6 ::1/128 scope host valid_lft forever preferred_lft forever 2: ens33: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000 link/ether 00:0c:29:88:93:09 brd ff:ff:ff:ff:ff:ff inet 192.168.13.248/24 brd 192.168.13.255 scope global noprefixroute dynamic ens33 valid_lft 1573sec preferred_lft 1573sec inet6 fe80::5f0a:bf7f:7d7b:813f/64 scope link noprefixroute valid_lft forever preferred_lft forever 3: virbr0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN group default qlen 1000 link/ether 52:54:00:fc:21:fa brd ff:ff:ff:ff:ff:ff inet 192.168.122.1/24 brd 192.168.122.255 scope global virbr0 valid_lft forever preferred_lft forever 4: virbr0-nic: <BROADCAST,MULTICAST> mtu 1500 qdisc pfifo_fast master virbr0 state DOWN group default qlen 1000 link/ether 52:54:00:fc:21:fa brd ff:ff:ff:ff:ff:ff [root@hangzhouyunjisuan1802 ~]# 第⼆种⽅式: sshd连接<在windows机器中连接Linux主机, 使⽤xshell终端> 测试⽹络连通性 [root@hangzhouyunjisuan1802 ~]# ifconfig ens33: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 inet 192.168.13.248 netmask 255.255.255.0 broadcast 192.168.13.255 inet6 fe80::5f0a:bf7f:7d7b:813f prefixlen 64 scopeid 0x20<link> ether 00:0c:29:88:93:09 txqueuelen 1000 (Ethernet) RX packets 279 bytes 29182 (28.4 KiB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 314 bytes 29547 (28.8 KiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 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 32 bytes 2592 (2.5 KiB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 32 bytes 2592 (2.5 KiB) 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:fc:21:fa 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 [root@hangzhouyunjisuan1802 ~]# [C:/]$ ssh root@<ip地址> [root@localhost ~]# ping www.baidu.com //测试外部⽹络连通是否正常 [root@localhost ~]# clear //清空终端显示"ctrl+l" //成功通信 [root@hangzhouyunjisuan1802 ~]# ping 10.31.165.37 PING 10.31.165.37 (10.31.165.37) 56(84) bytes of data. 64 bytes from 10.31.165.37: icmp_seq=1 ttl=128 time=0.357 ms 64 bytes from 10.31.165.37: icmp_seq=2 ttl=128 time=0.550 ms 64 bytes from 10.31.165.37: icmp_seq=3 ttl=128 time=0.801 ms //失败通信 [root@hangzhouyunjisuan1802 ~]# ping 192.168.235.131 PING 192.168.235.131 (192.168.235.131) 56(84) bytes of data. ^C --- 192.168.235.131 ping statistics --- 27 packets transmitted, 0 received, 100% packet loss, time 26020ms [root@hangzhouyunjisuan1802 ~]#