meng520
V2EX  ›  问与答

静态路由表 如何设置指定 ip 网段访问一个网关

  •  
  •   meng520 · Feb 1, 2016 · 6031 views
    This topic created in 3928 days ago, the information mentioned may be changed or developed.

    静态路由表 如何设置指定 ip 网段访问一个网关
    比如:
    我想把 192.168.1.0 - 192.168.1.254 指定访问 192.168.1.1
    一个的是这样:
    route add -p 192.168.1.0 mask 255.255.0.0 192.168.1.1
    一个网段的改怎么设置?

    11 replies  •  2016-02-02 11:41:01 +08:00
    orcusfox
    orcusfox
    Feb 1, 2016
    1
    这个掩码明显是三个 255 啊
    smallfount
    smallfount
    Feb 1, 2016
    2
    192.168.1.0 255.255.255.0 gateway

    然而例子里最大的问题是....你的网关理论上是 C 型的直连, 正常是配置不上去的....
    jasontse
    jasontse
    Feb 1, 2016 via iPad❤️1
    3
    你这通篇从做法到逻辑都不对,你直接说你想实现什么吧。
    meng520
    meng520
    OP
    Feb 1, 2016
    4
    @jasontse 我想把 192.168.1.0 - 192.168.1.254 指定通过 192.168.1.1 网关来访问网络 做多网卡使用
    raptium
    raptium
    Feb 1, 2016
    5
    既然能够访问到 192.168.1.1 了,访问同一个子网里的其他 IP 为啥还需要经过路由器呢?
    fangdingjun
    fangdingjun
    Feb 1, 2016
    6
    linux 下的 iproute2 工具可以设置策略路由,即根据源 ip 或目的 ip 设置不同的路由
    jasontse
    jasontse
    Feb 1, 2016 via iPad
    7
    @meng520
    访问 .0-.254 本来就不要网关的,你写与不写 .1 都是一样的。
    e1eph4nt
    e1eph4nt
    Feb 1, 2016
    8
    link scope 的,不需要设置路由吧,大家互相 arp 下就可以愉快的交流了
    twd2
    twd2
    Feb 1, 2016
    9
    您可能需要配置一下 dhcp 服务器...
    shakespaces
    shakespaces
    Feb 2, 2016
    10
    按理说默认不就应该这么走网关么…
    ahillgian
    ahillgian
    Feb 2, 2016
    11
    不知道你在胡乱的说什么....
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   5287 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 37ms · UTC 01:27 · PVG 09:27 · LAX 17:27 · JFK 20:27
    ♥ Do have faith in what you're doing.