2026年2月1日 星期日

練習題:實體連接埠分組。ether2 與 ether3 是一組,ether4 與 ether5 是另一組。

1.實體連接埠分組:

ether2 與 ether3 是一組:192.168.88.1~254

ether4 與 ether5 是另一組:1192.168.99.1~254

/interface bridge

# 建立橋接器 2_3,手動設定 MAC 位址並加入預設配置註解

add admin-mac=08:55:31:FF:20:2D auto-mac=no comment=defconf name=bridge2_3

# 建立橋接器 4_5

add name=bridge4_5


/interface bridge port

# 將 ether2 與 ether3 綁定到 bridge2_3 

add bridge=bridge2_3 comment=defconf interface=ether2

add bridge=bridge2_3 comment=defconf interface=ether3

# 將 ether4 與 ether5 綁定到 bridge4_5 

add bridge=bridge4_5 comment=defconf interface=ether4

add bridge=bridge4_5 comment=defconf interface=ether5

2. IP 地址與 DHCP 伺服器 (IP Addressing & DHCP)

定義兩個網路段:192.168.88.x 以及 192.168.99.x。

/ip pool

# 設定 88 段與 99 段的自動取得 IP 範圍 

add name=dhcp88 ranges=192.168.88.10-192.168.88.254

add name=dhcp99 ranges=192.168.99.10-192.168.99.254


/ip address

# 設定路由器在兩個區域網路中的 IP (Gateway) 

add address=192.168.88.1/24 comment="defconf 88" interface=bridge2_3 network=192.168.88.0

add address=192.168.99.1/24 comment="defconf 99" interface=bridge4_5 network=192.168.99.0

# 設定 WAN 端 (ether1) 的固定 IP 

add address=172.20.1.49/16 interface=ether1 network=172.20.0.0


/ip dhcp-server network

# 設定配發給電腦的資訊:包含網域、DNS 伺服器與通訊閘 

add address=192.168.88.0/24 comment=defconf:DHCP_Server88 dns-server=163.23.200.1,168.95.1.1 gateway=192.168.88.1

add address=192.168.99.0/24 dns-server=163.23.200.1,168.95.1.1 gateway=192.168.99.1

3. IPv4 防火牆規則 (Firewall Filter)

這部分是確保您的路由器不被外網隨意攻擊。

Input 鏈 (進入路由器的連線):

接受:已建立、相關或已追蹤的連線 。

丟棄:無效的連線(防止錯誤封包消耗資源)。

接受:ICMP (Ping),方便測試網路是否通暢 。

丟棄:所有不是來自 LAN 的連線(阻擋來自外網 WAN 的存取)。

Forward 鏈 (經過路由器轉發的連線):

FastTrack:開啟快速轉發模式,繞過 CPU 檢查以提升網速並降低負載 。

丟棄:來自外網 (WAN) 且沒有設定「連接埠轉送 (DSTNAT)」的新連線 。

4. NAT 與 網路共享

/ip firewall nat

# 啟用偽裝 (Masquerade):讓內網設備可以透過 WAN 介面上網 [cite: 4]

add action=masquerade chain=srcnat comment="來源位址轉送:執行 IP 偽裝以連通外網" ipsec-policy=out,none out-interface-list=WAN



沒有留言:

張貼留言

注意:只有此網誌的成員可以留言。