• iproute2应用


    linux目前都支持ip命令,与ifconfig类似,但ifconfig的软件net-tools早不更新了,ip功能更强大,推荐使用iproute2套件。

     

    ip可以完美替换常用的网络命令,用法如下:

    Usage: ip [ OPTIONS ] OBJECT { COMMAND | help }

           ip [ -force ] -batch filename

    where  OBJECT := { link | address | addrlabel | route | rule | neighbor | ntable |

                       tunnel | tuntap | maddress | mroute | mrule | monitor | xfrm |

                       netns | l2tp | fou | tcp_metrics | token | netconf }

           OPTIONS := { -V[ersion] | -s[tatistics] | -d[etails] | -r[esolve] |

                        -h[uman-readable] | -iec |

                        -f[amily] { inet | inet6 | ipx | dnet | mpls | bridge | link } |

                        -4 | -6 | -I | -D | -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 | -a[ll] |?-c[olor]}

    常用命令如下:

    ip link

    ip addr show eth0

    ip addr add 192.168.0.100/24 dev eth0

    ip addr del 192.168.0.100/24 dev eth0

    ip route show

    ip route get 10.42.0.47 ;获取ip地址的路由包从哪里来

    ip route add default via 192.168.0.100

    ip neighbour     ;显示ARP MAC地址

    ip link set ppp0 down     ;断开连接,相当于ifconfig ppp0 down

    ip link set ppp0 up     ;连接,相当于ifconfig ppp0 up

    ip route help   

    注意IP地址要有一个后缀,比如/24。这种用法用于在无类域内路由选择(CIDR)中来显示所用的子网掩码。

    参考:

    https://linux.cn/article-3144-1.html

  • 相关阅读:
    微信小程序之某个节点距离顶部和底部的距离 createSelectorQuery
    js正则手机号 验证
    算法将一个对象中的某一个key值变为true,其他值都为false
    更改上传框的大小
    Educational Codeforces Round 85 (Div. 2)
    Codeforces Round #632 (Div. 2)
    AtCoder Beginner Contest 161
    Codeforces Round #631 (Div. 2)
    Codeforces Round #630 (Div. 2)
    Codeforces Round #629 (Div. 3)
  • 原文地址:https://www.cnblogs.com/embedded-linux/p/10622726.html
Copyright © 2020-2023  润新知