zoukankan      html  css  js  c++  java
  • linux下多ISP的策略路由

    http://kerry.blog.51cto.com/172631/385578/

    修改/etc/iproute2/rt_tables

    先在 /etc/iproute2/rt_tables 下建兩個 table
    echo "100 line1" >> /etc/iproute2/rt_tables
    echo "200 line2" >> /etc/iproute2/rt_tables
    # 設定 line1 的 gateway
    ip route add default via 100.100.100.254(网关) table line1
    # 設定 line2 的 gateway
    ip route add default via 200.200.200.254(网关) table line2
    # 指定從 100.100.100.100 進來的連線走 rule line1
    ip rule add from 100.100.100.100(接口IP) table line1
    # 指定從 200.200.200.200 進來的連線走 rule line1
    ip rule add from 200.200.200.200(接口IP) table line2


    额外创建两个路由表
    vi /etc/iproute2/rt_tables
    1 eth1table
    2 eth0table

    设置两个路由表中的路由:
    ip route add 124.207.105.0/24 dev eth0 src 124.207.105.228 table eth0table/ip route add 113.31.32.0/28 dev eth1 table lt_line
    ip route add default via 124.207.105.225 table eth0table
    ip route add 119.254.242.0/24 dev eth1 src 119.254.242.35 table eth1table
    ip route add default via 119.254.242.33 table eth1table

    ip route add 10.1.0.0/16 via 10.10.10.1 table eth1table
    设置路由规则
    ip rule add from 124.207.105.228 table eth0table 来自此IP的走哪个路由表
    ip rule add from 10.0.0.0/18 table ethotable 此网段走那个路由表
    ip rule add from 119.254.242.35 table eth1table

    ip route list查看路由策略
    ip route list table eth2table
    ip route show table eth2table

    =======================================================
    http://www.jbxue.com/LINUXjishu/10051.html
    ip route add default via 60.29.231.1 dev eth0 src 60.29.231.160 table cnc
    ip rule add from 60.29.231.160 lookup cnc
    ip rule add to 60.29.231.160 lookup cnc

  • 相关阅读:
    Miller-Rabin素性测试
    ###Canny边缘检测算子
    ###SIFT特征
    建立一个免费的网站
    ###C中的extern-static-const关键词
    ###Git使用问题
    ###Fedora下安装Retext
    ###使用phpmailer自动邮件提醒
    Markdown学习
    有线和无线同时连接,选择其一上网
  • 原文地址:https://www.cnblogs.com/wsl222000/p/4476714.html
Copyright © 2011-2022 走看看