2020年3月29日 星期日

在Synology NAS docker上架設adguardhome (像是pihole)來擋廣告(adblock)

已經有架設pi-hole
     在Synology NAS docker上架設pi-hole來擋廣告(adblock) with RouterOS設定

再參考架設pi-hole的時候, 又看到adguardhome
Ref :
https://www.jkg.tw/p2158/
https://www.jkg.tw/p2298/

就想說來換看看吧
安裝記錄如下
Ref : https://hub.docker.com/r/adguard/adguardhome#quickstart
圖文可以參考上面連結

假設NAS IP : 192.168.0.88

下面僅用文字記錄自己的安裝過程
1. DMS 套件中心 > 安裝docker套件
2. 開啟docker
3. docker > 倉庫伺服器  > 搜尋"adguardhome" > 下載 "adguard/adguardhome" 這個image
4. docker > 映像檔 > 選擇剛剛下載的pihole > 佈署 > 進階設定
    a. 進階設定 > 勾選 自動重啟
    b. 儲存空間 > 新增資料夾
        docker/adguardhome/work > 掛載路徑 /opt/adguardhome/work
        docker/adguardhome/conf > 掛載路徑 /opt/adguardhome/conf
    c. 網路 > 勾選 與docker host使用相同網路
    d. 設定完成, 點選套用, 並打勾設定完成後啟動
    f. docker > 容器, 看看剛剛設定的有沒有跑起來了
5. 在瀏覽器網址列輸入 http://192.168.0.88:3000就可以開始adguardhome的管理頁面
6. 一進去後, 先把管理介面的port由3000改為自己喜歡的部分

設定部分, 可以參考
https://www.jkg.tw/p2158/
https://www.jkg.tw/p2298/

大部分都採取預設即可, 下面列出一些我有修改的
a. 設定port,
   管理介面的port, 預設是3000, 自行決定要不要改
   DNS伺服器的port, 預設是53, 建議不要去動
b. 設定管理者帳號密碼
c. 設定 > DNS 設定 > 上游的 DNS 伺服器
   其實這邊我沒sense, 所以就參考別人的設定, 尾巴再補上hinet+google
   https://dns10.quad9.net/dns-query
   https://1.1.1.1/dns-query
   https://1.0.0.1/dns-query
   tls://101.101.101.101
   168.95.1.1
   8.8.8.8
   打勾 > 透過可同時查詢所有上游伺服器

f. 過濾器 > 封鎖清單
   把預設沒開的, 都打勾
   新增部分, 參考 https://www.jkg.tw/p2298/

   NeoHost-Basic:如果有在用中國網站的話(淘寶、騰訊、百度。。等等),推薦可以訂閱
   Web : https://github.com/neoFelhz/neohosts
   新增名稱 : NeoHost-Basic
   網址清單 : https://cdn.jsdelivr.net/gh/neoFelhz/neohosts@gh-pages/basic/hosts.txt

   CoinBlocker:可以擋掉一些拿你機器來挖礦的主機域名
   Web : https://gitlab.com/ZeroDot1/CoinBlockerLists
   新增名稱 : CoinBlocker
   網址清單 : https://zerodot1.gitlab.io/CoinBlockerLists/hosts

   StevenBlack:知名的擋廣告清單,PiHole 有內建
   Web : https://github.com/StevenBlack/hosts
   新增名稱 : StevenBlack
   網址清單 : https://raw.githubusercontent.com/StevenBlack/hosts/master/alternates/fakenews-gambling-porn-social/hosts

   CHEF-KOCH ADs:這個作者很厲害,之前在 GitHub 上面抓出超多矽谷公司的域名,並提供清單阻擋
   Web : https://gitlab.com/CHEF-KOCH/cks-filterlist
   新增名稱 : CHEF-KOCH ADs
   網址清單 : https://gitlab.com/CHEF-KOCH/cks-filterlist/raw/master/hosts/Ads-tracker.txt
 
   anti-AD v4 : anti-AD是目前中文区命中率最高的广告过滤列表
   Web : https://github.com/privacy-protection-tools/anti-AD
   新增名稱 : anti-AD v4
   網址清單 : https://raw.githubusercontent.com/privacy-protection-tools/anti-AD/master/anti-ad-easylist.txt

