thảo luận Cộng đồng người dùng MikroTik Router

em thêm cái pppoe bỏ ether1 là ok đúng không bác
Cứ để ether1 trong đó bác. Một là để nó áp dụng cái rule drop ngăn forward từ phía ngoài cổng ether1 vào trong LAN của bác. Hai là giả sử bác muốn vào trang web/ssh quản lý của cái converter/SFP GPON/modem nhà mạng đã bridge bằng địa chỉ IP của các thiết bị đó thì router sẽ tự động áp dụng NAT luôn (cái này là cần thiết vì các thiết bị đó giống như nằm ở WAN, ngoài LAN của bác, khác với Internet là không đi qua pppoe-out1 mà thôi).
 
Cứ để ether1 trong đó bác. Một là để nó áp dụng cái rule drop ngăn forward từ phía ngoài cổng ether1 vào trong LAN của bác. Hai là giả sử bác muốn vào trang web/ssh quản lý của cái converter/SFP GPON/modem nhà mạng đã bridge bằng địa chỉ IP của các thiết bị đó thì router sẽ tự động áp dụng NAT luôn (cái này là cần thiết vì các thiết bị đó giống như nằm ở WAN, ngoài LAN của bác, khác với Internet là không đi qua pppoe-out1 mà thôi).
vâng bác, em cảm ơn ạ
 
CGGX_ANNX em đang gặp thêm 1 vấn đề là khi bất rule này lên thì port forward rất mất ổn định,
Code:
add action=drop chain=input comment="defconf: drop all not coming from LAN" \
    in-interface-list="List All Vlan"
Em đang sử dụng reverse proxy của con nas xpen và mở cổng 80 với 443, nhưng khi bật rule này thì khi truy cập từ mạng ngoài vào qua tên miền phải chờ rất lâu mới kết nối được và rất hay bị mất kết nối. Khi tắt đi rule đi thì đăng nhập lại ổn định như bình thường. Thêm cái nữa là khi bật rule này thì xài app mikrotik trên iphone không kết nối với router qua tên miền được, tắt đi thì lại kết nối bình thường trong khi kết nối trên web cũng bằng tên miền đó thì lại báo kết nối được.
 
CGGX_ANNX em đang gặp thêm 1 vấn đề là khi bất rule này lên thì port forward rất mất ổn định,
Code:
add action=drop chain=input comment="defconf: drop all not coming from LAN" \
    in-interface-list="List All Vlan"
Em đang sử dụng reverse proxy của con nas xpen và mở cổng 80 với 443, nhưng khi bật rule này thì khi truy cập từ mạng ngoài vào qua tên miền phải chờ rất lâu mới kết nối được và rất hay bị mất kết nối. Khi tắt đi rule đi thì đăng nhập lại ổn định như bình thường. Thêm cái nữa là khi bật rule này thì xài app mikrotik trên iphone không kết nối với router qua tên miền được, tắt đi thì lại kết nối bình thường trong khi kết nối trên web cũng bằng tên miền đó thì lại báo kết nối được.
lẽ ra phải là in-interface-list=! "List All Vlan" chứ bác?
 
Về lý thuyết là chỉ cần thêm các ngoại lệ kiểu như cái rule bên bảng filter kia

Code:
/ip firewall filter
add action=accept chain=forward comment="allow access to pihole" \
    dst-address=192.168.10.10 in-interface-list=Lan

Đặt lên trên 2 cái rules drop của chain forward đó bác (nếu có vài cái địa chỉ đích thì cho vào address list rồi sửa cái kia thành dst-address-list). Có điều không rõ vì sao bên bác nó không chạy. Nên em mới hỏi xem liệu bảng routing rules với bridge filter có gì không. Tiện thể bác check cả bảng RAW của cái Firewall nữa.

Với tiện thể sẵn rồi thì bác export luôn cấu hình VLAN xem thế nào:

Code:
/interface bridge port export
/interface bridge vlan export
/interface vlan export

Con router của bác là loại gì ý nhỉ?
em xài ảo hoả trên proxmox bác
gửi bác cấu hình
Code:
/interface bridge port
add bridge=bridgevlan frame-types=admit-only-vlan-tagged interface=ether2 internal-path-cost=10 path-cost=10
/interface bridge vlan
add bridge=bridgevlan tagged=bridgevlan,ether2 vlan-ids=5
add bridge=bridgevlan tagged=bridgevlan,ether2 vlan-ids=10
add bridge=bridgevlan tagged=bridgevlan,ether2 vlan-ids=20
add bridge=bridgevlan tagged=bridgevlan,ether2 vlan-ids=30
add bridge=bridgevlan tagged=bridgevlan,ether2 vlan-ids=40
/interface vlan
add interface=bridgevlan name=vlancam vlan-id=20
add arp=reply-only interface=bridgevlan name=vlanguest vlan-id=40
add interface=bridgevlan name=vlanhome vlan-id=10
add interface=bridgevlan name=vlaniot vlan-id=30
add interface=bridgevlan name=vlanmg vlan-id=5
còn 2 cái này thì hiện tại không có rule nào cả bác
/interface bridge filter export
/routing rule export
 

CGGX_ANNX

em mới thử tắt hết các rule trong firewall thì thấy mặc định vlan 1 ping được tới mấy vlan kia luôn rồi, còn mấy vlan kia thì ping ngược không được. Em cũng không biết tại sao luôn @@
 
CGGX_ANNX em đang gặp thêm 1 vấn đề là khi bất rule này lên thì port forward rất mất ổn định,
Code:
add action=drop chain=input comment="defconf: drop all not coming from LAN" \
    in-interface-list="List All Vlan"
Em đang sử dụng reverse proxy của con nas xpen và mở cổng 80 với 443, nhưng khi bật rule này thì khi truy cập từ mạng ngoài vào qua tên miền phải chờ rất lâu mới kết nối được và rất hay bị mất kết nối. Khi tắt đi rule đi thì đăng nhập lại ổn định như bình thường. Thêm cái nữa là khi bật rule này thì xài app mikrotik trên iphone không kết nối với router qua tên miền được, tắt đi thì lại kết nối bình thường trong khi kết nối trên web cũng bằng tên miền đó thì lại báo kết nối được.

Đúng ra mà nói thì rule này không ảnh hưởng đến port forwarding bác ạ. Bác nghiên cứu các diagram ở trang này


Cụ thể là sơ đồ Routing

1711135304914.png


Và bảng các chains của tường lửa:

1711135363273.png


Em dựa theo nội dung các rules tường lửa hiện thời của bác từ post trước:

