V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
FlyingLion
V2EX  ›  DNS

求助:如何让 DNSMASQ 同时监听多个端口?

  •  
  •   FlyingLion · Feb 23, 2016 · 6489 views
    This topic created in 3718 days ago, the information mentioned may be changed or developed.

    事情是这样的,目前由于有的小运营商会完全劫持用户 53 端口的所有查询结果,所以我自己在 Ubuntu 上,用 DNSMASQ 搭建了一个小型自用的 DNS 服务器。

    它默认开放的是 53 端口。

    那么,请问具体要如何配置,才能让 DNSMASQ 在保留 53 端口开放的同时,还能再增加几个端口(例如 6666 、 9999 等),以备不时之需呢?

    (类似于 opendns 那种,在开放了 53 的同时,还开放了 5353 等等)

    谢谢!

    9 replies    2017-05-19 11:15:13 +08:00
    LGA1150
        1
    LGA1150  
       Feb 23, 2016 via Android
    可以用 iptables 转发入站流量
    FlyingLion
        2
    FlyingLion  
    OP
       Feb 23, 2016
    @LGA1150 具体怎么个写法呢?
    FlyingLion
        3
    FlyingLion  
    OP
       Feb 23, 2016
    哥哥们帮帮忙呗

    我刚上小学 5 年级, iptables 什么的不是太懂……

    能不能具体帮忙写一写怎么用呢?
    2001225354
        4
    2001225354  
       Feb 23, 2016
    @FlyingLion 现在小学生都这么牛了。 。。。。
    FlyingLion
        5
    FlyingLion  
    OP
       Feb 23, 2016
    大家帮帮忙呗
    Lentin
        6
    Lentin  
       Feb 27, 2016
    iptables -t nat -D PREROUTING -p tcp --dport 5353 -j REDIRECT --to-ports 53
    iptables -t nat -D PREROUTING -p udp --dport 5353 -j REDIRECT --to-ports 53
    bclerdx
        7
    bclerdx  
       Mar 7, 2016
    @Lentin 看着头晕 ing
    ikw
        8
    ikw  
       May 19, 2017
    -D 是删除,应该用 -I 插到前面
    iptables -t nat -I PREROUTING -p tcp --dport 5353 -j REDIRECT --to-ports 53
    iptables -t nat -I PREROUTING -p udp --dport 5353 -j REDIRECT --to-ports 53

    @Lentin #6
    Lentin
        9
    Lentin  
       May 19, 2017
    @zwpaper #8 谢谢更正,本来想更正一下后来忘了
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   3647 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 38ms · UTC 10:37 · PVG 18:37 · LAX 03:37 · JFK 06:37
    ♥ Do have faith in what you're doing.