Skip to content

Latest commit

 

History

History
154 lines (88 loc) · 3.17 KB

File metadata and controls

154 lines (88 loc) · 3.17 KB

第3节 IP命令


❤️💕💕linux常用的网络命令补充,网络知识的补充,Linux网络编程基础。Myblog:http:https://nsddd.top


[TOC]

IP命令

IP命令是iproute软件包中强大的网络管理工具,ifconfigroute命令的作用,查看系统路由、网络设备、设置策略等功能

IP --help
# 或者
man ip

help帮助

  • OBJECT:表示可操作的对象
  • COMMAND:表示针对对象要操作的动作,一般指的是增删改查
root@ubuntu:~# ip --help 
Usage: ip [ OPTIONS ] OBJECT { COMMAND | help }
       ip [ -force ] -batch filename
where  OBJECT := { link | address | addrlabel | route | rule | neigh | ntable |
                   tunnel | tuntap | maddress | mroute | mrule | monitor | xfrm |
                   netns | l2tp | fou | macsec | tcp_metrics | token | netconf | ila |
                   vrf | sr | nexthop }
       OPTIONS := { -V[ersion] | -s[tatistics] | -d[etails] | -r[esolve] |
                    -h[uman-readable] | -iec | -j[son] | -p[retty] |
                    -f[amily] { inet | inet6 | mpls | bridge | link } |
                    -4 | -6 | -I | -D | -M | -B | -0 |
                    -l[oops] { maximum-addr-flush-attempts } | -br[ief] |
                    -o[neline] | -t[imestamp] | -ts[hort] | -b[atch] [filename] |
                    -rc[vbuf] [size] | -n[etns] name | -N[umeric] | -a[ll] |
                    -c[olor]}

查看地址信息

ip addr show 
# 或者
ip addr 
# 或者
ip a 

显示详细的信息

ip -s link show dev ens33

修改和添加网卡、mac地址

停止网卡

ip link set ens33 down 

开启网卡

ip link set ens33 up

修改Mac地址

ip link set ens33 address 0:0c:29:13:10:11

添加删除IP

/24表示子网掩码为:255.255.255.0

ip address add 192.168.178.150/24 dev ens33

image-20220923114600261

删除IP

ip address del 192.168.178.150/24 dev ens33

ip给网卡添加别名

ip address add 192.168.178.150/24 dev ens33 label ens33:1

IP 显示路由表信息

ip route

image-20220923114813175

ip检查arp缓存(显示网络邻居信息)

ip neighbour

image-20220923114939010

END 链接