【操作系统】Linux查询接口IP路由表信息

目的:学习Liunx系统下网络相关配置,包括接口  IP  路由等

环境:Fedora 28,版本信息如下

[chenbixian@MiWiFi-R1CM-srv ~]$ cat /proc/version 
Linux version 4.19.10-200.fc28.x86_64 ([email protected]) (gcc version 8.2.1 20181105 (Red Hat 8.2.1-5) (GCC)) #1 SMP Mon Dec 17 15:46:19 UTC 2018

1.查询接口配置 ifconfig

[chenbixian@MiWiFi-R1CM-srv ~]$ ifconfig
wlp9s0: flags=4163  mtu 1500
        inet 192.168.31.140  netmask 255.255.255.0  broadcast 192.168.31.255
        inet6 fe80::c301:8b93:685e:ac1e  prefixlen 64  scopeid 0x20
        ether ec:55:f9:c0:83:87  txqueuelen 1000  (Ethernet)
        RX packets 15931  bytes 9029997 (8.6 MiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 12064  bytes 2510545 (2.3 MiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

 

2.查询IP配置 ip address 

[chenbixian@MiWiFi-R1CM-srv ~]$ ip address 
3: wlp9s0: mtu 1500 qdisc mq state UP group default qlen 1000
    link/ether ec:55:f9:c0:83:87 brd ff:ff:ff:ff:ff:ff
    inet 192.168.31.140/24 brd 192.168.31.255 scope global dynamic noprefixroute wlp9s0
       valid_lft 42213sec preferred_lft 42213sec
    inet6 fe80::c301:8b93:685e:ac1e/64 scope link noprefixroute 
       valid_lft forever preferred_lft forever
 

3.查询路由配置信息 route

[chenbixian@MiWiFi-R1CM-srv ~]$ route
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
default         XiaoQiang       0.0.0.0         UG    600    0        0 wlp9s0
192.168.31.0    0.0.0.0         255.255.255.0   U     600    0        0 wlp9s0

 

你可能感兴趣的:(操作系统)