Linux基础06-网络命令

查看Ipi地址:

sailfish@DESKTOP-GSV91L5:~$ ifconfig
eth2: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.237.1  netmask 255.255.255.0  broadcast 192.168.237.255
        inet6 fe80::41dd:7cda:6cc8:525b  prefixlen 64  scopeid 0x0<global>
        ether 00:50:56:c0:00:01  (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
eth3: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.93.1  netmask 255.255.255.0  broadcast 192.168.93.255
        inet6 fe80::b4ca:766:f4fd:9787  prefixlen 64  scopeid 0x0<global>
        ether 00:50:56:c0:00:08  (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

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 1500
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x0<global>
        loop  (Local Loopback)
        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
wifi0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.0.105  netmask 255.255.255.0  broadcast 192.168.0.255
        inet6 fe80::615e:5438:ddf1:2ca9  prefixlen 64  scopeid 0x0<global>
        unspec 9C-B6-D0-0F-7F-3F-00-00-00-00-00-00-00-00-00-00  (UNSPEC)
        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

测试两台主机是否能通信 ping ip地址

sailfish@DESKTOP-GSV91L5:~$ ping 192.168.237.1
PING 192.168.237.1 (192.168.237.1) 56(84) bytes of data.
64 bytes from 192.168.237.1: icmp_seq=1 ttl=128 time=0.207 ms
64 bytes from 192.168.237.1: icmp_seq=2 ttl=128 time=0.202 ms
64 bytes from 192.168.237.1: icmp_seq=3 ttl=128 time=0.194 ms
64 bytes from 192.168.237.1: icmp_seq=4 ttl=128 time=0.192 ms
^C
--- 192.168.237.1 ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 3002ms
rtt min/avg/max/mdev = 0.192/0.198/0.207/0.018 ms

  ping ip地址 -c 4    ping4次后就停止

sailfish@DESKTOP-GSV91L5:~$ ping 192.168.237.1 -c 4
PING 192.168.237.1 (192.168.237.1) 56(84) bytes of data.
64 bytes from 192.168.237.1: icmp_seq=1 ttl=128 time=0.175 ms
64 bytes from 192.168.237.1: icmp_seq=2 ttl=128 time=0.199 ms
64 bytes from 192.168.237.1: icmp_seq=3 ttl=128 time=0.155 ms
64 bytes from 192.168.237.1: icmp_seq=4 ttl=128 time=0.161 ms

--- 192.168.237.1 ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 3002ms
rtt min/avg/max/mdev = 0.155/0.172/0.199/0.021 ms

  可以用Ping查看是否能够连接internet

sailfish@DESKTOP-GSV91L5:~$ ping www.baidu.com -c 4
PING www.a.shifen.com (14.215.177.38) 56(84) bytes of data.
64 bytes from 14.215.177.38 (14.215.177.38): icmp_seq=1 ttl=55 time=18.1 ms
64 bytes from 14.215.177.38 (14.215.177.38): icmp_seq=2 ttl=55 time=18.3 ms
64 bytes from 14.215.177.38 (14.215.177.38): icmp_seq=3 ttl=55 time=21.2 ms
64 bytes from 14.215.177.38 (14.215.177.38): icmp_seq=4 ttl=55 time=17.9 ms

--- www.a.shifen.com ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 3003ms
rtt min/avg/max/mdev = 17.945/18.910/21.211/1.347 ms

查看域名对应ip地址 nslookup 网址

sailfish@DESKTOP-GSV91L5:~$ nslookup www.baidu.com
Server:        222.246.129.80
Address:    222.246.129.80#53

Non-authoritative answer:
www.baidu.com    canonical name = www.a.shifen.com.
Name:    www.a.shifen.com
Address: 14.215.177.38
Name:    www.a.shifen.com
Address: 14.215.177.39

猜你喜欢

转载自www.cnblogs.com/sailifsh-lyh/p/10807736.html