zoukankan      html  css  js  c++  java
  • 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       【效果同上】

    image_thumb[9]

    [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 【效果同上】

    image_thumb[10]

    [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     【效果同上】

    image_thumb[6]

  • 相关阅读:
    Tree Restoration Gym
    Game HDU
    Codeforces Gym 191033 E. Explosion Exploit (记忆化搜索+状压)
    listview去掉条目间的分割线
    listview设置条目点击的时候不变色(让状态选择器不起作用)
    url拼凑示例(具体拼凑规则由服务器定)
    格式化一个文件的大小(size),或者说是格式化一个app的大小(size)
    ratingbar设置不可调节星星数量
    listview的条目(item)如何做出卡片效果
    安卓网络权限异常
  • 原文地址:https://www.cnblogs.com/ftl1012/p/ip.html
Copyright © 2011-2022 走看看