然後記得更新Router的DNS設定

更新 : 如果你是使用RouterOS的Router, 可以參考
    RouterOS設定DNS Server
    RouterOS內動態確認DNS Server是否正常, 並切換設定


可以參考上一篇的後半段
    在Synology NAS docker上架設pi-hole來擋廣告(adblock) with RouterOS設定

如果人在外面手機4G上網, 可以配合VPN連回來用

在Synology NAS docker上搭建bitwarden 密碼管理軟體


尋找Open source, self host的密碼管理軟體
而且要能跨平台
最後找到bitwarden https://bitwarden.com/
看官網幾乎所有平台都有支援
iOS上還可以整合到自動填寫密碼, 取代iCloud keychain
所以就想說自己裝起來, 試用看看


網路環境
NAS本機IP : 192.168.0.88

目標, 利用docker跑bitwarden server, port 8888

Ref :
https://www.jkg.tw/p1984/

請參考上面連結, 下面是文字記述
1. DMS 套件中心 > 安裝docker套件
2. 開啟docker
3. docker > 倉庫伺服器  > 搜尋"bitwarden" > 下載 "bitwardenrs/server" 這個image
4. docker > 映像檔 > 選擇剛剛下載的bitwardenrs/server > 佈署 > 進階設定
    a. 進階設定 > 勾選 自動重啟
    b. 儲存空間 > 新增資料夾
        /docker/bitwarden > 掛載路徑 /data
    c. 網路 > "不要選" "不要選" "不要選" 與docker host使用相同網路
d. 連接Port設定
    本機 3012 <> 容器 3012
本機 8888 <> 容器 80
    e. 設定完成, 點選套用, 並打勾設定完成後啟動
    f. docker > 容器, 看看剛剛設定的有沒有跑起來了
 5. 在瀏覽器網址列輸入 http://192.168.0.88:8888
    這時候我用chrome可以開啟頁面
開始註冊帳號的時候, 都填完了, 卻無法按下送出
<<-----------------------------

後來發現, 只要改用其他瀏覽器(不要用chrome)就可以正常登入了
所以請在區網內, 用手機的Safari, 直接打 http://192.168.0.88:8888就可以正常了
後面的動作, 關於SSL key可以全都不要做

因為, 就算後面這樣亂搞後, 電腦(Win7)上的 bitwarden client端軟體也會無法登入

與其花這麼多功, 而且很有可能是錯的
反正我原本就想說只用在內網環境, 手機VPN回來同步

所以就做到這邊即可

目前狀況, 都在內網
iOS, 可以login bitwarden web server
iOS, bitwarden app可以login
Windows, chrome bitwarden plugin, 可以login
Windows, bitwarden app, 可以login
Windows, chrome無法無法無法login bitwarden web

除了用瀏覽器直接敲ip連線web的作法外
其他(iOS app, Windows app, chrome plugin)   都要記得設定自我託管環境URL
   >>開啟App, 主畫面, 左上角有個齒輪
   >>選進去後, 設定自我託管環境URL
   >>http://192.168.0.88:8888

<<------------------------------
Google後, 才發現原來應該是
chrome在http下有些API不能用
   Chrome will not allow the use of crypto APIs without https
   https://github.com/bitwarden/server/issues/592

加上bitwarde, 一定要有https下, 才能正常工作
所以, 這時候還要設定SSL憑證, 不然無法用Chrome登入
Ref :
https://github.com/dani-garcia/bitwarden_rs/wiki/Enabling-HTTPS
https://github.com/dani-garcia/bitwarden_rs/wiki/Private-CA-and-self-signed-certs-that-work-with-Chrome
https://blog.miniasp.com/post/2019/02/25/Creating-Self-signed-Certificate-using-OpenSSL

由於我沒有domain, 加上也只打算在local端跑server
手機在外真的要sync的話, 就VPN回來再做sync
所以選擇用self-signed-certs

