thảo luận Cộng đồng OpenWRT Việt Nam - Thắc mắc - Khoe hàng - Đánh giá cho hết vào đây

Thang điểm từ 1 đến 5 bạn thích OpenWRT như thế nào?

  • 1 (Rất không thích)

  • 2 (Không thích)

  • 3 (Cũng được)

  • 4 (Thích)

  • 5 (Siêu thích)


Results are only viewable after voting.
Mình chia sẽ một số cài đặt mình đang dùng trên Router chạy OpenWRT
voz.vn/p/12976907

1. Gói sử dụng:
luci-ssl : Cài SSL cho Router
bind-dig : Kiểm tra máy truy vấn từ máy chủ phân giải tên miền
nano : Sửa nội dung file (CTRL+X thoát)
curl : Tải file
htop : Xem chương trình đang chạy
block-mount blockd : Quản lý gắn USB vào router
kmod-macvlan : Tạo Wan ảo
kmod-usb-storage kmod-usb-storage-uas kmod-usb3 : Driver USB
kmod-wireguard : VPN WireGuard
luci-app-commands : Chạy lệnh cài sẵn
luci-app-ddns : Quản lý máy chủ tên miền động (liên kết IP đến DDNS)
luci-app-mwan3 : Bộp băng thông, định tuyến kết nối
luci-app-nlbwmon : Xem băng thông máy con
luci-app-openvpn : Kết nối đến máy chủ VPN giao thức OpenVPN
luci-app-ttyd : Terminal trên Web
luci-app-uhttpd : Cài đặt máy chủ Web
luci-app-vpn-policy-routing : Phân luồng kết nối VPN
luci-app-wireguard : Tạo máy chủ VPN / Kết nối đến máy chủ VPN
luci-app-xwan : Tạo nhiều kết nối mạng qua Wan ảo: https://voz.vn/p/12454085
DNSCrypt-Proxy : Mã hóa truy vấn đến máy chủ phân giải tên miền
Tham khảo cài đặt chi tiết bên dưới:
Code:
https://github.com/DNSCrypt/dnscrypt-proxy/wiki/Installation-on-OpenWRT
Ở đây mình sẽ dùng máy chủ phân giải tên miền NextDNS.
NextDNS có file chính thức chạy trên OpenWRT (luci-app-nextdns), hiển thị từng clients kết nối đến máy chủ nào. Nhưng mình vẫn thích dùng DNSCrypt-Proxy vì có nhiều lý do.

2. Cấu hình:
# /etc/config/system
uci del system.ntp.enabled
uci del system.ntp.enable_server
uci set system.cfg01e48a.zonename='Asia/Ho Chi Minh' # Chọn múi giờ VN
uci set system.cfg01e48a.hostname='Darias' # Đặt tên cho Router
uci set system.cfg01e48a.log_proto='udp'
uci set system.cfg01e48a.conloglevel='8'
uci set system.cfg01e48a.cronloglevel='5'
uci set system.cfg01e48a.timezone='<+07>-7' # Cài múi giờ GMT+7

# /etc/config/wireless : Cài Wifi
uci set wireless.default_radio1.key='Mật khẩu'
uci set wireless.default_radio1.ssid='Tên Wifi 5G'
uci set wireless.default_radio1.encryption='psk2+ccmp'
uci set wireless.default_radio0.key='Mật khẩu'
uci set wireless.default_radio0.ssid='Tên Wifi 2G'
uci set wireless.default_radio0.encryption='psk2+ccmp'
uci set wireless.radio0.disabled='0' # Bật Wifi 2G
uci set wireless.radio1.disabled='0' # Bật Wifi 5G

# /etc/config/dhcp
uci set network.lan.ipaddr='10.0.0.1' #Cài IP cho router

# /etc/config/network : Cài kết nối mạng
uci del network.wan6
uci set network.wan.proto='pppoe'
uci set network.wan.username='Tài khoản Internet'
uci set network.wan.password='Mật khẩu Internet'
uci set network.wan.service='Tên nhà cung cấp dịch vụ'
uci set network.wan.ipv6='0'
uci set network.wan.delegate='0'
uci del network.lan.ip6assign
uci set network.lan.delegate='0'

Sau khi cài đặt mọi thứ OK thì chạy lệnh này để áp dụng.
Nếu muốn tạo nhiều kết nối mạng qua wan ảo thì có thể dùng thêm luci-app-xwan
Code:
uci commit && service network restart

Cài NordVPN cho WireGuard
Ở đây mình dùng 10 máy chủ NordVPN phân bổ đều cho 5 cụm máy chủ khu vực châu Á gồm: Singapore; Hong Kong, Taiwan, Korea và Japan

Bạn có thể dùng mwan để cân bằng tải, sau đó định tuyến qua cụm VPN này.
Hoặc tùy từng host mà dùng máy chủ VPN cố định.
Bên dưới là mình sẽ thêm các cụm máy chủ VPN vào mWan, còn định tuyến đi đâu thì các bạn tự thêm vô sau nhé!

Thêm giao diện vào tường lửa
# /etc/config/firewall
uci del firewall.cfg07dc81.network
uci add_list firewall.cfg07dc81.network='wan'
uci add_list firewall.cfg07dc81.network='ao01'
uci add_list firewall.cfg07dc81.network='ao02'
uci add_list firewall.cfg07dc81.network='Nord01'
uci add_list firewall.cfg07dc81.network='Nord02'
uci add_list firewall.cfg07dc81.network='Nord03'
uci add_list firewall.cfg07dc81.network='Nord04'
uci add_list firewall.cfg07dc81.network='Nord05'
uci add_list firewall.cfg07dc81.network='Nord06'
uci add_list firewall.cfg07dc81.network='Nord07'
uci add_list firewall.cfg07dc81.network='Nord08'
uci add_list firewall.cfg07dc81.network='Nord09'
uci add_list firewall.cfg07dc81.network='Nord10'

