查看 Ipi 地址:
- [email protected]:~$ ifconfig
- eth2: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
- .NET 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
- .NET 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
- .NET 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
- .NET 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 地址
- [email protected]:~$ 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 次后就停止
- [email protected]:~$ 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
- [email protected]:~$ 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 网址
- [email protected]:~$ 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
来源: http://www.bubuko.com/infodetail-3046083.html