Code:
/ip firewall filter
add action=accept chain=input comment="defconf: accept established,related,untracked" connection-state=established,related,untracked
add action=drop chain=input comment="defconf: drop invalid" connection-state=invalid
add action=accept chain=input comment="defconf: accept ICMP" protocol=icmp
add action=drop chain=input comment="defconf: drop all not coming from LAN" in-interface-list=!Lan
add action=fasttrack-connection chain=forward comment="defconf: fasttrack" connection-state=established,related disabled=yes hw-offload=yes
add action=accept chain=forward comment="defconf: accept established,related, untracked" connection-state=established,related,untracked
add action=drop chain=forward comment="defconf: drop invalid" connection-state=invalid
add action=accept chain=forward comment="allow access to pihole" dst-address=192.168.10.10 in-interface-list=Lan
add action=drop chain=forward comment="block vlan to lan" in-interface-list=Lan-Ex-Home out-interface-list=Lan
add action=drop chain=forward comment="defconf: drop all from WAN not DSTNATed" connection-nat-state=!dstnat connection-state=new in-interface-list=Wan
/ip firewall mangle
add action=accept chain=prerouting comment="-----Mark Hijack DNS Tcp-----" dst-port=53 protocol=tcp
add action=accept chain=prerouting comment="-----Mark Hijack DNS Udp-----" dst-port=53 protocol=udp
add action=accept chain=prerouting comment="-----Hairpin Nat Mangle-----" dst-address-list="Wan IP" src-address=192.168.10.100-192.168.10.150
add action=accept chain=prerouting comment="-----VlanHome Access Recorder Dahua-----" disabled=yes dst-address=192.168.2.200 src-address=192.168.10.0/24
add action=mark-routing chain=prerouting comment="-----IP qua Wg hp225-----" dst-address-list="!ip from vlan" new-routing-mark=To-Wg-Hp225 passthrough=no src-address-list="ip to vpn hp225"
add action=change-mss chain=forward comment="-----Thay doi MSS-----" new-mss=clamp-to-pmtu out-interface=wghp225 passthrough=yes protocol=tcp tcp-flags=syn
/ip firewall nat
add action=masquerade chain=srcnat comment="-----Quay PPOE-----" out-interface=pppoe-out1
add action=masquerade chain=srcnat comment="-----Hairpin Nat------" dst-address=192.168.10.0/24 src-address=192.168.10.0/24
add action=masquerade chain=srcnat comment="-----Nat Wireguard Hp225-----" out-interface=wghp225
add action=dst-nat chain=dstnat comment="-----Nat Port 80 DS918-----" dst-address-list="Wan IP" dst-port=80 protocol=tcp to-addresses=192.168.10.8 to-ports=80
add action=dst-nat chain=dstnat comment="-----Nat Port 443 DS918-----" dst-address-list="Wan IP" dst-port=443 protocol=tcp to-addresses=192.168.10.8 to-ports=443
add action=dst-nat chain=dstnat comment="-----Nat Port 6690 DS1621-----" dst-address-list="Wan IP" dst-port=6690 protocol=tcp to-addresses=192.168.10.5 to-ports=6690
add action=dst-nat chain=dstnat comment="-----Hijack DNS-----" dst-port=53 in-interface-list=Lan protocol=udp src-address=!192.168.10.10 to-addresses=192.168.10.10
add action=dst-nat chain=dstnat comment="-----Hijack DNS-----" dst-port=53 in-interface-list=Lan protocol=tcp src-address=!192.168.10.10 to-addresses=192.168.10.10
Khi ở ngoài mạng bác dùng domain name truy cập vào cổng 80, 443, hay 6690 với IP public của router thì đầu tiên packet nó chui vào mục (I) của sơ đồ routing, mục Prerouting. Ứng với nó là chain PREROUTING ở cái hình bên dưới. Nếu có rule trong bảng RAW của tường lửa thì cái box RAW PREROUTING kia xử lý packet qua các rule đó, sau đó packet đi qua connection tracking, rồi tiếp theo đến bảng Mangle. Cái box MANGLE PREROUTING sẽ là lúc các rules ở bảng Mangle có chain=prerouting được xử lý. Theo nội dung bảng Mangle bác post trước đó thì sẽ không dính phải rule nào cả, vì không match cổng 53 với 2 rules đầu và source address với các rules còn lại.

Sau box MANGLE PREROUTING là box DST-NAT. Lúc này các rules ở bảng NAT, chain dstnat sẽ được xem xét và cho chạy qua. Ở đây vì lý thuyết là các packets này sẽ match với trong 3 cái rules action=dst-nat vì chúng có cổng đích thuộc 80/443/6690 TCP và địa chỉ đích của packet là địa chỉ public của router, trùng với list "Wan IP" (TUY NHIÊN, hiện nay ở chỗ này có một vấn đề mà em sẽ đề cập ở post sau!). Như vậy là action=dst-nat được áp dụng với packet và địa chỉ đích của packet bị thay, không còn phải là địa chỉ public của router nữa, mà là một trong hai địa chỉ 192.168.10.8 hoặc 192.168.10.5 tùy cổng.