Tạo giao diện kèm khóa Private NordVPN
# /etc/config/network
uci set network.Nord01=interface
uci set network.Nord01.proto='wireguard'
uci set network.Nord01.private_key='Khóa Private của máy chủ NordVPN WireGuard'
uci set network.Nord01.listen_port='50309'
uci add_list network.Nord01.addresses='10.5.0.2/16'
uci set network.Nord01.peerdns='0'
uci add_list network.Nord01.dns='103.86.99.98'
uci add_list network.Nord01.dns='103.86.96.98'
uci set network.Nord01.metric='61'
uci set network.Nord01.delegate='0'
uci set network.Nord02=interface
uci set network.Nord02.proto='wireguard'
uci set network.Nord02.private_key='Khóa Private của máy chủ NordVPN WireGuard'
uci set network.Nord02.listen_port='31015'
uci add_list network.Nord02.addresses='10.5.0.2/16'
uci set network.Nord02.peerdns='0'
uci add_list network.Nord02.dns='103.86.99.98'
uci add_list network.Nord02.dns='103.86.96.98'
uci set network.Nord02.metric='62'
uci set network.Nord02.delegate='0'
uci set network.Nord03=interface
uci set network.Nord03.proto='wireguard'
uci set network.Nord03.private_key='Khóa Private của máy chủ NordVPN WireGuard'
uci set network.Nord03.listen_port='30905'
uci add_list network.Nord03.addresses='10.5.0.2/16'
uci set network.Nord03.peerdns='0'
uci add_list network.Nord03.dns='103.86.99.98'
uci add_list network.Nord03.dns='103.86.96.98'
uci set network.Nord03.metric='63'
uci set network.Nord03.delegate='0'
uci set network.Nord04=interface
uci set network.Nord04.proto='wireguard'
uci set network.Nord04.private_key='Khóa Private của máy chủ NordVPN WireGuard'
uci set network.Nord04.listen_port='30822'
uci add_list network.Nord04.addresses='10.5.0.2/16'
uci set network.Nord04.peerdns='0'
uci add_list network.Nord04.dns='103.86.99.98'
uci add_list network.Nord04.dns='103.86.96.98'
uci set network.Nord04.metric='64'
uci set network.Nord04.delegate='0'
uci set network.Nord05=interface
uci set network.Nord05.proto='wireguard'
uci set network.Nord05.private_key='Khóa Private của máy chủ NordVPN WireGuard'
uci set network.Nord05.listen_port='30810'
uci add_list network.Nord05.addresses='10.5.0.2/16'
uci set network.Nord05.peerdns='0'
uci add_list network.Nord05.dns='103.86.99.98'
uci add_list network.Nord05.dns='103.86.96.98'
uci set network.Nord05.metric='65'
uci set network.Nord05.delegate='0'
uci set network.Nord06=interface
uci set network.Nord06.proto='wireguard'
uci set network.Nord06.private_key='Khóa Private của máy chủ NordVPN WireGuard'
uci set network.Nord06.listen_port='30720'
uci add_list network.Nord06.addresses='10.5.0.2/16'
uci set network.Nord06.peerdns='0'
uci add_list network.Nord06.dns='103.86.99.98'
uci add_list network.Nord06.dns='103.86.96.98'
uci set network.Nord06.metric='66'
uci set network.Nord06.delegate='0'
uci set network.Nord07=interface
uci set network.Nord07.proto='wireguard'
uci set network.Nord07.private_key='Khóa Private của máy chủ NordVPN WireGuard'
uci set network.Nord07.listen_port='30719'
uci add_list network.Nord07.addresses='10.5.0.2/16'
uci set network.Nord07.peerdns='0'
uci add_list network.Nord07.dns='103.86.99.98'
uci add_list network.Nord07.dns='103.86.96.98'
uci set network.Nord07.metric='67'
uci set network.Nord07.delegate='0'
uci set network.Nord08=interface
uci set network.Nord08.proto='wireguard'
uci set network.Nord08.private_key='Khóa Private của máy chủ NordVPN WireGuard'
uci set network.Nord08.listen_port='30704'
uci add_list network.Nord08.addresses='10.5.0.2/16'
uci set network.Nord08.peerdns='0'
uci add_list network.Nord08.dns='103.86.99.98'
uci add_list network.Nord08.dns='103.86.96.98'
uci set network.Nord08.metric='68'
uci set network.Nord08.delegate='0'
uci set network.Nord09=interface
uci set network.Nord09.proto='wireguard'
uci set network.Nord09.private_key='Khóa Private của máy chủ NordVPN WireGuard'
uci set network.Nord09.listen_port='30705'
uci add_list network.Nord09.addresses='10.5.0.2/16'
uci set network.Nord09.peerdns='0'
uci add_list network.Nord09.dns='103.86.99.98'
uci add_list network.Nord09.dns='103.86.96.98'
uci set network.Nord09.metric='69'
uci set network.Nord09.delegate='0'
uci set network.Nord10=interface
uci set network.Nord10.proto='wireguard'
uci set network.Nord10.private_key='Khóa Private của máy chủ NordVPN WireGuard'
uci set network.Nord10.listen_port='30702'
uci add_list network.Nord10.addresses='10.5.0.2/16'
uci set network.Nord10.peerdns='0'
uci add_list network.Nord10.dns='103.86.99.98'
uci add_list network.Nord10.dns='103.86.96.98'
uci set network.Nord10.metric='70'
uci set network.Nord10.delegate='0'
uci commit

# Thêm máy chủ vào khóa Private NordVPN
# Singapore
uci add network wireguard_Nord01 # =cfg182882
uci set network.@wireguard_Nord01[-1].description='Singapore'
uci set network.@wireguard_Nord01[-1].public_key='U3dKnkOJY5P9p6kEbEDGR7+K2+4HmkKK1hTMugq2HQA='
uci add_list network.@wireguard_Nord01[-1].allowed_ips='0.0.0.0/0'
uci set network.@wireguard_Nord01[-1].endpoint_host='sg455.nordvpn.com'
uci set network.@wireguard_Nord01[-1].endpoint_port='51820'

# Singapore
uci add network wireguard_Nord02 # =cfg182883
uci set network.@wireguard_Nord02[-1].description='Singapore'
uci set network.@wireguard_Nord02[-1].public_key='U3dKnkOJY5P9p6kEbEDGR7+K2+4HmkKK1hTMugq2HQA='
uci add_list network.@wireguard_Nord02[-1].allowed_ips='0.0.0.0/0'
uci set network.@wireguard_Nord02[-1].endpoint_host='sg481.nordvpn.com'
uci set network.@wireguard_Nord02[-1].endpoint_port='51820'