--- 下面開始都是亂搞, 小弟我對憑證這塊完全不懂, 所以就是囫圇吞棗 ---
--- 請自行尋找比較正規的做法 ---
--- 如果可以提供比較正確的做法給我參考, 那就更感謝了 ---
1. Create CA key
   openssl genpkey -algorithm RSA -aes128 -out private-ca.key -outform PEM -pkeyopt rsa_keygen_bits:2048

   Enter PEM pass phrase:
   這時候要輸入密碼, 請自己設定, 但是要記好, 後面會用到

   Enter PEM pass phrase:
   再輸入一次密碼

2. Create CA certificate:
   openssl req -x509 -new -nodes -sha256 -days 3650 -key private-ca.key -out self-signed-ca-cert.crt
 
   Enter pass phrase for private-ca.key:
   輸入上面的密碼
 
   後面會有一堆問題, 我看網路上大家是說都沒關係
   但是有一欄, 我有填一個local domain name, 192.168.0.88
   Common Name (e.g. server FQDN or YOUR name) []:192.168.0.88
 
   Country Name (2 letter code) [AU]:
   State or Province Name (full name) [Some-State]:
   Locality Name (eg, city) []:
   Organization Name (eg, company) [Internet Widgits Pty Ltd]:
   Organizational Unit Name (eg, section) []:
   Common Name (e.g. server FQDN or YOUR name) []:192.168.0.88
   Email Address []:

3. Create a bitwarden key:
   openssl genpkey -algorithm RSA -out bitwarden.key -outform PEM -pkeyopt rsa_keygen_bits:2048

4. Create the bitwarden certificate request file
   openssl req -new -key bitwarden.key -out bitwarden.csr
 
5. Create a text file bitwarden.ext
   建立一個文字檔-bitwarden.ext, 內容直接下面貼進去即可(DNS記得換一下)
   authorityKeyIdentifier=keyid,issuer
   basicConstraints=CA:FALSE
   keyUsage = digitalSignature, nonRepudiation, keyEncipherment, dataEncipherment
   extendedKeyUsage = serverAuth
   subjectAltName = @alt_names

   [alt_names]
   DNS.1 = 192.168.0.88
   DNS.2 = bitwarden.local

6. Create the bitwarden certificate, signed from the root CA:
   openssl x509 -req -in bitwarden.csr -CA self-signed-ca-cert.crt -CAkey private-ca.key -CAcreateserial -out bitwarden.crt -days 365 -sha256 -extfile bitwarden.ext

7. 把產生出來bitwarden.crt, bitwarden.key丟到NAS上的
   docker/bitwarden/ssl

8. 到NAS > docker > 容器 > bitwardenrs_srv > 編輯
   儲存空間, 新增docker/bitwarden/ssl 掛載路徑 /ssl
   環境設定, 新增ROCKET_TLS, 數值{certs="/ssl/bitwarden.crt",key="/ssl/bitwarden.key"}
 
9. 儲存, 啟動這個容器

10. chrome上輸入 https://192.168.0.88:8888
   會顯示不受信任, 往下捲會有一個"繼續前往"
   點下去就好了

11. 先在Chrome上註冊一個帳號吧

手機iOS端,

1. 去App Store搜尋bitwarde, 安裝
2. 開啟App, 主畫面, 左上角有個齒輪
   選進去後, 設定自我託管環境URL
   https://192.168.0.88:8888
3. 這時後登入會顯示錯誤, 需要安裝剛剛的CA certificate
4. 回到電腦端, 把剛剛產生的self-signed-ca-cert.crt用email寄給自己
5. 手機收信, 儲存附件self-signed-ca-cert.crt到iphone上
6. iphone > 檔案 > 找剛剛的self-signed-ca-cert.crt, 按一下
   會出現"已下載描述擋"
7. iphone > 設定 > 描述檔 > 192.168.0.88 > 安裝 > 安裝
8. iphone > 設定 > 一般 > 關於本機 > 憑證信任設定 > 192.168.0.88 > 啟用
9. iphone > App bitwarde, 應該就可以登入了
10.iphone > 設定 > 密碼與帳號 > 自動填寫密碼 > Bitwarden

剩下就開始試用看看好不好用了

2020年3月28日 星期六

