Linux ip命令详解
ip命令式用来配置网卡ip信息的命令,且是未来的趋势,重启网卡后IP失效
ip常见命令参数
Usage: ip [ OPTIONS ] OBJECT { COMMAND | help } ip [ -force ] -batch filename where OBJECT := { link | addr | addrlabel | route | rule | neigh | ntable | tunnel | maddr | mroute | mrule | monitor | xfrm } OPTIONS := { -V[ersion] | -s[tatistics] | -d[etails] | -r[esolve] | -f[amily] { inet | inet6 | ipx | dnet | link } | -o[neline] | -t[imestamp] | -b[atch] [filename] | -rc[vbuf] [size]}
ip addr 常见命令参数
Usage: ip addr {add|change|replace} IFADDR dev STRING [ LIFETIME ] [ CONFFLAG-LIST] ip addr del IFADDR dev STRING ip addr {show|flush} [ dev STRING ] [ scope SCOPE-ID ] [ to PREFIX ] [ FLAG-LIST ] [ label PATTERN ] IFADDR := PREFIX | ADDR peer PREFIX [ broadcast ADDR ] [ anycast ADDR ] [ label STRING ] [ scope SCOPE-ID ] SCOPE-ID := [ host | link | global | NUMBER ] FLAG-LIST := [ FLAG-LIST ] FLAG FLAG := [ permanent | dynamic | secondary | primary | tentative | deprecated | CONFFLAG-LIST ] CONFFLAG-LIST := [ CONFFLAG-LIST ] CONFFLAG CONFFLAG := [ home | nodad ] LIFETIME := [ valid_lft LFT ] [ preferred_lft LFT ] LFT := forever | SECONDS
常用的命令展示
为网卡配置和删除IPv4地址 【临时生效,永久生效需要更改配置文件】
eth2网卡配置文件: /etc/sysconfig/network-scripts/ifcfg-eth2
[root@localhost ~]# ip addr add 192.168.25.166/24 dev eth0
[root@localhost ~]# ifconfig eth0 192.168.25.166 netmask 255.255.255.0 up 【效果同上】
[root@localhost ~]# ifconfig eth0 192.168.25.166/24 up 【效果同上】
[root@localhost ~]# ip addr add 192.168.25.166/24 dev eth0:ws
[root@localhost ~]# ifconfig eth0:ws 192.168.25.166/24 up 【效果同上】
[root@localhost ~]# ifconfig eth0:ws 192.168.25.166 netmask 255.255.255.0 up 【效果同上】
[root@localhost ~]# ip addr del 192.168.25.166/24 dev eth0:ws
[root@localhost ~]# ifconfig eth0:ws 192.168.25.166 netmask 255.255.255.0 down 【效果同上】
[root@localhost ~]# ifconfig eth0:ws 192.168.25.166/24 dwon 【效果同上】
作者:小a玖拾柒
-------------------------------------------
个性签名: 所有的事情到最後都是好的,如果不好,那說明事情還沒有到最後~
本文版权归作者【小a玖拾柒】和【博客园】共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,否则保留追究法律责任的权利!