# Hong Kong
uci add network wireguard_Nord03 # =cfg182884
uci set network.@wireguard_Nord03[-1].description='HongKong'
uci set network.@wireguard_Nord03[-1].public_key='+zv+cPRl1pf9hPXFKO3GoVpdBld97Uk3feyeF+9vLBQ='
uci add_list network.@wireguard_Nord03[-1].allowed_ips='0.0.0.0/0'
uci set network.@wireguard_Nord03[-1].endpoint_host='hk210.nordvpn.com'
uci set network.@wireguard_Nord03[-1].endpoint_port='51820'

# Hong Kong
uci add network wireguard_Nord04 # =cfg182885
uci set network.@wireguard_Nord04[-1].description='HongKong'
uci set network.@wireguard_Nord04[-1].public_key='+zv+cPRl1pf9hPXFKO3GoVpdBld97Uk3feyeF+9vLBQ='
uci add_list network.@wireguard_Nord04[-1].allowed_ips='0.0.0.0/0'
uci set network.@wireguard_Nord04[-1].endpoint_host='hk281.nordvpn.com'
uci set network.@wireguard_Nord04[-1].endpoint_port='51820'

# TaiWan
uci add network wireguard_Nord05 # =cfg182886
uci set network.@wireguard_Nord05[-1].description='TaiWan'
uci set network.@wireguard_Nord05[-1].public_key='iW991L6XyB8LWqsmRDDazPv9abbgrKKtR3Y2SGhg/T0='
uci add_list network.@wireguard_Nord05[-1].allowed_ips='0.0.0.0/0'
uci set network.@wireguard_Nord05[-1].endpoint_host='tw44.nordvpn.com'
uci set network.@wireguard_Nord05[-1].endpoint_port='51820'

# TaiWan
uci add network wireguard_Nord06 # =cfg182887
uci set network.@wireguard_Nord06[-1].description='TaiWan'
uci set network.@wireguard_Nord06[-1].public_key='iW991L6XyB8LWqsmRDDazPv9abbgrKKtR3Y2SGhg/T0='
uci add_list network.@wireguard_Nord06[-1].allowed_ips='0.0.0.0/0'
uci set network.@wireguard_Nord06[-1].endpoint_host='tw102.nordvpn.com'
uci set network.@wireguard_Nord06[-1].endpoint_port='51820'

# Korea
uci add network wireguard_Nord07 # =cfg182888
uci set network.@wireguard_Nord07[-1].description='Korea'
uci set network.@wireguard_Nord07[-1].public_key='oHda+iKdBpSlsKzaxz8kiJ1SxXvD9YxzgxOtsNdLjUg='
uci add_list network.@wireguard_Nord07[-1].allowed_ips='0.0.0.0/0'
uci set network.@wireguard_Nord07[-1].endpoint_host='kr33.nordvpn.com'
uci set network.@wireguard_Nord07[-1].endpoint_port='51820'

# Korea
uci add network wireguard_Nord08 # =cfg182889
uci set network.@wireguard_Nord08[-1].description='Korea'
uci set network.@wireguard_Nord08[-1].public_key='oHda+iKdBpSlsKzaxz8kiJ1SxXvD9YxzgxOtsNdLjUg='
uci add_list network.@wireguard_Nord08[-1].allowed_ips='0.0.0.0/0'
uci set network.@wireguard_Nord08[-1].endpoint_host='kr31.nordvpn.com'
uci set network.@wireguard_Nord08[-1].endpoint_port='51820'

# Japan
uci add network wireguard_Nord09 # =cfg182890
uci set network.@wireguard_Nord09[-1].description='Japan'
uci set network.@wireguard_Nord09[-1].public_key='SAio0Z0suFlRfmydzPdcn6MamqS7Mq4pSOm2YmJkLSs='
uci add_list network.@wireguard_Nord09[-1].allowed_ips='0.0.0.0/0'
uci set network.@wireguard_Nord09[-1].endpoint_host='jp596.nordvpn.com'
uci set network.@wireguard_Nord09[-1].endpoint_port='51820'

# Japan
uci add network wireguard_Nord10 # =cfg182891
uci set network.@wireguard_Nord10[-1].description='Japan'
uci set network.@wireguard_Nord10[-1].public_key='SAio0Z0suFlRfmydzPdcn6MamqS7Mq4pSOm2YmJkLSs='
uci add_list network.@wireguard_Nord10[-1].allowed_ips='0.0.0.0/0'
uci set network.@wireguard_Nord10[-1].endpoint_host='jp597.nordvpn.com'
uci set network.@wireguard_Nord10[-1].endpoint_port='51820'

uci commit

Nếu cân bằng tải bằng mWan thì dùng lệnh sau:
# Nord01
# /etc/config/mwan3
uci set mwan3.Nord01=interface
uci set mwan3.Nord01.enabled='1'
uci set mwan3.Nord01.initial_state='online'
uci set mwan3.Nord01.family='ipv4'
uci add_list mwan3.Nord01.track_ip='1.0.0.3'
uci set mwan3.Nord01.track_method='ping'
uci set mwan3.Nord01.reliability='1'
uci set mwan3.Nord01.count='1'
uci set mwan3.Nord01.size='56'
uci set mwan3.Nord01.max_ttl='60'
uci set mwan3.Nord01.check_quality='0'
uci set mwan3.Nord01.timeout='2'
uci set mwan3.Nord01.interval='20'
uci set mwan3.Nord01.failure_interval='5'
uci set mwan3.Nord01.recovery_interval='5'
uci set mwan3.Nord01.down='3'
uci set mwan3.Nord01.up='3'

# Nord02
# /etc/config/mwan3
uci set mwan3.Nord02=interface
uci set mwan3.Nord02.enabled='1'
uci set mwan3.Nord02.initial_state='online'
uci set mwan3.Nord02.family='ipv4'
uci add_list mwan3.Nord02.track_ip='1.0.0.3'
uci set mwan3.Nord02.track_method='ping'
uci set mwan3.Nord02.reliability='1'
uci set mwan3.Nord02.count='1'
uci set mwan3.Nord02.size='56'
uci set mwan3.Nord02.max_ttl='60'
uci set mwan3.Nord02.check_quality='0'
uci set mwan3.Nord02.timeout='2'
uci set mwan3.Nord02.interval='20'
uci set mwan3.Nord02.failure_interval='5'
uci set mwan3.Nord02.recovery_interval='5'
uci set mwan3.Nord02.down='3'
uci set mwan3.Nord02.up='3'