Tiếp theo, theo hình routing thì sẽ đến mục Routing Decision. Vì địa chỉ đích của packet lúc này là địa chỉ của thiết bị trong LAN, không phải địa chỉ nào của router nữa, và địa chỉ nguồn của packet là từ ngoài internet, nên Routing Decision sẽ đi theo mũi tên bên trái, cho qua hộp Forward! Nó chính là mục này Packet Flow in RouterOS - RouterOS - MikroTik Documentation (https://help.mikrotik.com/docs/display/ROS/Packet+Flow+in+RouterOS#PacketFlowinRouterOS-Forward) của trang kia, và hai sơ đồ sau được áp dụng:

1711136204527.png


1711136248900.png


Như bác có thể thấy là chain INPUT của tường lửa không được sử dụng ở đây, tức là cái rule action=drop chain=input của bảng filter bác post ở trên không áp dụng cho các packet này. Chain FORWARD của tường lửa sẽ được áp dụng và đi theo mũi tên ở mục số (3) kia. Chỗ MANGLE FORWARD thì hiện chỉ có 1 cái rule có comment "-----Thay doi MSS-----" trong bảng mangle của bác là có chain=forward cần được xem xét. Tuy nhiên out-interface không phải wghp225 mà là VlanHome nên rule này được bỏ qua.

Sau MANGLE FORWARD là đến FILTER FORWARD, đây là chỗ các rules ở bảng filter, chain forward được xét đến. Khi đây là packet đầu tiên của kết nối, tức là khi connection-state=new thì nó sẽ lần lượt chạy từ trên xuống dưới và không match với rule chain=forward nào ở bảng filter được cả. Có cái rule drop cuối

Code:
add action=drop chain=forward \
    comment="defconf: drop all from WAN not DSTNATed" \
    connection-nat-state=!dstnat connection-state=new in-interface-list=Wan

Dù có connection-state=newin-interface-list đúng là từ ngoài nên match list Wan, tuy nhiên vì trước đó đã đi qua hộp DST-NAT và được rule action=dstnat match, nên kết nối này đã có connection-nat-state=dstnat, thế nên rule drop này không áp dụng được vì nó yêu cầu connection-nat-state=!dstnat

Vì không match được rules nào nên packet này được accept cho qua. Các packet tiếp theo của kết nối có connection-state=established nên sẽ được rules tít bên trên của chain forward chấp thuận ngay. Tóm lại các packets không bị block.

Ở hình Routing, sau FORWARD là đến hộp POSTROUTING, mục số (4) ở bảng tường lửa. Ở đây bảng mangle của bác không có rule nào có action=postrouting nên packet đi qua mà không bị xử lý. Packet sau đó đi qua hộp SRC-NAT. Ở bảng NAT của bác có 3 rules masquerade thuộc chain srcnat, tuy nhiên cả 3 rules đều không áp dụng với packet port forwarding này vì hoặc là out-interface không khớp, hoặc là source address không khớp (rule thứ 2 Hairpin NAT).

Sau đó hết phần của tường lửa, sau khi đi qua phần xử lý queues, vì không phải IPSec (VPN), packet sẽ được route qua interface VlanHome đến thiết bị nhận port forwarding.

Tóm lại khi port forwarding nếu mọi rules ok thì packet sẽ không bao giờ chạm tới các rules của chain Input.



Khi nào cái rule kia ở chain INPUT bảng Filter nó áp dụng? Chính là khi bác dùng App MikroTik trên điện thoại dùng mạng bên ngoài nối vào router bằng domain name.

Khi đó app MikroTik từ ngoài internet sẽ thử mở kết nối đến địa chỉ IP public của router với cổng TCP 8291 (App này dùng đúng cổng và giao thức của WinBox).

Tương tự như trên packet với địa chỉ đích là IP của router và dst-port là 8291 sẽ từ điểm (I) vào box PREROUTING Packet Flow in RouterOS - RouterOS - MikroTik Documentation (https://help.mikrotik.com/docs/display/ROS/Packet+Flow+in+RouterOS#PacketFlowinRouterOS-Input)

1711137964523.png


Cũng đi qua Mangle Prerouting và không match được với rules nào nên không bị thay đổi, sau đó cũng đi qua DSTNAT. Tuy nhiên lần này không có rules nào ở chain dstnat bảng NAT áp dụng được cả, vì cổng TCP 8291 không có rules port forwarding nào hết. Sau khi đi hết chain PREROUTING thì dst-address của packet vẫn là địa chỉ IP public của Router. Tức là đích đến của packet chính là router. Do đó mục ROUTING DECISION số (2) ở hình kia sẽ quyết định chuyển packet sang bên phải sang chain INPUT chứ không phải FORWARD như trước.

1711138210540.png


Chain Input của firewall xử lý packet. Ở bảng Mangle không có rule nào với chain input nên packet chuyển tiếp sang bảng Filter, mục (3B), ở đây ta có một số rules liền.

Vì đây là packet đầu tiên của kết nối nên connection-state=new, rule đầu (established,related,untracked) và rule 2 (invalid) sẽ bị skipped. Tiếp theo, vì không phải protocol = ICMP mà là TCP nên rule thứ 3 cũng không áp dụng. Đến rule thứ tư

Code:
add action=drop chain=input comment="defconf: drop all not coming from LAN" in-interface-list=!Lan

lúc này in-interface là pppoe-out1 vì từ ngoài internet vào, thế nên match được với điều kiện in-interface-list=!Lan như vậy action=drop được áp dụng, packet được vứt bỏ.

Đây chính là lý do vì sao bác thử dùng app MikroTik trên điện thoại nối từ ngoài vào mà không được. NHƯNG ĐÂY LÀ KẾT QUẢ MÀ BÁC MUỐN VÀ CẦN! Một trong những mục đích của cấu hình tường lửa này là bảo vệ router, bác sẽ không muốn từ bên ngoài internet thử kết nối vào cổng WinBox của router để rồi mà thử bruteforce password này nọ (như nhiều bác trong này đã phàn nàn vì thấy trong log toàn các attempts thử brute force login vào cổng WinBox). Cái cổng 8291 này chắc chắn bác không nên để bên ngoài kết nối vào được. Và ở đây tường lửa đã làm tốt nhiệu vụ của mình. Đó là chỉ chấp nhận cho các kết nối port forwarding được đi vào.

Vậy bác cần làm gì nếu muốn từ ngoài nối vào quản lý router bằng App? Điều bác nên làm là thiết lập VPN, thí dụ WireGuard, khi này bác sẽ cần mở đúng 1 cổng UDP cho cái WireGuard ở chain Input. Vì WireGuard bảo mật tốt hơn và dùng keys chứ không phải password nên không thể brute force được như username và password. Bên ngoài bác sẽ kết nối qua WireGuard vào router và sau đó mới dùng App qua kết nối VPN đó.
 
Last edited:
@bukkahero Ở post vừa rồi thì em và bác đã thấy là hiện cấu hình tường lửa trên, với các kết nối mới từ ngoài internet vào địa chỉ IP public của router, mà không phải packet ICMP, thì hiện có 2 khả năng là cổng khớp với cổng của rules dstnat và packet được dst-nat sang đích là LAN, rồi cho qua chain forward; hoặc không khớp với rules dstnat và giữ đích đến là router, chuyển qua chain input, và hiện bị drop sạch vì không mở cổng nào tiếp nhận ở chain input.

Vấn đề là ở chỗ mấy cái rules dstnat này. Bình thường, khi router có địa chỉ IP public động, không thể hard-coded vào trong dst-address= của rules dstnat của port forwarding được, thì có cách đơn giản là bỏ điều kiện dst-address="địa chỉ public" đi và dùng in-interface/hoặc in-interface-list và match nó với interface hoặc interface list chứa các interface phía WAN, thí dụ in-interface=pppoe-out1 hoặc in-interface-list=Wan.

Tuy nhiên khi muốn ở trong LAN cũng dùng địa chỉ public của router để vào các dịch vụ đã được port forwarded này (cái trường hợp cần Hairpin NAT ý) thì áp dụng điều kiện in-interface/in-interface-list không được, vì từ LAN thì in-interface là interface trong LAN, không thuộc list Wan. Vì thế phải quay sang dùng điều kiện dst-address. Nhưng địa chỉ động và ta không muốn phải edit rules mỗi khi địa chỉ thay đổi nên mới phải dùng trick với dst-address-list.

Và ở đây có thể có một vấn đề với cái address list "Wan IP" trong 3 cái rules kia nếu như bác lỡ làm theo em mấy ngày vừa rồi.

Mấy hôm trước em bảo bác để có được list chứa địa chỉ IP public của router đơn giản nhất thì bác chỉ việc tạo 1 entry trong bảng address list với giá trị address là cái domain DDNS của bác, khi đó nó sẽ tự đông resolve domain và tạo 1 entry dynamic có cùng tên chứa địa chỉ đã được resolved ra và có thể sử dụng dược trong rules dstnat này ngay. Điều này đúng cho đến ngày hôm qua.

Hôm qua thì em có khuyên bác là để workaround vấn đề chưa tìm hiểu được là các thiết bị ở Lan-Ex-Home không dùng được DNS server là con pihole bên VlanHome, thì bác nên chuyển sang cho con Router làm DNS relay, bằng cách để địa chỉ của con pihole vào mục "Servers" trong cấu hình DNS của RouterOS, và lái các thiết bị ở các mạng sử dụng địa chỉ của router làm địa chỉ DNS. Tuy nhiên điều này cũng có nghĩa là khi router thử resolve cái domain DDNS kia để tìm ra địa chỉ IP cho cái address list "Wan IP", thì router sẽ quay sang hỏi con pihole (vì pihole nằm trong danh sách upstream DNS servers của router).

Vấn đề là con pihole của bác đang cấu hình để trả về địa chỉ local trong LAN cho cái domain kia! Tức là nếu bác follow cả 2 hướng dẫn này thì hiện nay cái address list "Wan IP" kia không có địa chỉ public của router, mà là địa chỉ LAN của cái NAS 192.168.10.10 thì phải. Điều đó có nghĩa là các rules DSTNAT kia không match với các kết nối từ ngoài internet vào các cổng port forwarding. Và khi không match với rules DSTNAT thì packet không bị sửa địa chỉ destination và vẫn giữ địa chỉ là public IP của router, và như ở trên bác đã đọc, điều đó có nghĩa là bị mang ra chain input xử lý và sẽ bị drop bởi rule ở bảng filter!

Thế nên giờ phải làm cách khác để gán giá trị cho list "Wan IP" ạ, không dùng cách để router resolve domain name nữa mà dùng script. Bác vào System - Scripts thêm script này, đặt tên là "update_pppoe_address" chẳng hạn, với nội dung:

Code:
:local interfaceName "pppoe-out1";
:local addressListName "Wan IP";
:local comment "WAN IP"

:local wanIP [/ip address get [find interface=$interfaceName] address];

:if ([:len [/ip firewall address-list find list=$addressListName dynamic=no]] = 0) do={
    /ip firewall address-list add list=$addressListName address=$wanIP comment=$comment;
} else={
    /ip firewall address-list remove [find list=$addressListName dynamic=yes];
    /ip firewall address-list set [find list=$addressListName dynamic=no] address=$wanIP comment=$comment;
}

Bác lưu nó rồi ấn Run Script cho nó chạy 1 lần. Kiểm trang trong bảng Address List của Firewall xem nó đã update đúng chưa.

Bây giờ phải cấu hình để script chạy mỗi khi kết nối PPPoE được quay lại thành công, vì lúc đó thường sẽ có địa chỉ public mới. Bác vào chỗ kết nối PPPoE, kiểm tra xem nó đang dùng profile gì

1711142103445.png


Bác vào bảng PPP - Profiles, chọn profile với tên tương ứng

1711142171341.png


và thêm script chạy lúc On Up, để gọi cái script kia:

Code:
/system script run "update_pppoe_address"

Hi vọng đấy là nguyên nhân vấn đề bác gặp phải khi truy cập từ ngoài internet vào mấy cái bác đã port forward kia, mà phải tắt filter chain input mới chạy. Còn việc dùng app MikroTik từ ngoài không vào được là đúng bác nhé, cái này khắc phục bằng cách thiết lập VPN kiểu WireGuard rồi vào qua đó mà thôi.
 
Last edited:
em xài ảo hoả trên proxmox bác
gửi bác cấu hình
Code:
/interface bridge port
add bridge=bridgevlan frame-types=admit-only-vlan-tagged interface=ether2 internal-path-cost=10 path-cost=10
/interface bridge vlan
add bridge=bridgevlan tagged=bridgevlan,ether2 vlan-ids=5
add bridge=bridgevlan tagged=bridgevlan,ether2 vlan-ids=10
add bridge=bridgevlan tagged=bridgevlan,ether2 vlan-ids=20
add bridge=bridgevlan tagged=bridgevlan,ether2 vlan-ids=30
add bridge=bridgevlan tagged=bridgevlan,ether2 vlan-ids=40
/interface vlan
add interface=bridgevlan name=vlancam vlan-id=20
add arp=reply-only interface=bridgevlan name=vlanguest vlan-id=40
add interface=bridgevlan name=vlanhome vlan-id=10
add interface=bridgevlan name=vlaniot vlan-id=30
add interface=bridgevlan name=vlanmg vlan-id=5
còn 2 cái này thì hiện tại không có rule nào cả bác
/interface bridge filter export
/routing rule export

Cấu hình VLAN của bác hiện em không thấy có vấn đề gì cả. Với việc bác dùng Proxmox với 1 cổng Trunk cho các VLAN cũng không làm sao hết và được hỗ trợ bình thường. Ngoài ra theo config này thì không có gì làm vlanhome khác biệt vlaniot cả nên không thể giải thích việc vlanhome được đặc cách ngay cả khi bác tắt sạch filter cả (bật filter thì có cái rule drop từ Vlan-Ex-Home sang Lan).

Còn bên bảng RAW của Firewall có rule nào không hả bác?
 
Cấu hình VLAN của bác hiện em không thấy có vấn đề gì cả. Với việc bác dùng Proxmox với 1 cổng Trunk cho các VLAN cũng không làm sao hết và được hỗ trợ bình thường. Ngoài ra theo config này thì không có gì làm vlanhome khác biệt vlaniot cả nên không thể giải thích việc vlanhome được đặc cách ngay cả khi bác tắt sạch filter cả (bật filter thì có cái rule drop từ Vlan-Ex-Home sang Lan).

Còn bên bảng RAW của Firewall có rule nào không hả bác?
Nay anh làm việc sớm thế ạ?:big_smile:
 
Cấu hình VLAN của bác hiện em không thấy có vấn đề gì cả. Với việc bác dùng Proxmox với 1 cổng Trunk cho các VLAN cũng không làm sao hết và được hỗ trợ bình thường. Ngoài ra theo config này thì không có gì làm vlanhome khác biệt vlaniot cả nên không thể giải thích việc vlanhome được đặc cách ngay cả khi bác tắt sạch filter cả (bật filter thì có cái rule drop từ Vlan-Ex-Home sang Lan).

Còn bên bảng RAW của Firewall có rule nào không hả bác?
không bác ơi, để em port full bảng cấu hình cho bác xem thử xem sao

via theNEXTvoz for iPhone
 
CGGX_ANNX em gửi bác full cấu hình bác xem dùm nhé
Code:
/interface bridge
add add-dhcp-option82=yes dhcp-snooping=yes igmp-snooping=yes ingress-filtering=no name=bridgevlan port-cost-mode=short vlan-filtering=yes
/interface ethernet
set [ find default-name=ether1 ] disable-running-check=no
set [ find default-name=ether2 ] disable-running-check=no
/interface wireguard
add listen-port=51820 mtu=1420 name=wghp225
/interface vlan
add interface=bridgevlan name=vlancam vlan-id=20
add arp=reply-only interface=bridgevlan name=vlanguest vlan-id=40
add interface=bridgevlan name=vlanhome vlan-id=10
add interface=bridgevlan name=vlaniot vlan-id=30
add interface=bridgevlan name=vlanmg vlan-id=5
/interface pppoe-client
add add-default-route=yes disabled=no interface=ether1 name=pppoe-out1 user=xxxxxxx
/interface list
add comment=defconf name=Wan
add comment=defconf name=Lan
add comment=defconf name=Lan-Ex-Home
/interface wireless security-profiles
set [ find default=yes ] supplicant-identity=MikroTik
/ip pool
add name=dhcp_pool0 ranges=192.168.50.2-192.168.50.254
add name=dhcp_pool1 ranges=192.168.5.20-192.168.5.50
add name=dhcp_pool2 ranges=192.168.10.100-192.168.10.150
add name=dhcp_pool3 ranges=192.168.2.4-192.168.2.200
add name=dhcp_pool4 ranges=192.168.30.20-192.168.30.50
add name=dhcp_pool5 ranges=192.168.40.100-192.168.40.150
/ip dhcp-server
add address-pool=dhcp_pool1 interface=vlanmg lease-time=2h name=dhcp2
add address-pool=dhcp_pool2 interface=vlanhome lease-time=2h name=dhcp3
add address-pool=dhcp_pool3 interface=vlancam lease-time=2h name=dhcp4
add address-pool=dhcp_pool4 interface=vlaniot lease-time=2h name=dhcp5
add add-arp=yes address-pool=dhcp_pool5 interface=vlanguest lease-time=2h name=dhcp6
/queue type
add kind=fq-codel name=Fqcodel
/queue simple
add comment="Queue Fqcodel Wan" max-limit=450M/450M name="Qos Wan" queue=Fqcodel/Fqcodel target=pppoe-out1 total-queue=Fqcodel
add comment="Bandwith Limit" max-limit=30M/30M name="Bandwith Limit VlanGuest" queue=Fqcodel/Fqcodel target=192.168.40.0/24 total-queue=Fqcodel
/routing table
add disabled=no fib name=To-Wg-Hp225
/interface bridge port
add bridge=bridgevlan frame-types=admit-only-vlan-tagged interface=ether2 internal-path-cost=10 path-cost=10
/ip firewall connection tracking
set udp-timeout=10s
/ip neighbor discovery-settings
set discover-interface-list=none
/interface bridge vlan
add bridge=bridgevlan tagged=bridgevlan,ether2 vlan-ids=5
add bridge=bridgevlan tagged=bridgevlan,ether2 vlan-ids=10
add bridge=bridgevlan tagged=bridgevlan,ether2 vlan-ids=20
add bridge=bridgevlan tagged=bridgevlan,ether2 vlan-ids=30
add bridge=bridgevlan tagged=bridgevlan,ether2 vlan-ids=40
/interface list member
add interface=ether1 list=Wan
add interface=pppoe-out1 list=Wan
add interface=wghp225 list=Wan
add interface=vlancam list=Lan
add interface=vlanguest list=Lan
add interface=vlanhome list=Lan
add interface=vlaniot list=Lan
add interface=vlanmg list=Lan
add interface=vlancam list=Lan-Ex-Home
add interface=vlanguest list=Lan-Ex-Home
add interface=vlaniot list=Lan-Ex-Home
add interface=vlanmg list=Lan-Ex-Home
/interface wireguard peers
add allowed-address=0.0.0.0/0,::/0 endpoint-address=xxx.xxx.xxx.xxx endpoint-port=51820 interface=wghp225 preshared-key="xxxxxxxxxxxxxx=" public-key=\
    "xxxxxxxxxxxxxxxxxx="
/ip address
add address=192.168.5.1/24 interface=vlanmg network=192.168.5.0
add address=192.168.10.1/24 interface=vlanhome network=192.168.10.0
add address=192.168.2.1/24 interface=vlancam network=192.168.2.0
add address=192.168.30.1/24 interface=vlaniot network=192.168.30.0
add address=192.168.40.1/24 interface=vlanguest network=192.168.40.0
add address=10.6.0.13/24 interface=wghp225 network=10.6.0.0
/ip dhcp-server lease
add address=192.168.10.7 comment=-----Ubuntu-Docker----- mac-address=xxxxxx server=dhcp3
add address=192.168.10.6 comment=-----Ubuntu-Jellyfin----- mac-address= xxxxxx server=dhcp3
add address=192.168.10.8 comment=-----Pr-DSM----- mac-address= xxxxxx server=dhcp3
add address=192.168.10.5 comment=-----DS1621----- mac-address= xxxxxx server=dhcp3
add address=192.168.5.5 comment=-----DS1621-vpn----- mac-address= xxxxxx server=dhcp2
add address=192.168.2.4 comment=-----DS1621-Cam----- mac-address= xxxxxx server=dhcp4
add address=192.168.10.20 comment=-----Tv-Sony----- mac-address= xxxxxx server=dhcp3
add address=192.168.10.30 comment="-----Print Server-----" mac-address= xxxxxx server=dhcp3
add address=192.168.5.26 comment="-----Eap653 Vp-----" mac-address= xxxxxx server=dhcp2
add address=192.168.5.27 comment="-----Eap653 BC-----" mac-address= xxxxxx server=dhcp2
add address=192.168.10.10 comment="-----PiHole Net Home-----" mac-address= xxxxxx server=dhcp3
add address=192.168.5.7 comment="-----Pr Docker Net Mg------" mac-address= xxxxxx server=dhcp2
/ip dhcp-server network
add address=192.168.2.0/24 gateway=192.168.2.1
add address=192.168.5.0/24 gateway=192.168.5.1
add address=192.168.10.0/24 gateway=192.168.10.1
add address=192.168.30.0/24 gateway=192.168.30.1
add address=192.168.40.0/24 gateway=192.168.40.1
/ip dns
set allow-remote-requests=yes servers=192.168.10.10
/ip firewall address-list
add address= xxxxxx list="Wan IP"
add address=192.168.10.100-192.168.10.150 list="ip to vpn hp225"
add address=192.168.10.10 list="ip to vpn hp225"
add address=192.168.10.0/24 list="VlanHome IP"
add address=192.168.5.0/24 list="VlanMg IP"
add address=192.168.2.0/24 list="VlanCam IP"
add address=192.168.30.0/24 list="VlanIOT IP"
add address=192.168.40.0/24 list="VlanGuest IP"
add address=192.168.10.0/24 list="ip from vlan"
add address=192.168.5.0/24 list="ip from vlan"
add address=192.168.2.0/24 list="ip from vlan"
add address=192.168.30.0/24 list="ip from vlan"
add address=192.168.40.0/24 list="ip from vlan"
/ip firewall filter
add action=accept chain=input comment="defconf: accept established,related,untracked" connection-state=established,related,untracked
add action=drop chain=input comment="defconf: drop invalid" connection-state=invalid
add action=accept chain=input comment="defconf: accept ICMP" protocol=icmp
add action=drop chain=input comment="defconf: drop all not coming from LAN" in-interface-list=!Lan
add action=fasttrack-connection chain=forward comment="defconf: fasttrack" connection-state=established,related disabled=yes hw-offload=yes
add action=accept chain=forward comment="defconf: accept established,related, untracked" connection-state=established,related,untracked
add action=drop chain=forward comment="defconf: drop invalid" connection-state=invalid
add action=accept chain=forward comment="allow access to pihole" dst-address=192.168.10.10 in-interface-list=Lan
add action=drop chain=forward comment="block vlan to lan" in-interface-list=Lan-Ex-Home out-interface-list=Lan
add action=drop chain=forward comment="defconf: drop all from WAN not DSTNATed" connection-nat-state=!dstnat connection-state=new in-interface-list=Wan
/ip firewall mangle
add action=accept chain=prerouting comment="-----Mark Hijack DNS Tcp-----" disabled=yes dst-port=53 protocol=tcp
add action=accept chain=prerouting comment="-----Mark Hijack DNS Udp-----" disabled=yes dst-port=53 protocol=udp
add action=accept chain=prerouting comment="-----Hairpin Nat Mangle-----" dst-address-list="Wan IP" src-address=192.168.10.100-192.168.10.150
add action=mark-routing chain=prerouting comment="-----IP qua Wg hp225-----" dst-address-list="!ip from vlan" new-routing-mark=To-Wg-Hp225 passthrough=no src-address-list="ip to vpn hp225"
add action=change-mss chain=forward comment="-----Thay doi MSS-----" new-mss=clamp-to-pmtu out-interface=wghp225 passthrough=yes protocol=tcp tcp-flags=syn
/ip firewall nat
add action=masquerade chain=srcnat comment="-----Quay PPOE-----" out-interface=pppoe-out1
add action=masquerade chain=srcnat comment="-----Hairpin Nat------" dst-address=192.168.10.0/24 src-address=192.168.10.0/24
add action=masquerade chain=srcnat comment="-----Nat Wireguard Hp225-----" out-interface=wghp225
add action=dst-nat chain=dstnat comment="-----Nat Port 80 DS918-----" dst-address-list="Wan IP" dst-port=80 protocol=tcp to-addresses=192.168.10.8 to-ports=80
add action=dst-nat chain=dstnat comment="-----Nat Port 443 DS918-----" dst-address-list="Wan IP" dst-port=443 protocol=tcp to-addresses=192.168.10.8 to-ports=443
add action=dst-nat chain=dstnat comment="-----Nat Port 6690 DS1621-----" dst-address-list="Wan IP" dst-port=6690 protocol=tcp to-addresses=192.168.10.5 to-ports=6690
add action=dst-nat chain=dstnat comment="-----Hijack DNS-----" disabled=yes dst-port=53 in-interface-list=Lan protocol=udp src-address=!192.168.10.10 to-addresses=192.168.10.10
add action=dst-nat chain=dstnat comment="-----Hijack DNS-----" disabled=yes dst-port=53 in-interface-list=Lan protocol=tcp src-address=!192.168.10.10 to-addresses=192.168.10.10
/ip route
add disabled=no dst-address=0.0.0.0/0 gateway=wghp225 routing-table=To-Wg-Hp225 suppress-hw-offload=no
/ip service
set telnet disabled=yes
set ftp disabled=yes
set www address=192.168.10.0/24 port=8088
set ssh disabled=yes
set api disabled=yes
set api-ssl disabled=yes
/system clock
set time-zone-name=Asia/Ho_Chi_Minh
/system hardware
set allow-x86-64=yes
/system note
set show-at-login=no
/tool bandwidth-server
set enabled=no
/tool mac-server ping
set enabled=no
 
Còn IPv6 mới tham khảo chưa rành nhiều, nên chưa kích hoạt IPv6 cho mikrotik để sử dụng
Code:
/ipv6 firewall filter
add chain=input action=accept connection-state=established,related,untracked comment="defconf: accept established,related,untracked"
add chain=input action=drop connection-state=invalid comment="defconf: drop invalid"
add chain=input action=accept protocol=icmpv6 comment="defconf: accept ICMPv6"
add chain=input action=accept protocol=udp dst-port=33434-33534 comment="defconf: accept UDP traceroute"
add chain=input action=accept protocol=udp dst-port=546 src-address=fe80::/10 comment="defconf: accept DHCPv6-Client prefix delegation."
add chain=input action=drop in-interface-list=!LAN comment="defconf: drop everything else not coming from LAN"
add chain=forward action=accept connection-state=established,related,untracked comment="defconf: accept established,related,untracked"
add chain=forward action=drop connection-state=invalid comment="defconf: drop invalid"
add chain=forward action=drop src-address-list=bad_ipv6 comment="defconf: drop packets with bad src ipv6"
add chain=forward action=drop dst-address-list=bad_ipv6 comment="defconf: drop packets with bad dst ipv6"
add chain=forward action=drop protocol=icmpv6 hop-limit=equal:1 comment="defconf: rfc4890 drop hop-limit=1"
add chain=forward action=accept protocol=icmpv6 comment="defconf: accept ICMPv6"
add chain=forward action=drop in-interface-list=!LAN comment="defconf: drop everything else not coming from LAN"
Thím @CGGX_ANNX cho mình hỏi, với firewall ipv6 thì thêm rule chặn ping như thế nào? Mình có làm tương tự IPv4, chọn drop icmpv6, chọn option là echo request nhưng vẫn k chặn được. Kiểm tra port ipv6 ở trang này Online IPv6 Port Scanner and Firewall Tester (https://ipv6.chappell-family.com/ipv6tcptest/)

Screenshot 2024-03-23 103225.png
 
trong trường hợp bác muốn config = cơm thì cũng mất 1 giây thôi.
Nguyên lí vẫn là thay đổi distance trong route để tăng ưu tiên cho line cần chuyển
Thanks ! Hàng ngày mình đang config bằng cơm , cũng chỉ 30s nhưng thấy nó hơi thụ động .
 
CGGX_ANNX em gửi bác full cấu hình bác xem dùm nhé
Code:
/interface bridge
add add-dhcp-option82=yes dhcp-snooping=yes igmp-snooping=yes ingress-filtering=no name=bridgevlan port-cost-mode=short vlan-filtering=yes
/interface ethernet
set [ find default-name=ether1 ] disable-running-check=no
set [ find default-name=ether2 ] disable-running-check=no
/interface wireguard
add listen-port=51820 mtu=1420 name=wghp225
/interface vlan
add interface=bridgevlan name=vlancam vlan-id=20
add arp=reply-only interface=bridgevlan name=vlanguest vlan-id=40
add interface=bridgevlan name=vlanhome vlan-id=10
add interface=bridgevlan name=vlaniot vlan-id=30
add interface=bridgevlan name=vlanmg vlan-id=5
/interface pppoe-client
add add-default-route=yes disabled=no interface=ether1 name=pppoe-out1 user=xxxxxxx
/interface list
add comment=defconf name=Wan
add comment=defconf name=Lan
add comment=defconf name=Lan-Ex-Home
/interface wireless security-profiles
set [ find default=yes ] supplicant-identity=MikroTik
/ip pool
add name=dhcp_pool0 ranges=192.168.50.2-192.168.50.254
add name=dhcp_pool1 ranges=192.168.5.20-192.168.5.50
add name=dhcp_pool2 ranges=192.168.10.100-192.168.10.150
add name=dhcp_pool3 ranges=192.168.2.4-192.168.2.200
add name=dhcp_pool4 ranges=192.168.30.20-192.168.30.50
add name=dhcp_pool5 ranges=192.168.40.100-192.168.40.150
/ip dhcp-server
add address-pool=dhcp_pool1 interface=vlanmg lease-time=2h name=dhcp2
add address-pool=dhcp_pool2 interface=vlanhome lease-time=2h name=dhcp3
add address-pool=dhcp_pool3 interface=vlancam lease-time=2h name=dhcp4
add address-pool=dhcp_pool4 interface=vlaniot lease-time=2h name=dhcp5
add add-arp=yes address-pool=dhcp_pool5 interface=vlanguest lease-time=2h name=dhcp6
/queue type
add kind=fq-codel name=Fqcodel
/queue simple
add comment="Queue Fqcodel Wan" max-limit=450M/450M name="Qos Wan" queue=Fqcodel/Fqcodel target=pppoe-out1 total-queue=Fqcodel
add comment="Bandwith Limit" max-limit=30M/30M name="Bandwith Limit VlanGuest" queue=Fqcodel/Fqcodel target=192.168.40.0/24 total-queue=Fqcodel
/routing table
add disabled=no fib name=To-Wg-Hp225
/interface bridge port
add bridge=bridgevlan frame-types=admit-only-vlan-tagged interface=ether2 internal-path-cost=10 path-cost=10
/ip firewall connection tracking
set udp-timeout=10s
/ip neighbor discovery-settings
set discover-interface-list=none
/interface bridge vlan
add bridge=bridgevlan tagged=bridgevlan,ether2 vlan-ids=5
add bridge=bridgevlan tagged=bridgevlan,ether2 vlan-ids=10
add bridge=bridgevlan tagged=bridgevlan,ether2 vlan-ids=20
add bridge=bridgevlan tagged=bridgevlan,ether2 vlan-ids=30
add bridge=bridgevlan tagged=bridgevlan,ether2 vlan-ids=40
/interface list member
add interface=ether1 list=Wan
add interface=pppoe-out1 list=Wan
add interface=wghp225 list=Wan
add interface=vlancam list=Lan
add interface=vlanguest list=Lan
add interface=vlanhome list=Lan
add interface=vlaniot list=Lan
add interface=vlanmg list=Lan
add interface=vlancam list=Lan-Ex-Home
add interface=vlanguest list=Lan-Ex-Home
add interface=vlaniot list=Lan-Ex-Home
add interface=vlanmg list=Lan-Ex-Home
/interface wireguard peers
add allowed-address=0.0.0.0/0,::/0 endpoint-address=xxx.xxx.xxx.xxx endpoint-port=51820 interface=wghp225 preshared-key="xxxxxxxxxxxxxx=" public-key=\
    "xxxxxxxxxxxxxxxxxx="
/ip address
add address=192.168.5.1/24 interface=vlanmg network=192.168.5.0
add address=192.168.10.1/24 interface=vlanhome network=192.168.10.0
add address=192.168.2.1/24 interface=vlancam network=192.168.2.0
add address=192.168.30.1/24 interface=vlaniot network=192.168.30.0
add address=192.168.40.1/24 interface=vlanguest network=192.168.40.0
add address=10.6.0.13/24 interface=wghp225 network=10.6.0.0
/ip dhcp-server lease
add address=192.168.10.7 comment=-----Ubuntu-Docker----- mac-address=xxxxxx server=dhcp3
add address=192.168.10.6 comment=-----Ubuntu-Jellyfin----- mac-address= xxxxxx server=dhcp3
add address=192.168.10.8 comment=-----Pr-DSM----- mac-address= xxxxxx server=dhcp3
add address=192.168.10.5 comment=-----DS1621----- mac-address= xxxxxx server=dhcp3
add address=192.168.5.5 comment=-----DS1621-vpn----- mac-address= xxxxxx server=dhcp2
add address=192.168.2.4 comment=-----DS1621-Cam----- mac-address= xxxxxx server=dhcp4
add address=192.168.10.20 comment=-----Tv-Sony----- mac-address= xxxxxx server=dhcp3
add address=192.168.10.30 comment="-----Print Server-----" mac-address= xxxxxx server=dhcp3
add address=192.168.5.26 comment="-----Eap653 Vp-----" mac-address= xxxxxx server=dhcp2
add address=192.168.5.27 comment="-----Eap653 BC-----" mac-address= xxxxxx server=dhcp2
add address=192.168.10.10 comment="-----PiHole Net Home-----" mac-address= xxxxxx server=dhcp3
add address=192.168.5.7 comment="-----Pr Docker Net Mg------" mac-address= xxxxxx server=dhcp2
/ip dhcp-server network
add address=192.168.2.0/24 gateway=192.168.2.1
add address=192.168.5.0/24 gateway=192.168.5.1
add address=192.168.10.0/24 gateway=192.168.10.1
add address=192.168.30.0/24 gateway=192.168.30.1
add address=192.168.40.0/24 gateway=192.168.40.1
/ip dns
set allow-remote-requests=yes servers=192.168.10.10
/ip firewall address-list
add address= xxxxxx list="Wan IP"
add address=192.168.10.100-192.168.10.150 list="ip to vpn hp225"
add address=192.168.10.10 list="ip to vpn hp225"
add address=192.168.10.0/24 list="VlanHome IP"
add address=192.168.5.0/24 list="VlanMg IP"
add address=192.168.2.0/24 list="VlanCam IP"
add address=192.168.30.0/24 list="VlanIOT IP"
add address=192.168.40.0/24 list="VlanGuest IP"
add address=192.168.10.0/24 list="ip from vlan"
add address=192.168.5.0/24 list="ip from vlan"
add address=192.168.2.0/24 list="ip from vlan"
add address=192.168.30.0/24 list="ip from vlan"
add address=192.168.40.0/24 list="ip from vlan"
/ip firewall filter
add action=accept chain=input comment="defconf: accept established,related,untracked" connection-state=established,related,untracked
add action=drop chain=input comment="defconf: drop invalid" connection-state=invalid
add action=accept chain=input comment="defconf: accept ICMP" protocol=icmp
add action=drop chain=input comment="defconf: drop all not coming from LAN" in-interface-list=!Lan
add action=fasttrack-connection chain=forward comment="defconf: fasttrack" connection-state=established,related disabled=yes hw-offload=yes
add action=accept chain=forward comment="defconf: accept established,related, untracked" connection-state=established,related,untracked
add action=drop chain=forward comment="defconf: drop invalid" connection-state=invalid
add action=accept chain=forward comment="allow access to pihole" dst-address=192.168.10.10 in-interface-list=Lan
add action=drop chain=forward comment="block vlan to lan" in-interface-list=Lan-Ex-Home out-interface-list=Lan
add action=drop chain=forward comment="defconf: drop all from WAN not DSTNATed" connection-nat-state=!dstnat connection-state=new in-interface-list=Wan
/ip firewall mangle
add action=accept chain=prerouting comment="-----Mark Hijack DNS Tcp-----" disabled=yes dst-port=53 protocol=tcp
add action=accept chain=prerouting comment="-----Mark Hijack DNS Udp-----" disabled=yes dst-port=53 protocol=udp
add action=accept chain=prerouting comment="-----Hairpin Nat Mangle-----" dst-address-list="Wan IP" src-address=192.168.10.100-192.168.10.150
add action=mark-routing chain=prerouting comment="-----IP qua Wg hp225-----" dst-address-list="!ip from vlan" new-routing-mark=To-Wg-Hp225 passthrough=no src-address-list="ip to vpn hp225"
add action=change-mss chain=forward comment="-----Thay doi MSS-----" new-mss=clamp-to-pmtu out-interface=wghp225 passthrough=yes protocol=tcp tcp-flags=syn
/ip firewall nat
add action=masquerade chain=srcnat comment="-----Quay PPOE-----" out-interface=pppoe-out1
add action=masquerade chain=srcnat comment="-----Hairpin Nat------" dst-address=192.168.10.0/24 src-address=192.168.10.0/24
add action=masquerade chain=srcnat comment="-----Nat Wireguard Hp225-----" out-interface=wghp225
add action=dst-nat chain=dstnat comment="-----Nat Port 80 DS918-----" dst-address-list="Wan IP" dst-port=80 protocol=tcp to-addresses=192.168.10.8 to-ports=80
add action=dst-nat chain=dstnat comment="-----Nat Port 443 DS918-----" dst-address-list="Wan IP" dst-port=443 protocol=tcp to-addresses=192.168.10.8 to-ports=443
add action=dst-nat chain=dstnat comment="-----Nat Port 6690 DS1621-----" dst-address-list="Wan IP" dst-port=6690 protocol=tcp to-addresses=192.168.10.5 to-ports=6690
add action=dst-nat chain=dstnat comment="-----Hijack DNS-----" disabled=yes dst-port=53 in-interface-list=Lan protocol=udp src-address=!192.168.10.10 to-addresses=192.168.10.10
add action=dst-nat chain=dstnat comment="-----Hijack DNS-----" disabled=yes dst-port=53 in-interface-list=Lan protocol=tcp src-address=!192.168.10.10 to-addresses=192.168.10.10
/ip route
add disabled=no dst-address=0.0.0.0/0 gateway=wghp225 routing-table=To-Wg-Hp225 suppress-hw-offload=no
/ip service
set telnet disabled=yes
set ftp disabled=yes
set www address=192.168.10.0/24 port=8088
set ssh disabled=yes
set api disabled=yes
set api-ssl disabled=yes
/system clock
set time-zone-name=Asia/Ho_Chi_Minh
/system hardware
set allow-x86-64=yes
/system note
set show-at-login=no
/tool bandwidth-server
set enabled=no
/tool mac-server ping
set enabled=no

Sau khi ngâm cứu cái config của bác em vẫn chưa tìm ra lý do gì mà bên các vlan khác không ping được 192.168.10.10 (con pihole ping được từ vlanhome đúng không bác?).

Bây giờ nếu bác tạm thời disable tất cả các rules ở bảng filter, tất cả các rules ở bảng mangle, các rule ở bảng NAT ngoại trừ rule

Code:
/ip firewall nat
add action=masquerade chain=srcnat comment="-----Quay PPOE-----" out-interface=pppoe-out1

(để vẫn vào được internet, dù tạm thời không dùng wireguard), thì có kết nối từ vlan khác sang 192.168.10.10 được không ạ?
 
Thím @CGGX_ANNX cho mình hỏi, với firewall ipv6 thì thêm rule chặn ping như thế nào? Mình có làm tương tự IPv4, chọn drop icmpv6, chọn option là echo request nhưng vẫn k chặn được. Kiểm tra port ipv6 ở trang này Online IPv6 Port Scanner and Firewall Tester (https://ipv6.chappell-family.com/ipv6tcptest/)

View attachment 2399199

IPv6 bình thường không dùng NAT, với cấu hình bình thường trong RouterOS, có IPv6 forwarding, cấp địa chỉ bằng SLAAC, mỗi một thiết bị có địa chỉ global unicast riêng của mình, thì khi bác vào trang test kia, trang đó sẽ thử kết nối với địa chỉ của máy PC hay điện thoại mà bác đang ngồi chạy cái test chứ không phải kết nối vào địa chỉ IPv6 của router. Vì thế để block "ping" cho cái ô "ECHO REPLY" nó không vàng như trong hình nữa, bác phải hoặc là block trên tường lửa của từng thiết bị, hoặc là block trên RouterOS nhưng mà là add thêm rule vào chain FORWARD, chứ chain INPUT không thì không đủ.

Bác thêm rule này vào bảng filter rồi kéo lên trước rule hiện đang accept ICMPv6 ở chain forward.

Code:
/ipv6 firewall filter
add action=drop chain=forward comment="disable ping" icmp-options=128:0-255 protocol=icmpv6

và thêm rule ở chain input nếu bác muốn block cả ping đến địa chỉ router.

Thực tế ra mà nói thì block ping IPv6 vào thiết bị đằng sau router cũng không mang lại lợi ích cho lắm :). Vì khi dùng SLAAC cái phần đuôi 64bit interface-id của cái địa chỉ của thiết bị nó khó mà mò ra bằng cách thử dần dần được (quá nhiều khả năng, ngay cả với phần interface-id dùng EUI64 dựa trên MAC address). Nên ai muốn ping được thiết bị bác thì phải biết địa chỉ full của nó trước bằng cách nào đó khác, mà thực tế chỉ là bằng cách vì bác nối vào dịch vụ/server của họ thì họ mới thấy địa chỉ của bác từ source address của packet thôi. Mà khi đó tức là họ không cần ping cũng biết thiết bị bác đang online :). Bình thường các thiết bị cá nhân (PC/điện thoại/tablet) ngày nay toàn dùng địa chỉ IPv6 temporary để nối vào các dịch vụ, sau vài tiếng-một ngày là thay địa chỉ với interface id khác. Nên phía bên kia lưu lại địa chỉ để hôm sau ping thử lại cũng không có tác dụng.
 
Sau khi ngâm cứu cái config của bác em vẫn chưa tìm ra lý do gì mà bên các vlan khác không ping được 192.168.10.10 (con pihole ping được từ vlanhome đúng không bác?).

Bây giờ nếu bác tạm thời disable tất cả các rules ở bảng filter, tất cả các rules ở bảng mangle, các rule ở bảng NAT ngoại trừ rule

Code:
/ip firewall nat
add action=masquerade chain=srcnat comment="-----Quay PPOE-----" out-interface=pppoe-out1

(để vẫn vào được internet, dù tạm thời không dùng wireguard), thì có kết nối từ vlan khác sang 192.168.10.10 được không ạ?
hi bác em đã tìm ra lý do không ping được và fix xong, hiện tại còn 1 vấn đề vẫn chưa fix được là khi bật 2 rule ở phần nat này để force dns là mất mạng

Code:
/ip firewall nat
add action=dst-nat chain=dstnat comment="-----Hijack DNS-----" dst-port=53 \
    in-interface-list="List All Vlan" protocol=tcp src-address=!192.168.10.10 \
    to-addresses=192.168.10.10
add action=dst-nat chain=dstnat comment="-----Hijack DNS-----" dst-port=53 \
    in-interface-list="List All Vlan" protocol=udp src-address=!192.168.10.10 \
    to-addresses=192.168.10.10
/ip firewall mangle
add action=accept chain=prerouting comment="-----Mark Hijack DNS Tcp-----" \
    dst-port=53 protocol=tcp
add action=accept chain=prerouting comment="-----Mark Hijack DNS Udp-----" \
    dst-port=53 protocol=udp

Phần DNS trong ip em để trống mà bật rule này lên là bị mất mạng, phải vào dns điền ip của con pihole vào và tắt 2 cái rule ở nat đi thì mới vào lại được.
 
Back
Top