• 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

  • 相关阅读:
    pytest.4.Fixture
    pytest.3.Assert
    pytest.2.运行多个文件
    [LeetCode 378.] Kth Smallest Element in a Sorted Matrix
    priority_queue 自定义 comparator
    原地调整法查找数组元素
    [LeetCode 436.] Find Right Interval
    [LeetCode 611.] Valid Triangle Number
    二叉树Morris遍历
    用户态IO:DPDK
  • 原文地址:https://www.cnblogs.com/wsl222000/p/4476714.html
Copyright © 2020-2023  润新知