# Nord03
# /etc/config/mwan3
uci set mwan3.Nord03=interface
uci set mwan3.Nord03.enabled='1'
uci set mwan3.Nord03.initial_state='online'
uci set mwan3.Nord03.family='ipv4'
uci add_list mwan3.Nord03.track_ip='1.0.0.3'
uci set mwan3.Nord03.track_method='ping'
uci set mwan3.Nord03.reliability='1'
uci set mwan3.Nord03.count='1'
uci set mwan3.Nord03.size='56'
uci set mwan3.Nord03.max_ttl='60'
uci set mwan3.Nord03.check_quality='0'
uci set mwan3.Nord03.timeout='2'
uci set mwan3.Nord03.interval='20'
uci set mwan3.Nord03.failure_interval='5'
uci set mwan3.Nord03.recovery_interval='5'
uci set mwan3.Nord03.down='3'
uci set mwan3.Nord03.up='3'

# Nord04
# /etc/config/mwan3
uci set mwan3.Nord04=interface
uci set mwan3.Nord04.enabled='1'
uci set mwan3.Nord04.initial_state='online'
uci set mwan3.Nord04.family='ipv4'
uci add_list mwan3.Nord04.track_ip='1.0.0.3'
uci set mwan3.Nord04.track_method='ping'
uci set mwan3.Nord04.reliability='1'
uci set mwan3.Nord04.count='1'
uci set mwan3.Nord04.size='56'
uci set mwan3.Nord04.max_ttl='60'
uci set mwan3.Nord04.check_quality='0'
uci set mwan3.Nord04.timeout='2'
uci set mwan3.Nord04.interval='20'
uci set mwan3.Nord04.failure_interval='5'
uci set mwan3.Nord04.recovery_interval='5'
uci set mwan3.Nord04.down='3'
uci set mwan3.Nord04.up='3'

# Nord05
# /etc/config/mwan3
uci set mwan3.Nord05=interface
uci set mwan3.Nord05.enabled='1'
uci set mwan3.Nord05.initial_state='online'
uci set mwan3.Nord05.family='ipv4'
uci add_list mwan3.Nord05.track_ip='1.0.0.3'
uci set mwan3.Nord05.track_method='ping'
uci set mwan3.Nord05.reliability='1'
uci set mwan3.Nord05.count='1'
uci set mwan3.Nord05.size='56'
uci set mwan3.Nord05.max_ttl='60'
uci set mwan3.Nord05.check_quality='0'
uci set mwan3.Nord05.timeout='2'
uci set mwan3.Nord05.interval='20'
uci set mwan3.Nord05.failure_interval='5'
uci set mwan3.Nord05.recovery_interval='5'
uci set mwan3.Nord05.down='3'
uci set mwan3.Nord05.up='3'

# Nord06
# /etc/config/mwan3
uci set mwan3.Nord06=interface
uci set mwan3.Nord06.enabled='1'
uci set mwan3.Nord06.initial_state='online'
uci set mwan3.Nord06.family='ipv4'
uci add_list mwan3.Nord06.track_ip='1.0.0.3'
uci set mwan3.Nord06.track_method='ping'
uci set mwan3.Nord06.reliability='1'
uci set mwan3.Nord06.count='1'
uci set mwan3.Nord06.size='56'
uci set mwan3.Nord06.max_ttl='60'
uci set mwan3.Nord06.check_quality='0'
uci set mwan3.Nord06.timeout='2'
uci set mwan3.Nord06.interval='20'
uci set mwan3.Nord06.failure_interval='5'
uci set mwan3.Nord06.recovery_interval='5'
uci set mwan3.Nord06.down='3'
uci set mwan3.Nord06.up='3'

# Nord07
# /etc/config/mwan3
uci set mwan3.Nord07=interface
uci set mwan3.Nord07.enabled='1'
uci set mwan3.Nord07.initial_state='online'
uci set mwan3.Nord07.family='ipv4'
uci add_list mwan3.Nord07.track_ip='1.0.0.3'
uci set mwan3.Nord07.track_method='ping'
uci set mwan3.Nord07.reliability='1'
uci set mwan3.Nord07.count='1'
uci set mwan3.Nord07.size='56'
uci set mwan3.Nord07.max_ttl='60'
uci set mwan3.Nord07.check_quality='0'
uci set mwan3.Nord07.timeout='2'
uci set mwan3.Nord07.interval='20'
uci set mwan3.Nord07.failure_interval='5'
uci set mwan3.Nord07.recovery_interval='5'
uci set mwan3.Nord07.down='3'
uci set mwan3.Nord07.up='3'

# Nord08
# /etc/config/mwan3
uci set mwan3.Nord08=interface
uci set mwan3.Nord08.enabled='1'
uci set mwan3.Nord08.initial_state='online'
uci set mwan3.Nord08.family='ipv4'
uci add_list mwan3.Nord08.track_ip='1.0.0.3'
uci set mwan3.Nord08.track_method='ping'
uci set mwan3.Nord08.reliability='1'
uci set mwan3.Nord08.count='1'
uci set mwan3.Nord08.size='56'
uci set mwan3.Nord08.max_ttl='60'
uci set mwan3.Nord08.check_quality='0'
uci set mwan3.Nord08.timeout='2'
uci set mwan3.Nord08.interval='20'
uci set mwan3.Nord08.failure_interval='5'
uci set mwan3.Nord08.recovery_interval='5'
uci set mwan3.Nord08.down='3'
uci set mwan3.Nord08.up='3'