如何阻擋來try VPN連線的IP with RouterOS (VPN IP banner)


看到Mobile01上的討論
需求 :
  拜請gfx神人,最近發現好像有人會來踹L2TP VPN,所以想問以下兩個問題。
  1.VPN登入的錯誤記錄,有辦法變成獨立的log檔查閱嗎?目前ROS的log檔內容實在太多啦。
  2.來踹的IP可以自動加到address list中嗎?例如列到BanIP的列表中。

神人回覆 : https://www.mobile01.com/topicdetail.php?f=110&t=3205444&p=682&p=682#72357712

結論 >> 先說結論 >> 如果連線, 15分鐘內沒有成功, 就會被block 14天

設定請參考原始作者的文章

這邊是自己消化後, 來理解為何要這樣設定
也不知道對不對, 反正先筆記下來

address list:
friends : 可信賴的list, 可直接接受
mobile : dynamic list, 通過認證的ip list
temp : dynamic list, 暫存區, 還未確認是否為正常的連線ip list
Scanners : dynamic list, 掃port的ip list, 直接drop掉

先參考RouterOS內部的packet flow
https://wiki.mikrotik.com/wiki/Manual:Packet_Flow
https://help.mikrotik.com/docs/display/ROS/Packet+Flow+in+RouterOS




如果是外部連到Router上的l2tp/ipsec VPN server
1. 流到(I), 然後進到[PREROUTING]
2. [PREROUTING]內, 先碰到<RAW PREROUTING>
   a. 接受src-address-list=friends
   b. drop掉src-address-list=Scanners

   /ip firewall raw
   add action=accept chain=prerouting comment=friends src-address-list=friends
   add action=drop chain=prerouting comment=Scanners src-address-list=Scanners
 
3. 進到[INPUT], 碰到<MANGLE INPUT>
   a. 接受所有LAN端來的連線
   b. 接受所有src-address-list=friends的連線
   c. 接受所有src-address-list=mobile的連線
   d. 如果新連線是udp port=1701,500,4500的時候, 而且ip不在temp list中, 先跳到(vpn-point)節點
   e. 在(vpn-point)節點上的連線, 如果src ip不在Scanners list內的話, 就把src ip加到temp list中, 設定16分鐘後timeout

   /ip firewall mangle
   add action=accept chain=input comment="Local area network" src-address=192.168.0.0/16
   add action=accept chain=input comment=friends src-address-list=friends
   add action=accept chain=input comment=mobile src-address-list=mobile
   add action=jump chain=input connection-state=new dst-port=1701,500,4500 \
      jump-target=vpn-point protocol=udp src-address-list=!temp
   add action=add-src-to-address-list address-list=temp address-list-timeout=16m chain=vpn-point \
      src-address-list=!Scanners

4. 從[INPUT]<MANGLE INPUT>, 再進到<FILTER INPUT>
   a. 接受所有src-address-list=friends的連線
   b. 接受所有src-address-list=mobile的連線
   c. drop掉從pppoe-out1進來, 非lan端的src address, 且src ip不在temp list內, conntection state為invalid,或是new
   /ip firewall filter
   add action=accept chain=input comment=friends src-address-list=friends
   add action=accept chain=input comment=mobile src-address-list=mobile
   add action=drop chain=input comment=Outlanders connection-state=invalid,new \
      in-interface=pppoe-out1 src-address-list=!temp src-address-type=!local

到這邊可以看到, 主要就是
    friend 是static list, 預設就都會被accept
temp 是dynamic list, 從udp 1701,500,4500來的新連線, 只要不在Scanner list內, 就都會被先加到temp list
temp 有timeout值
mobile 是dynamic list, 也是都會被accept
    Scanner list就是會直接被drop掉
但是, 現在只有看到src ip被加到temp的動作
完全沒看到src ip甚麼時候被加到mobile or Scanners

Mobile01上, 還有幾個步驟
------------------
/ppp profile
On Up:
:if ([/interface get $interface type]~"in") do={
  :do {/ip firewall address-list add list=mobile address=$"caller-id" timeout=1d} on-error={}
  :do {/ip firewall address-list remove [find list~"(temp|Scanners)" address=$"caller-id" dynamic]} on-error={}
}
在l2tp用的ppp profile內的On up event加上這段script
/interface 下, 在VPN連線上的時候會有多一組l2tp的interface, type是l2tp-in

