FlyingLion
V2EX  ›  DNS

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

  •  
  •   FlyingLion · Feb 23, 2016 · 6775 views
    This topic created in 3908 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
    LGA1150
    Feb 23, 2016 via Android
    1
    可以用 iptables 转发入站流量
    FlyingLion
    FlyingLion
    OP
    Feb 23, 2016
    2
    @LGA1150 具体怎么个写法呢?
    FlyingLion
    FlyingLion
    OP
    Feb 23, 2016
    3
    哥哥们帮帮忙呗

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

    能不能具体帮忙写一写怎么用呢?
    2001225354
    2001225354
    Feb 23, 2016
    4
    @FlyingLion 现在小学生都这么牛了。 。。。。
    FlyingLion
    FlyingLion
    OP
    Feb 23, 2016
    5
    大家帮帮忙呗
    Lentin
    Lentin
    Feb 27, 2016
    6
    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
    bclerdx
    Mar 7, 2016
    7
    @Lentin 看着头晕 ing
    ikw
    ikw
    May 19, 2017
    8
    -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
    Lentin
    May 19, 2017
    9
    @zwpaper #8 谢谢更正,本来想更正一下后来忘了
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   2008 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 40ms · UTC 16:26 · PVG 00:26 · LAX 08:26 · JFK 11:26
    ♥ Do have faith in what you're doing.