# Nord09
# /etc/config/mwan3
uci set mwan3.Nord09=interface
uci set mwan3.Nord09.enabled='1'
uci set mwan3.Nord09.initial_state='online'
uci set mwan3.Nord09.family='ipv4'
uci add_list mwan3.Nord09.track_ip='1.0.0.3'
uci set mwan3.Nord09.track_method='ping'
uci set mwan3.Nord09.reliability='1'
uci set mwan3.Nord09.count='1'
uci set mwan3.Nord09.size='56'
uci set mwan3.Nord09.max_ttl='60'
uci set mwan3.Nord09.check_quality='0'
uci set mwan3.Nord09.timeout='2'
uci set mwan3.Nord09.interval='20'
uci set mwan3.Nord09.failure_interval='5'
uci set mwan3.Nord09.recovery_interval='5'
uci set mwan3.Nord09.down='3'
uci set mwan3.Nord09.up='3'

# Nord10
# /etc/config/mwan3
uci set mwan3.Nord10=interface
uci set mwan3.Nord10.enabled='1'
uci set mwan3.Nord10.initial_state='online'
uci set mwan3.Nord10.family='ipv4'
uci add_list mwan3.Nord10.track_ip='1.0.0.3'
uci set mwan3.Nord10.track_method='ping'
uci set mwan3.Nord10.reliability='1'
uci set mwan3.Nord10.count='1'
uci set mwan3.Nord10.size='56'
uci set mwan3.Nord10.max_ttl='60'
uci set mwan3.Nord10.check_quality='0'
uci set mwan3.Nord10.timeout='2'
uci set mwan3.Nord10.interval='20'
uci set mwan3.Nord10.failure_interval='5'
uci set mwan3.Nord10.recovery_interval='5'
uci set mwan3.Nord10.down='3'
uci set mwan3.Nord10.up='3'

uci commit

Cài giữ kết nối và tắt định tuyến mặc định qua VPN
# /etc/config/network
uci set network.Nord01.defaultroute='0'
uci set network.Nord02.defaultroute='0'
uci set network.Nord03.defaultroute='0'
uci set network.Nord04.defaultroute='0'
uci set network.Nord05.defaultroute='0'
uci set network.Nord06.defaultroute='0'
uci set network.Nord07.defaultroute='0'
uci set network.Nord08.defaultroute='0'
uci set network.Nord09.defaultroute='0'
uci set network.Nord10.defaultroute='0'

uci set network.cfg182882.persistent_keepalive='25'
uci set network.cfg192883.persistent_keepalive='25'
uci set network.cfg1a2884.persistent_keepalive='25'
uci set network.cfg1b2885.persistent_keepalive='25'
uci set network.cfg1c2886.persistent_keepalive='25'
uci set network.cfg1d2887.persistent_keepalive='25'
uci set network.cfg1f2889.persistent_keepalive='25'
uci set network.cfg1e2888.persistent_keepalive='25'
uci set network.cfg20288a.persistent_keepalive='25'
uci set network.cfg2128a2.persistent_keepalive='25'
uci commit
Nếu muốn định tuyến bằng vpn-policy-routing thì
1. Tạo rule đầu tiên dành cho những máy chủ thường truy cập đi qua wan
2. Tạo 10 rules cho từng máy chủ, định tuyến các host đi qua các máy chủ VPN cho phù hợp để tối ưu nhất.
1 máy chủ có thể có nhiều host
3. Tạo 10 rules cho 10 IP nội bộ. Nếu ai muốn kết nối đến máy chủ nào thì có thể tự đổi IP Wifi để kết nối tới máy chủ đó.
Cũng có thể thêm nhiều IP cho 1 rules.
Lưu ý: Rules càng nhiều thì khi áp dụng, vpn-policy-routing sẽ reload càng lâu các bạn nhé. Trong quá trình reload sẽ tốn rất nhiều tài nguyên (xung lên rất cao) nên tùy độ mạnh của chip mà reload nhanh hay chậm.
Sau khi vpn-policy-routing reload cấu hình xong thì kết nối mới đi qua máy chủ VPN đã cài.
_______________________________________________________________________
Tạo thư mục và cài cert
Code:
mkdir -p /etc/ssl/certs; curl -sLo /etc/ssl/certs/cacert.pem https://curl.haxx.se/ca/cacert.pem
mkdir -p /sd; cd /sd; rm -rf /root; ln -s /sd /root

# Cập nhật gói đã cài
if [ ! -f "/sd/lenh/u" ]; then mkdir -p /sd/lenh
cat > /sd/lenh/u << \EOF
#!/bin/ash
Log="/www/Update.log"
if [ ! -f "$Log" ]; then echo > $Log; fi;
opkg update && opkg upgrade netifd
opkg list-installed | grep -qw luci-ssl || opkg install luci-ssl && /etc/init.d/uhttpd restart
Goi="$(opkg list-upgradable |awk '{print $1}')"
if [ -n "${Goi}" ]; then
opkg upgrade ${Goi}
if [ "$?" -eq 0 ]; then
echo "$(date +"%F %a %T") - Cập nhật thành công" \
$Log; echo "$(date +"%F %a %T") - Cập nhật thành công! Đang khởi động lại!!!"
exec reboot
else
echo "$(date +"%F %a %T") - Cập nhật thất bại" >> $Log
fi
else
echo "$(date +"%F %a %T") - Không có cập nhật" >> $Log
fi
cat $Log
EOF

chmod u+x /sd/lenh/u && touch /www/Update.log && echo "/sd/" >> /etc/sysupgrade.conf && echo "/www/Update.log" >> /etc/sysupgrade.conf
fi
ln -s /sd/lenh/u /usr/sbin/u

# Chuyển máy chủ OpenWRT mặc định sang Sin để cải thiện tốc độ tải gói.