[MikroTik] /interface> print
Flags: D - dynamic, X - disabled, R - running, S - slave
 #     NAME                                TYPE       ACTUAL-MTU L2MTU  MAX-L2MTU MAC-ADDRESS   
 7 DR  <l2tp-l2tp_user>                    l2tp-in          1450

所以這邊就是在On up的時候, 把/interface下, 有帶"in"得這組src ip加到mobile list, mobile list timeout 1天
然後把這組src ip從temp or Scanner移除
到這邊, 就有mobile list了

------------------
/system scheduler 新增: (scheduling, 1m)
:global vpn
:if ([:typeof $vpn]!="num") do={:set vpn 0}

:local total [/ip firewall mangle get [find chain=vpn-point action=add-src-to-address-list] byte]
:if ($vpn!=$total) do={:set vpn $total ; /system script run vpn-server}

新增一組script, 每一分鐘跑一次
去撈3.e標記的資料量, 如果跟上一次的資料量不相等, 就呼叫system script (如下)

-----------------
/system script 新增:
:global vpn
:local connected [/ip firewall address-list find list=temp dynamic]

:local scanners 0
:foreach i in=$connected do={
  :if ([/ip firewall address-list get $i timeout]<0:1:0) do={
    /ip firewall address-list add list=Scanners address=[get $i address] timeout=14d
    /ip firewall address-list remove $i ; :set scanners ($scanners+1)
  }
}
:if ([:len $connected]>$scanners) do={:set vpn ($vpn-1)}

把/ip firewall下的 所有的temp list都撈出來
如果temp list timeout值小於1分鐘, 就把此ip加到Scanners, 並把原本這temp list移除

-------------------------------
完整的動作會變成
1. 從外面來的udp port 1701,500,4500, ip A,嘗試連線
2. ip A會被先加到temp list (timeout 16分鐘)
3. 如果這次連線有成功, 觸發ppp On up script, ip A就會被移到mobile list(timeout 1天)
4. 下次連線, 如果還沒timeout, 就會被判出是mobile list, 被accept

如果是掃port的
1. 從外面來的udp port 1701,500,4500, ip B,嘗試連線
2. ip B會被先加到temp list (timeout 16分鐘)
3. 此次連線認證失敗, 不會觸發ppp On up script
4. scheduler script每一分鐘就會去看有多少資料量在3.e那個狀態, 如果跟上一次值不一樣就觸發system script
4. system script會去撈所有的temp list, 如果timeout value已經小於1分鐘, 就移到Scanner list(timeout 14天)

所以, 如果連線, 15分鐘內沒有成功, 就會被block 14天

RouterOS-架設VPN-l2tp/Ipsec, 用iOS連接

