# 進階設定

進階設定

# 阻擋網頁功能

### 阻擋網頁功能

以往Pfsense防火牆要設定封鎖某網站，要使用SQUID PROXY過濾或是透過套件pfBlockerNG封鎖DNS來達成，現在可用相對簡單方式。

查出要封鎖網站的所有相關網址  
建議使用[https://www.netify.ai/](https://www.netify.ai/)  
例如 line

#### PRIMARY DOMAINS

- [gcld-line.com](https://www.netify.ai/resources/domains/gcld-line.com)
- [lin.ee](https://www.netify.ai/resources/domains/lin.ee)
- [line-apps-beta.com](https://www.netify.ai/resources/domains/line-apps-beta.com)
- [line-apps-rc.com](https://www.netify.ai/resources/domains/line-apps-rc.com)
- [line-apps.com](https://www.netify.ai/resources/domains/line-apps.com)
- [line-cdn.net](https://www.netify.ai/resources/domains/line-cdn.net)
- [line-scdn.net](https://www.netify.ai/resources/domains/line-scdn.net)
- [line.me](https://www.netify.ai/resources/domains/line.me)
- [line.naver.jp](https://www.netify.ai/resources/domains/line.naver.jp)
- [linecorp.com](https://www.netify.ai/resources/domains/linecorp.com)
- [linemyshop.com](https://www.netify.ai/resources/domains/linemyshop.com)
- [lineshoppingseller.com](https://www.netify.ai/resources/domains/lineshoppingseller.com)

在aliase裡面新增所有網址  
![](https://books.cpic.com.tw/uploads/images/gallery/2023-06/embedded-image-axzeyxww.png)

在規則封鎖  
![](https://books.cpic.com.tw/uploads/images/gallery/2023-06/embedded-image-vhbu9ibh.png)

# OPENVPN

新增PACKAGE OPENVPN

初次使用精靈

建立本機使用者

使用外部驗證

查詢登入紀錄

查詢登入紀錄

到 Status \\ System Logs \\ OpenVPN 處

使用FILTER功能,搜尋user登入紀錄

Message 輸入 `user 'username' authenticated`

[![image.png](https://books.cpic.com.tw/uploads/images/gallery/2023-06/scaled-1680-/PVSimage.png)](https://books.cpic.com.tw/uploads/images/gallery/2023-06/PVSimage.png)

# 阻擋網頁功能-2

### 阻擋網頁功能-2

方法1如果失敗嘗試用方法2，方法1可能阻擋網頁有多個對外IP，可能就會失效。

- \*\*重導向DNS到 防火牆本身
- 利用防火牆DNS做阻擋。
- 或利用 PFBLOCK套件阻擋。

### 重導向DNS到 防火牆本身

讓CLIENT端查詢DNS 只能用防火牆IP

參考[原廠說明](https://docs.netgate.com/pfsense/en/latest/recipes/dns-redirect.html)

到 Firewall \\ NAT \\ Port Forward 建立規則

[![image.png](https://books.cpic.com.tw/uploads/images/gallery/2023-06/scaled-1680-/Xsximage.png)](https://books.cpic.com.tw/uploads/images/gallery/2023-06/Xsximage.png)

### 利用防火牆DNS做阻擋

到 Services \\ DNS Resolver 最底下 Host Overrides 新增主機

IP ADDRESS 隨意輸入

[![image.png](https://books.cpic.com.tw/uploads/images/gallery/2023-06/scaled-1680-/rUaimage.png)](https://books.cpic.com.tw/uploads/images/gallery/2023-06/rUaimage.png)

# 百里助專案

## 客戶需求  


- ### 觀看連線資訊
- ### 利用防火牆做阻擋。
- ### 或利用防火牆限速。

### 解決方案

- ### 觀看連線資訊  
    使用套件 ntopng安裝:   
    1 到 System \\ Package Manager \\ Available Packages 搜尋 ntopng，點選安裝。  
      
    2 到 Diagnostics \\ ntopng Settings \\ ntopng Settings進行設定  
    
    
    #####  勾選 Enable ntopng , Keep Data/Settings   
     再設定 ntopng 網頁密碼，等下登入會用到。
    
    [![image.png](https://books.cpic.com.tw/uploads/images/gallery/2023-08/scaled-1680-/image.png)](https://books.cpic.com.tw/uploads/images/gallery/2023-08/image.png)
    
    #### 3 網頁登入 點選設定旁 Access ntopng
    
    [![image.png](https://books.cpic.com.tw/uploads/images/gallery/2023-08/scaled-1680-/M9simage.png)](https://books.cpic.com.tw/uploads/images/gallery/2023-08/M9simage.png)##### 畫面如下  
    輸入帳密 admin/剛剛設定的密碼
    
    ##### [![image.png](https://books.cpic.com.tw/uploads/images/gallery/2023-08/scaled-1680-/Fymimage.png)](https://books.cpic.com.tw/uploads/images/gallery/2023-08/Fymimage.png)  
    到 flow \\ live 看及時流量

[![image.png](https://books.cpic.com.tw/uploads/images/gallery/2023-08/scaled-1680-/3aeimage.png)](https://books.cpic.com.tw/uploads/images/gallery/2023-08/3aeimage.png)

##### 篩選區網IP Local Only，選出高流量IP 點入可以看CLIENT細項。

[![image.png](https://books.cpic.com.tw/uploads/images/gallery/2023-08/scaled-1680-/zoeimage.png)](https://books.cpic.com.tw/uploads/images/gallery/2023-08/zoeimage.png)

[![image.png](https://books.cpic.com.tw/uploads/images/gallery/2023-08/scaled-1680-/HmXimage.png)](https://books.cpic.com.tw/uploads/images/gallery/2023-08/HmXimage.png)

- ### 利用防火牆做阻擋。  
    
    
    
    1. ##### 到 Firewall \\ Aliases \\ IP 新增群組  
        分別新增 black flowcontrol

# WIREGUARD Site to Site

WIREGUARD Site to Site

參考

[https://docs.netgate.com/pfsense/en/latest/recipes/wireguard-s2s.html](https://docs.netgate.com/pfsense/en/latest/recipes/wireguard-s2s.html)