文章插圖

文章插圖
Ubuntu 16.04查看IP、網關、DNS等信息
[email protected]:~# cat /proc/version #查看發行版本
Linux version 4.9.40-eve-ng-ukms-2+ ([email protected]) (gcc version 5.4.0 20160609 (Ubuntu 5.4.0-6ubuntu1~16.04.4) ) #4 SMP Fri Sep 15 02:07:02 CEST 2017
[email protected]:~#
查看IP地址:
[email protected]:~# ifconfig
[email protected]:~# ip add show
查看路由、網關(gateway)
[email protected]:~# route
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
default 192.168.246.2 0.0.0.0 UG 0 0 0 pnet0
[email protected]:~# route -n #-n 表示不解析名字
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
0.0.0.0 192.168.246.2 0.0.0.0 UG 0 0 0 pnet0
10.163.1.0 0.0.0.0 255.255.255.0 U 0 0 0 pnet1
Flags,如果是U代表活動的路由,出現G代表這個網絡接口連接的是網關,H代表是一個主機
[email protected]:~# netstat -rn
Kernel IP routing table
Destination Gateway Genmask Flags MSS Window irtt Iface
0.0.0.0 192.168.246.2 0.0.0.0 UG 0 0 0 pnet0
10.163.1.0 0.0.0.0 255.255.255.0 U 0 0 0 pnet1
查看DNS
[email protected]:~# cat /etc/resolv.conf
# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)
# DO NOT EDIT THIS FILE BY HAND — YOUR CHANGES WILL BE OVERWRITTEN
nameserver 192.168.246.2
[email protected]:~#
查看網絡服務狀態
[email protected]:~# systemctl status networking
重啟網絡服務
[email protected]:~# systemctl restart networking
或
[email protected]:~# service networking restart
ping命令
[email protected]:~# ping -c 3 192.168.246.2 #向網關ping 3個包
PING 192.168.246.2 (192.168.246.2) 56(84) bytes of data.
64 bytes from 192.168.246.2: icmp_seq=1 ttl=128 time=0.251 ms
64 bytes from 192.168.246.2: icmp_seq=2 ttl=128 time=0.300 ms
64 bytes from 192.168.246.2: icmp_seq=3 ttl=128 time=0.280 ms
— 192.168.246.2 ping statistics —
3 packets transmitted, 3 received, 0% packet loss, time 2039ms
rtt min/avg/max/mdev = 0.251/0.277/0.300/0.020 ms
查看網絡接口配置文件
[email protected]:~# cat /etc/network/interfaces
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).
# The loopback network interface
auto lo
iface lo inet loopback
# The primary network interface
iface eth0 inet manual
auto pnet0
iface pnet0 inet static
address 192.168.246.177
netmask 255.255.255.0
gateway 192.168.246.2
dns-nameservers 192.168.246.2
bridge_ports eth0
bridge_stp off
關閉接口
[email protected]:~# ifdown pnet3
啟用接口
[email protected]:~# ifup pnet3
[email protected]:~# ifdown eth0 #想關閉eth0來著,但是系統提示沒有配置,估計是eth0沒有配置IP地址的原因
ifdown: interface eth0 not configured
[email protected]:~#
查看路由跟蹤信息
[email protected]:~# traceroute www.toutiao.com
traceroute to www.toutiao.com (36.156.179.242), 30 hops max, 60 byte packets
1 192.168.246.2 (192.168.246.2) 0.125 ms 0.059 ms 0.084 ms
【ubuntu網絡配置文件詳解 ubuntu配置上網】2 * * *
- 網絡監控的安裝方法 網絡監控安裝教程視頻
- 什么叫推廣引流 網絡推廣引流是什么意思
- 常用的網絡安全模型 請畫出一個通用的網絡安全模型
- Ubuntu設置IP地址 ubuntu系統設置ip地址
- 網絡延遲正常范圍 網絡時延多少是正常
- nas存儲如何搭建 nas網絡存儲怎么搭建
- 網絡安全模型有哪幾種 常見的網絡安全模型有哪些
- 很喜歡文學是什么梗
- 網絡購物安全的防范措施論文 如何防范網絡購物安全問題
- 怎么重置網絡命令 怎么取消電腦網絡重置
