zoukankan      html  css  js  c++  java
  • Linux下route add 命令加入路由列表

    route add命令的主要作用是加入静态路由,通常的格式是:
    route ADD 157.0.0.0 MASK 255.0.0.0  157.55.80.1 METRIC 3 IF 2
    參数含义:destination   mask     gateway     metric   interface     /* 能够缩写 */


    destination【网段地址】 
    mask【子网掩码】
    gateway【网关地址】  gw
    metric 【路由跳数】
    if【port号】
    普通情况下。不涉及本机地址,除非你要做測试。


    当中:
    能够省略【路由跳数】參数;
    当通往该网关地址的路径唯一时,【port号】參数能够省略。(由于在多port的路由交换设备上,可能存在通往同一个IP地址的多条备份路径。)
    mask 是keyword。不能省略。

    route add 134.105.0.0 mask 255.255.0.0 134.105.64.1
    意思是:所有须要发往134.105.0.0/16地址段的IP数据包。所有由134.105.64.1路径转发。


    这个命令在大型IP网络组建时经经常使用到,在不同厂商的设备上命令格式可能不同,但原理是一样的。

    假设有多条路由。依据不同的路由协议(比方rip, ospf等)的规定。一般优先选择网段地址小的路由。比方,当下面两条路由同一时候被加入的时候:
    route add 134.105.0.0 mask 255.255.0.0 134.105.64.1
    route add 134.105.128.0 mask 255.255.128.0 134.105.0.1

    目标地址是134.105.128.1的IP包会优先选择第二条路由。


    route add default  gw  210.41.141.110     /*  210.41.141.110 路由器的IP */

  • 相关阅读:
    remove white space from read
    optimize the access speed of django website
    dowload image from requests
    run jupyter from command
    crawl wechat page
    python version 2.7 required which was not found in the registry windows 7
    health
    alternate rows shading using conditional formatting
    word
    【JAVA基础】static 关键字
  • 原文地址:https://www.cnblogs.com/gccbuaa/p/7117029.html
Copyright © 2011-2022 走看看