(更新, 有搭建IKEV2的範例, 可以參考 RouterOS-架設VPN-IKEV2, 用iOS連接

目的 : 建立l2tp/Ipsec VPN, 讓手機iOS可以連
Ref :
https://blog.ladsai.com/mikrotik-routeros-%E5%BB%BA%E7%BD%AE-l2tp-over-ipsec-vpn-server.html
https://omega.idv.tw/kdb120/viewthread.php?forumid=67&goto=lastpost
http://www.128px.com/2018/01/RouterOS-V641-2.html
Mikrotik : https://wiki.mikrotik.com/wiki/Manual:IP/IPsec#Basic_L2TP.2FIPsec_setup

目的 : 建立l2tp/Ipsec VPN, 讓手機iOS可以連

l2tp/Ipsec 須要三個資訊, 下面都是範例
l2tp帳號 : l2tp_user
l2tp密碼 : l2tp_pwd
Ipsec密鑰 : ipsec_pwd

網路環境基本資訊
社區網路
Pubilc IP : 111.222.333.444
Port : UDP-1701, 500, 4500已經有port forward到Router

Router上網設定(社區網路是固定ip, 這邊是網路公司提供)
Static IP : 192.168.99.20
Netmask : 255.255.255.0
Gateway : 192.168.99.254

內網Router設定
Router ip : 192.168.88.1
DHCP Server : 192.168.88.100-192.168.88.120
DNS : 168.95.1.1/8.8.8.8

1. 建立 VPN 網段
   Winbox > IP > Pool, 新增一組網段
   /ip pool
   add name=L2TP_VPN ranges=192.168.88.200-192.168.88.220

2. 建立給 L2TP 使用的 profile
   Winbox > PPP > Profiles, 新增profile
   name: L2TP_Profile
   local-address: 輸入你的 L2TP Server IP,也就是你的 RouterBoard IP。
   remote-address: 輸入你要分配給連入的 L2TP 連線的 IP,就是上面設定的網段L2TP_VPN

   /ppp profile
   add local-address=192.168.88.1 name=L2TP_Profile remote-address=L2TP_VPN use-encryption=required

   建立VPN Profile,use-encryption必須要是required或是Yes,否則有可能無法連線
   如果只是要存取內網的資源,DNS可以不必填,而如果是經過VPN上網或翻牆,DNS一定要填。

3. 建立 L2TP 連線用的帳號密碼
   Winbox > PPP > Secrets

   name : 帳號(l2tp_user)
   password : 密碼(l2tp_pwd)
   service : l2tp
   profile : 選上面建立出的L2TP_Profile
 
   /ppp secret
   add name=l2tp_user password=l2tp_pwd profile=L2TP_Profile service=l2tp

4. 啟動L2TP server,設定Ipsec共享金鑰。
   Winbox > PPP > Interface 有個L2TP Server

   default-profile : 選上面的L2TP_Profile
   ipsec-secret : ipsec密鑰(ipsec_pwd)

   /interface l2tp-server server
   set default-profile=L2TP_Profile enabled=yes ipsec-secret=ipsec_pwd use-ipsec=yes

5. 開啟對應的防火牆L2TP則是udp port 1701/500/4500。
   Winbox > IP > Firewall > Filter Rules
   新增一組filter rule, 接受由WAN(ether1_WAN)來的upd port 1701, 500, 4500 L2TP連線
   /ip firewall filter
   add action=accept chain=input comment="Accept L2TP VPN" dst-port=1701,500,4500 in-interface=ether1_WAN protocol=udp

6. 讓VPN連線後, 可以ping到內網的device
   須要對VPN連線進來ip做偽裝
   Winbox > IP > Firewall > Address Lists
   新增一組list, 192.168.88.200-192.168.88.220
   /ip firewall address-list
   add address=192.168.88.200-192.168.88.220 list=VPN

   Winbox > IP > Firewall > NAT
   新增一組NAT, srcnat, 由VPN ip來,但不是要到VPN ip的做偽裝
   /ip firewall nat
   add action=masquerade chain=srcnat comment="VPN NAT" dst-address-list=!VPN src-address-list=VPN

7. iOS設定
   設定 > 一般 > VPN > 加入VPN設定
   類型 : L2TP
   描述 : 自行取個名字, e.g. HomeVPN
   伺服器 : 社區網路的對外IP, 111.222.333.444
   帳號 : l2tp的帳號, l2tp_user
   密碼 : l2tp的密碼, l2tp_pwd
   密鑰 : ipsec密鑰, ipsec_pwd

在Synology NAS docker上架設pi-hole來擋廣告(adblock) with RouterOS設定

目前網頁上的廣告越來越多

為了不想看到這些廣告, 可以透過自行架設Pi-Hole來檔掉部分的廣告
Pi-Hole就是透過DNS的方式來檔掉已知的廣告網址
好處是, 他會自動更新black list

如何讓Pi-Hole為你擋廣告, 可以分為兩段,
1. 架設Pi-Hole
2. 設定原本Router裡面的DNS改由Pi-Hole處理

<<1. 架設Pi-Hole>>
這邊因為我已經有Synology NAS, 所以就透過NAS上的docker來跑Pi-Hole
參考網址 :
https://www.jkg.tw/p157/
https://medium.com/@moreless/install-pi-hole-docker-on-synology-to-remove-ads-84bc92d9078d
https://mariushosting.com/how-to-install-pi-hole-on-your-synology-nas/
圖文可以參考上面連結

下面僅用文字記錄自己的安裝過程
1. DMS 套件中心 > 安裝docker套件
2. 開啟docker
3. docker > 倉庫伺服器  > 搜尋"pihole" > 下載 "pihole/pihole" 這個image
4. docker > 映像檔 > 選擇剛剛下載的pihole > 佈署 > 進階設定
    a. 進階設定 > 勾選 自動重啟
    b. 儲存空間 > 新增資料夾
        /docker/pihole/config > 掛載路徑 /etc/pihole/
        /docker/pihole/dnsmasq.d > 掛載路徑 /etc/dnsmasq.d/
    c. 網路 > 勾選 與docker host使用相同網路
    d. 環境設定,
        新增 > WEB_PORT, value = pihole網頁service的port, 可以用80或是換成其他(e.g. 11111)
        新增 > WEBPASSWORD, value = 登入pihole網頁的密碼(e.g. 22222)
        新增 > TZ, value = Asia/Taipei, 設定時區, pihole會在半夜起來更新list
        修改 > ServerIP, value = NAS在區網上的ip, (e.g. 192.168.0.88)
    e. 設定完成, 點選套用, 並打勾設定完成後啟動
    f. docker > 容器, 看看剛剛設定的有沒有跑起來了
 5. 在瀏覽器網址列輸入 http://ServerIP:WEB_PORT/admin就可以開始pihole的管理頁面
      e.g. http://192.168.0.88:11111/admin
 6. 網頁上的左邊, 有LogIn, 點選後, 輸入WEBPASSWORD即可登入(e.g. 22222)
 7. Pi-Hole設定完成


<<2. 設定路由器, 讓DNS改為pihole>>, 以RouterOS為例
更新 : 如果你是使用RouterOS的Router, 可以參考下面兩篇就好了, 比較完善
    RouterOS設定DNS Server
    RouterOS內動態確認DNS Server是否正常, 並切換設定

1.  Winbox > IP > DNS
     DNS Server : 設為pihole的IP (e.g. 192.168.0.88)
             這邊我有設定第二組(Google DNS 8.8.8.8), 想法是說如果pihole掛了, 起碼這裡還出的去
2. Winbox > IP > DHCP Server > Networks
     DNS Server : 設為pihole的IP (e.g. 192.168.0.88)
     這樣可以讓DHCP client來拿ip的時候, 拿到這組DNS回去

這樣, 應該基本效果就可以了
但是後來看到有網路上提到, 如果client端自己寫死DNS, 那就會繞掉剛剛的設定
所以透過NAT, 強制轉到pihole

Ref : https://www.reddit.com/r/pihole/comments/5g249i/tip_redirect_all_dns_to_pihole_with_mikrotik/

做dstnat, 把tcp/udp port53, dst/src address非pihole, 都導向iphole
;;; redirect DNS to PiHole
chain=dstnat action=dst-nat to-addresses=192.168.0.88 protocol=udp src-address=!192.168.0.88 dst-address=!192.168.0.88 dst-port=53
chain=dstnat action=dst-nat to-addresses=192.168.0.88 protocol=tcp
src-address=!192.168.0.88 dst-address=!192.168.0.88 dst-port=53
Hairpin, 我是沒有對外ip, 所以就沒做了
All DNS queries to PiHole shall appear to come from the router
3 ;;; hairpin NAT for PiHole
chain=srcnat action=masquerade protocol=udp src-address=192.168.1.0/24 dst-address=192.168.1.2 dst-port=53 4 chain=srcnat action=masquerade protocol=tcp src-address=192.168.1.0/24
dst-address=192.168.1.2 dst-port=53

在Raspberry Pi 2B上跑Docker, AdguardHome, Bitwarden, RPi-Monitor

在Raspberry Pi 2B上跑Docker, AdguardHome, Bitwarden, RPi-Monitor 請先參考前置準備工作 安裝Raspberry Pi 2B 來跑docker 前置準備 安全性考量, 移除預設pi帳號 Ref :     h...