TM="/sd/m";
if [ ! -d ${TM} ]; then
#Create Mirror
mkdir -p /sd; mkdir -p $TM; mkdir -p $TM/lenh
file="/etc/opkg/distfeeds.conf"; SoDong="$(awk '/freifunk/{ print NR; exit }' $file)"; sed -i ''"$SoDong"'s,^,#,' "$file"
cp /etc/opkg/distfeeds.conf ${TM}/Goc.conf; cp ${TM}/Goc.conf ${TM}/Sin.conf; sed -i -e 's/downloads\.openwrt\.org/mirror\.0x\.sg\/openwrt/g' ${TM}/Sin.conf; cp ${TM}/Goc.conf ${TM}/Aus.conf; sed -i -e 's/downloads\.openwrt\.org/mirror\.kumi\.systems\/openwrt/g' ${TM}/Aus.conf;
echo '#!/bin/bash' > ${TM}/goc; echo 'TM=/sd/m; mkdir -p $TM; cp ${TM}/Goc.conf /etc/opkg/distfeeds.conf' > ${TM}/goc; chmod +x ${TM}/goc;
echo '#!/bin/bash' > ${TM}/sin; echo 'TM=/sd/m; mkdir -p $TM; cp ${TM}/Sin.conf /etc/opkg/distfeeds.conf' > ${TM}/sin; chmod +x ${TM}/sin;
echo '#!/bin/bash' > ${TM}/aus; echo 'TM=/sd/m; mkdir -p $TM; cp ${TM}/Aus.conf /etc/opkg/distfeeds.conf' > ${TM}/aus; chmod +x ${TM}/aus;
#ReStore
#sed -i -e 's/mirror\.0x\.sg\/openwrt/downloads\.openwrt\.org/g' ${TM}/Goc.conf;
sh /sd/m/sin
mv /etc/init.d/auto_usb_mount /sd/lenh/
fi

# Sao lưu tên các gói đã cài đặt vào file text
#!/bin/sh
mkdir -p /sd; mkdir -p /sd/lenh
GoiDaCai="/sd/lenh/cai.pkg"
install_time=$(opkg status kernel | grep Installed-Time | sed "s/Installed-Time: //")

opkg list-installed | awk -F " " '{print $1}' > $GoiDaCai

while read index
do
loop_inst_time=$(opkg status $index | grep Installed-Time | sed "s/Installed-Time: //")
is_user_installed=$(opkg status $index | grep "Status:" | grep "user")
if [ "$loop_inst_time" -ne "$install_time" ] && [ -n "$is_user_installed" ]; then
echo $index
fi
done < $GoiDaCai

# Xoá phân vùng OpenWRT và khởi động vào chế độ phục hồi
Code:
ubirmvol /dev/ubi0 -N linux2 && sysupgrade -F /bin/busybox
 
Last edited:
mới cài xong chưa biết để làm , nhưng cho hỏi sao cái đt tốc độ có 1.0 mbit thế, với bác nào có cách config tối ưu cho xin hướng dẫn với, mới nhâp môn ngồi cài từ 4h đến 7h mới xong @@
View attachment 800226
nếu điện thoại ko xài thì là bình thường, 1 dạng powersave thôi. Còn tối ưu thì cũng khó nói, tùy nhu cầu mà đơn giản nhất là cài thêm cái sqm-qos, adblock, với chỉnh lại cái kênh sóng 2.4 5 cho nó hợp lý.
 
Mình chia sẽ một số cài đặt mình đang dùng trên Router chạy OpenWRT

1. Gói sử dụng:

DNSCrypt-Proxy : Mã hóa truy vấn đến máy chủ phân giải tên miền
Tham khảo cài đặt chi tiết bên dưới:
Code:
https://github.com/DNSCrypt/dnscrypt-proxy/wiki/Installation-on-OpenWRT
Ở đây mình sẽ dùng máy chủ phân giải tên miền NextDNS.
NextDNS có file chính thức chạy trên OpenWRT (luci-app-nextdns), hiển thị từng clients kết nối đến máy chủ nào. Nhưng mình vẫn thích dùng DNSCrypt-Proxy vì có nhiều lý do.

2. Cấu hình:
# /etc/config/system


# /etc/config/wireless


# /etc/config/dhcp


# /etc/config/network


Sau khi cài đặt mọi thứ OK thì chạy lệnh này để áp dụng
Code:
uci commit && service network restart

Cài NordVPN cho WireGuard
Ở đây mình dùng 10 máy chủ NordVPN phân bổ đều cho 5 cụm máy chủ khu vực châu Á gồm: Singapore; Hong Kong, Taiwan, Korea và Japan

Bạn có thể dùng mwan để cân bằng tải, sau đó định tuyến qua cụm VPN này.
Hoặc tùy từng host mà dùng máy chủ VPN cố định.
Bên dưới là mình sẽ thêm các cụm máy chủ VPN vào mWan, còn định tuyến đi đâu thì các bạn tự thêm vô sau nhé!
Thêm giao diện vào tường lửa
# /etc/config/firewall


Tạo giao diện kèm khóa Private NordVPN
# /etc/config/network


# Thêm máy chủ vào khóa Private NordVPN


Nếu cân bằng tải bằng mWan thì dùng lệnh sau:


Cài giữ kết nối và tắt địn tuyến mặc định qua VPN

Nếu muốn định tuyến bằng vpn-policy-routing thì
1. Tạo rule đầu tiên dành cho những máy chủ thường truy cập đi qua wan
2. Tạo 10 rules cho từng máy chủ, định tuyến các host đi qua các máy chủ VPN cho phù hợp để tối ưu nhất.
1 máy chủ có thể có nhiều host
3. Tạo 10 rules cho 10 IP nội bộ. Nếu ai muốn kết nối đến máy chủ nào thì có thể tự đổi IP Wifi để kết nối tới máy chủ đó.
Cũng có thể thêm nhiều IP cho 1 rules.
_______________________________________________________________________
Tạo thư mục và cài cert
Code:
mkdir -p /etc/ssl/certs; curl -sLo /etc/ssl/certs/cacert.pem https://curl.haxx.se/ca/cacert.pem
mkdir -p /sd; cd /sd; rm -rf /root; ln -s /sd /root

# Cập nhật gói đã cài


# Chuyển máy chủ OpenWRT mặc định sang Sin để cải thiện tốc độ tải gói.



# Xoá phân vùng OpenWRT và khởi động vào chế độ phục hồi
Code:
ubirmvol /dev/ubi0 -N linux2 && sysupgrade -F /bin/busybox
Bài viết công phu và hay quá. Like. Nghiên cứu dần.
À bác có thể hướng dẫn backup toàn bộ các soft đã cài và cấu hình đã cài ở bản fw đang dùng được không ? Có j vọc vạch lên bản mới mà lỗi muốn quay lại chỉ cần restore lại.
 
Ko được thì để vứt cho thím config lan-wan mà vẫn cùng lớp mạng & cài được package
được rồi thím ạ, quay về cài bàn 19.07 rồi set thêm mỗi cái gateway của router chính là có mạng luôn. dễ thế mà cứ mò mãi :)
 
