zoukankan      html  css  js  c++  java
  • 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

  • 相关阅读:
    springMVC实现表单上传文件,MultipartResolver介绍及配置
    利用 java.util.Timer来写一个定时器
    集合泛型的不变性,而数组具有协变性,注意赋值容易导致的出错
    Python
    GenericServlet
    ServletRequest
    ServletConfig与ServletContext
    Servlet配置及生命周期
    使用jQuery实现Ajax
    XMLHttpRequest实现Ajax &数据格式JSON
  • 原文地址:https://www.cnblogs.com/embedded-linux/p/10622726.html
Copyright © 2011-2022 走看看