mylara

Linux 多线接入路由器设置求教

  •  
  •   mylara · Feb 24, 2020 · 1418 views
    This topic created in 2276 days ago, the information mentioned may be changed or developed.
    想用 centos 搭个软路由,不想使用现有的软路由程序,查了下需要策略路由来实现,配了下没有通,请大家看看

    比如服务器 4 个网卡接口,虚拟机拓扑为:
    内网 192.168.1.254 网关是自身 网卡 eth0
    电信 22.22.22.22 网关 22.22.22.1 网卡 eth1
    联通 33.33.33.33 网关 33.33.33.1 网卡 eth2
    移动 44.44.44.44 网关 44.44.44.1 网卡 eth3

    /etc/iproute2/rt_tables 设置
    100 LAN
    101 Telecom
    102 Unicom
    103 Mobile

    #内网
    这里内网如何写规则呢??

    #电信线路
    /etc/sysconfig/network-scripts/route-eth1
    default via 22.22.22.1 src 22.22.22.22 dev eth1 table Telecom
    /etc/sysconfig/network-scripts/rule-eth1
    from 22.22.22.22 table Telecom

    #联通线路
    /etc/sysconfig/network-scripts/route-eth2
    default via 33.33.33.1 src 33.33.33.33 dev eth2 table Unicom
    /etc/sysconfig/network-scripts/rule-eth2
    from 33.33.33.33 table Unicom

    #移动线路
    /etc/sysconfig/network-scripts/route-eth3
    default via 44.44.44.1 src 44.44.44.44 dev eth3 table Mobile
    /etc/sysconfig/network-scripts/rule-eth3
    from 44.44.44.44 table Mobile


    还有个问题,请问如何匹配电信、联通、移动的路由表,实现内网访问某运营商,走特定线路呢?
    谢谢大家了。
    mylara
        1
    mylara  
    OP
       Feb 24, 2020
    再求一次
    JackMa888
        2
    JackMa888  
       Feb 27, 2020
    route add -net 192.168.1.0 netmask 255.255.255.0 gw 192.168.1.254 eth0
    route add -net 22.22.22.22 netmask 255.255.255.0 ge 22.22.22.1 eth1
    route add default gw 22.22.22.1 eth1
    指定网关即可!
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   5248 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 60ms · UTC 07:41 · PVG 15:41 · LAX 00:41 · JFK 03:41
    ♥ Do have faith in what you're doing.