OpenWrt 是一个专门面向嵌入式设备的 Linux 发行版。你可以将 OpenWrt 支持的型号的嵌入式设备,比如各种路由器上的系统,换成一个有更多可能性可以折腾的 Linux 系统。
OpenWrt 官方网站
laiyilong
V2EX  ›  OpenWrt

如何在 openwrt 上实现特定时间在特定设备上屏蔽某些网站?

  •  1
     
  •   laiyilong · Jul 28, 2015 via Android · 1845 views
    This topic created in 3970 days ago, the information mentioned may be changed or developed.
    如题,平时老是忍不住打开手机刷刷微博什么的,这样强制自己提高效率,但设备必须要保留一个查Google的功能,所以选择这样的折中方案。
    10 replies    2015-07-28 23:05:38 +08:00
    wbsdty331
        1
    wbsdty331  
       Jul 28, 2015
    把某些域名搞到127.0.0.1 搞个定时
    LazyZhu
        2
    LazyZhu  
       Jul 28, 2015
    leavic
        3
    leavic  
       Jul 28, 2015
    科技不能解决所有问题
    Daniel65536
        4
    Daniel65536  
       Jul 28, 2015 via iPad
    crontab -e
    0 0 * * * echo "aaa.com 127.0.0.1" >> /etc/hosts
    0 9 * * * sed -e 's/aaa.com 127.0.0.1//g' /etc/hosts

    凭记忆大概写了下,自己且去调试去。
    qw7692336
        5
    qw7692336  
       Jul 28, 2015
    为什么要定时呢
    sorcerer
        6
    sorcerer  
       Jul 28, 2015 via iPhone
    靠这个来限制,不靠谱。
    LazyZhu
        7
    LazyZhu  
       Jul 28, 2015
    还没搞定?

    最简单的:
    1. 安装 iptables-mod-ipopt
    2. 在/etc/config/firewall 添加一段
    config rule
    option src lan
    option dest wan
    option src_ip 192.168.1.6
    option dest_ip weibo_ip
    option start_time 8:00
    option stop_time 17:00
    option weekdays 'mon tue wed thu fri'
    option target REJECT
    3. 重启
    fuge
        8
    fuge  
       Jul 28, 2015 via iPhone
    @Daniel65536 这个很棒 可以玩出很多花样
    laiyilong
        9
    laiyilong  
    OP
       Jul 28, 2015 via Android
    @LazyZhu 感觉如果直接屏蔽IP效果不够彻底啊。。。可以直接用域名吗?
    ForHerGlory
        10
    ForHerGlory  
       Jul 28, 2015
    google 也有google plus
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   3114 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 44ms · UTC 13:07 · PVG 21:07 · LAX 06:07 · JFK 09:07
    ♥ Do have faith in what you're doing.