# Sao lưu tên các gói đã cài đặt vào file text
À bác có thể hướng dẫn backup toàn bộ các soft đã cài và cấu hình đã cài ở bản fw đang dùng được không ?
Có cách chính thức đc openwrt hỗ trợ đơn giản & dễ hiểu hơn:
- ssh vô router rồi chạy lệnh này để tạo file backup cấu hình, nó sẽ kèm luôn danh sách các gói packages đã cài đặt: (lưu ý dùng Luci-gui backup cấu hình sẽ ko đc đâu nhé)
Code:
sysupgrade -k -b /tmp/tênfilebackup.tar.gz
Xong dùng lệnh hoặc winscp copy tênfilebackup.tar.gz trong /tmp ra chỗ khác.
- Cài lại fw Openwrt xong restore file backup ở trên, reboot router chờ có mạng lại ròi ssh vô router chạy lần lượt lệnh sau:
Code:
opkg update
grep "\toverlay" /etc/backup/installed_packages.txt | cut -f1 | xargs -r opkg install
rm /etc/backup/installed_packages.txt
 
Mình chia sẽ một số cài đặt mình đang dùng trên Router chạy OpenWRT
voz.vn/p/12976907

1. Gói sử dụng:

DNSCrypt-Proxy : Mã hóa truy vấn đến máy chủ phân giải tên miền
Tham khảo cài đặt chi tiết bên dưới:
Code:
https://github.com/DNSCrypt/dnscrypt-proxy/wiki/Installation-on-OpenWRT
Ở đây mình sẽ dùng máy chủ phân giải tên miền NextDNS.
NextDNS có file chính thức chạy trên OpenWRT (luci-app-nextdns), hiển thị từng clients kết nối đến máy chủ nào. Nhưng mình vẫn thích dùng DNSCrypt-Proxy vì có nhiều lý do.

2. Cấu hình:
# /etc/config/system


# /etc/config/wireless


# /etc/config/dhcp


# /etc/config/network


Sau khi cài đặt mọi thứ OK thì chạy lệnh này để áp dụng
Code:
uci commit && service network restart

Cài NordVPN cho WireGuard
Ở đây mình dùng 10 máy chủ NordVPN phân bổ đều cho 5 cụm máy chủ khu vực châu Á gồm: Singapore; Hong Kong, Taiwan, Korea và Japan

Bạn có thể dùng mwan để cân bằng tải, sau đó định tuyến qua cụm VPN này.
Hoặc tùy từng host mà dùng máy chủ VPN cố định.
Bên dưới là mình sẽ thêm các cụm máy chủ VPN vào mWan, còn định tuyến đi đâu thì các bạn tự thêm vô sau nhé!
Thêm giao diện vào tường lửa
# /etc/config/firewall


Tạo giao diện kèm khóa Private NordVPN
# /etc/config/network


# Thêm máy chủ vào khóa Private NordVPN


Nếu cân bằng tải bằng mWan thì dùng lệnh sau:


Cài giữ kết nối và tắt địn tuyến mặc định qua VPN

Nếu muốn định tuyến bằng vpn-policy-routing thì
1. Tạo rule đầu tiên dành cho những máy chủ thường truy cập đi qua wan
2. Tạo 10 rules cho từng máy chủ, định tuyến các host đi qua các máy chủ VPN cho phù hợp để tối ưu nhất.
1 máy chủ có thể có nhiều host
3. Tạo 10 rules cho 10 IP nội bộ. Nếu ai muốn kết nối đến máy chủ nào thì có thể tự đổi IP Wifi để kết nối tới máy chủ đó.
Cũng có thể thêm nhiều IP cho 1 rules.
_______________________________________________________________________
Tạo thư mục và cài cert
Code:
mkdir -p /etc/ssl/certs; curl -sLo /etc/ssl/certs/cacert.pem https://curl.haxx.se/ca/cacert.pem
mkdir -p /sd; cd /sd; rm -rf /root; ln -s /sd /root

# Cập nhật gói đã cài


# Chuyển máy chủ OpenWRT mặc định sang Sin để cải thiện tốc độ tải gói.



# Sao lưu tên các gói đã cài đặt vào file text


# Xoá phân vùng OpenWRT và khởi động vào chế độ phục hồi
Code:
ubirmvol /dev/ubi0 -N linux2 && sysupgrade -F /bin/busybox
Quá bổ ích
 
Có cách chính thức đc openwrt hỗ trợ đơn giản & dễ hiểu hơn:
- ssh vô router rồi chạy lệnh này để tạo file backup cấu hình, nó sẽ kèm luôn danh sách các gói packages đã cài đặt: (lưu ý dùng Luci-gui backup cấu hình sẽ ko đc đâu nhé)
Code:
sysupgrade -k -b /tmp/tênfilebackup.tar.gz
Xong dùng lệnh hoặc winscp copy tênfilebackup.tar.gz trong /tmp ra chỗ khác.
- Cài lại fw Openwrt xong restore file backup ở trên, reboot router chờ có mạng lại ròi ssh vô router chạy lần lượt lệnh sau:
Code:
opkg update
grep "\toverlay" /etc/backup/installed_packages.txt | cut -f1 | xargs -r opkg install
rm /etc/backup/installed_packages.txt
Vào phần phục hồi trong luci chọn cái file "tênfilebackup.tar.gz" bấm restore hay chép vô thư mục trong router bác.
Copy xong hết mới chạy lệnh phải không bác.
 

Attachments

  • RESTORE.PNG
    RESTORE.PNG
    32.1 KB · Views: 145
Có cách chính thức đc openwrt hỗ trợ đơn giản & dễ hiểu hơn:
- ssh vô router rồi chạy lệnh này để tạo file backup cấu hình, nó sẽ kèm luôn danh sách các gói packages đã cài đặt: (lưu ý dùng Luci-gui backup cấu hình sẽ ko đc đâu nhé)
Code:
sysupgrade -k -b /tmp/tênfilebackup.tar.gz
Xong dùng lệnh hoặc winscp copy tênfilebackup.tar.gz trong /tmp ra chỗ khác.
- Cài lại fw Openwrt xong restore file backup ở trên, reboot router chờ có mạng lại ròi ssh vô router chạy lần lượt lệnh sau:
Code:
opkg update
grep "\toverlay" /etc/backup/installed_packages.txt | cut -f1 | xargs -r opkg install
rm /etc/backup/installed_packages.txt
Tue Oct 5 12:32:10 2021 daemon.warn dnsmasq[32713]: possible DNS-rebind attack detected: nexus-websocket-a.intercom.io Tue Oct 5 12:32:24 2021 daemon.warn dnsmasq[32713]: possible DNS-rebind attack detected: nexus-websocket-a.intercom.io Tue Oct 5 12:32:45 2021 daemon.warn dnsmasq[32713]: possible DNS-rebind attack detected: nexus-websocket-a.intercom.io Tue Oct 5 12:33:36 2021 daemon.warn dnsmasq[32713]: possible DNS-rebind attack detected: nexus-websocket-a.intercom.io Tue Oct 5 12:35:25 2021 daemon.warn dnsmasq[32713]: possible DNS-rebind attack detected: nexus-websocket-a.intercom.io Tue Oct 5 12:35:37 2021 daemon.warn dnsmasq[32713]: possible DNS-rebind attack detected: nexus-websocket-a.intercom.io Tue Oct 5 12:36:05 2021 daemon.warn dnsmasq[32713]: possible DNS-rebind attack detected: nexus-websocket-a.intercom.io Tue Oct 5 12:36:37 2021 daemon.warn dnsmasq[32713]: possible DNS-rebind attack detected: nexus-websocket-a.intercom.io Tue Oct 5 12:37:29 2021 daemon.warn dnsmasq[32713]: possible DNS-rebind attack detected: nexus-websocket-a.intercom.io Tue Oct 5 12:37:42 2021 daemon.warn dnsmasq[32713]: possible DNS-rebind attack detected: nexus-websocket-a.intercom.io Tue Oct 5 12:37:59 2021 daemon.warn dnsmasq[32713]: possible DNS-rebind attack detected: nexus-websocket-a.intercom.io Tue Oct 5 12:38:20 2021 daemon.warn dnsmasq[32713]: possible DNS-rebind attack detected: nexus-websocket-a.intercom.io Tue Oct 5 12:40:09 2021 daemon.warn dnsmasq[32713]: possible DNS-rebind attack detected: nexus-websocket-a.intercom.io Tue Oct 5 12:40:22 2021 daemon.warn dnsmasq[32713]: possible DNS-rebind attack detected: nexus-websocket-a.intercom.io Tue Oct 5 12:40:40 2021 daemon.warn dnsmasq[32713]: possible DNS-rebind attack detected: nexus-websocket-a.intercom.io Tue Oct 5 12:41:04 2021 daemon.warn dnsmasq[32713]: possible DNS-rebind attack detected: nexus-websocket-a.intercom.io Tue Oct 5 12:42:20 2021 daemon.warn dnsmasq[32713]: possible DNS-rebind attack detected: nexus-websocket-a.intercom.io Tue Oct 5 12:42:31 2021 daemon.warn dnsmasq[32713]: possible DNS-rebind attack detected: nexus-websocket-a.intercom.io Tue Oct 5 12:42:45 2021 daemon.warn dnsmasq[32713]: possible DNS-rebind attack detected: nexus-websocket-a.intercom.io Tue Oct 5 12:43:39 2021 daemon.warn dnsmasq[32713]: possible DNS-rebind attack detected: nexus-websocket-a.intercom.io Tue Oct 5 12:45:22 2021 daemon.warn dnsmasq[32713]: possible DNS-rebind attack detected: nexus-websocket-a.intercom.io Tue Oct 5 12:45:34 2021 daemon.warn dnsmasq[32713]: possible DNS-rebind attack detected: nexus-websocket-a.intercom.io Tue Oct 5 12:45:45 2021 daemon.warn dnsmasq[32713]: possible DNS-rebind attack detected: nexus-websocket-a.intercom.io Tue Oct 5 12:46:13 2021 daemon.warn dnsmasq[32713]: possible DNS-rebind attack detected: nexus-websocket-a.intercom.io Tue Oct 5 12:47:15 2021 daemon.warn dnsmasq[32713]: possible DNS-rebind attack detected: nexus-websocket-a.intercom.io
hi bác, mình thấy nó thông báo trong log nhiều quá, nó còn dài nữa cơ. bác có cách nào tắt cái thông báo này đi được không ?
nhà mình cũng nhiều thiết bị cả pc lẫn điện thoại. để truy ra ứng dụng hay máy nào cài ứng dụng linh tinh thì cũng khó bảo người nhà. cái ông ketqua.net cũng hiện nhiều :(
 
Vào phần phục hồi trong luci chọn cái file "tênfilebackup.tar.gz" bấm restore
Đúng ròi, dùng luci để restore.
hi bác, mình thấy nó thông báo trong log nhiều quá, nó còn dài nữa cơ. bác có cách nào tắt cái thông báo này đi được không ?
Có 3 cách tắt:
  • add domain vô như hình.
  • bỏ chọn Rebind protection như hình. (ko khuyến khích vì nguy hiểm)
  • có xài adblock thì đưa domain của nó vô blacklist.
    1633495635899.png
p/s: lần sau post vd ngắn ngắn thôi cho thớt đỡ dài & tránh quote nguyên bài của ng khác.
 
Last edited:
Có thím nào trộn luồn IPTV của VNPT trên version 21.02 chưa? cho xin ít kinh nghiệm vs. chiều giờ ngồi mò hoài mà chưa dc. hix
trên group FB 3d2 có bác hướng dẫn đó bác, thấy nhiều bước hơn 19.0.7 nên thôi ở lại 19 cho lành.
Lên 21 quản lý dạng DSA không quen lắm
 
trên group FB 3d2 có bác hướng dẫn đó bác, thấy nhiều bước hơn 19.0.7 nên thôi ở lại 19 cho lành.
Lên 21 quản lý dạng DSA không quen lắm
uhm, thank thím, chuyển sang DSA nên mò mệt vãi. hix

PS: Đã làm dc. Thiếu mỗi bước omcproxy. hix
 
Last edited:
Back
Top