NTM Solutions

Thứ Tư, 5 tháng 3, 2025

Các lệnh netsh quan trọng

Dưới đây là bảng tổng hợp các lệnh netsh quan trọng trong Windows, giúp quản lý mạng, TCP/IP, tường lửa, Wi-Fi, Winsock, v.v.


01. Lệnh Netsh Winsock (Reset và Khắc phục lỗi mạng)

Lệnh Chức năng
netsh winsock reset Đặt lại Winsock về mặc định để sửa lỗi mạng.
netsh winsock show catalog Hiển thị danh sách Winsock LSP (Layered Service Providers).
netsh int ip reset Đặt lại TCP/IP về trạng thái mặc định.

02. Lệnh Netsh IP (Cấu hình địa chỉ IP và DNS)

Lệnh Chức năng
netsh interface ipv4 show config Xem cấu hình IP hiện tại.
netsh interface ipv4 set address name="Ethernet" static 192.168.1.100 255.255.255.0 192.168.1.1 Thiết lập IP tĩnh.
netsh interface ipv4 set dns "Ethernet" static 8.8.8.8 Đặt DNS Google cho adapter Ethernet.
netsh interface ipv4 set address "Ethernet" dhcp Đặt IP động (DHCP).
netsh interface ipv4 set dnsservers "Ethernet" dhcp Đặt DNS tự động từ DHCP.

03. Lệnh Netsh Firewall (Quản lý tường lửa Windows)

Lệnh Chức năng
netsh advfirewall show allprofiles Xem trạng thái tường lửa cho tất cả các profile (Domain, Private, Public).
netsh advfirewall set allprofiles state on Bật tường lửa.
netsh advfirewall set allprofiles state off Tắt tường lửa.
netsh advfirewall firewall add rule name="Open Port 8080" dir=in action=allow protocol=TCP localport=8080 Mở cổng 8080 trong tường lửa.
netsh advfirewall firewall delete rule name="Open Port 8080" Xóa quy tắc mở cổng 8080.

04. Lệnh Netsh Wi-Fi (Quản lý mạng không dây)

Lệnh Chức năng
netsh wlan show profiles Hiển thị danh sách mạng Wi-Fi đã lưu.
netsh wlan show profile name="WiFiName" key=clear Xem thông tin và mật khẩu Wi-Fi đã lưu.
netsh wlan connect name="WiFiName" Kết nối tới Wi-Fi đã lưu.
netsh wlan delete profile name="WiFiName" Xóa hồ sơ Wi-Fi đã lưu.
netsh wlan set hostednetwork mode=allow ssid=MyHotspot key=12345678 Tạo Wi-Fi Hotspot trên Windows.
netsh wlan start hostednetwork Bật Wi-Fi Hotspot.
netsh wlan stop hostednetwork Tắt Wi-Fi Hotspot.

05. Lệnh Netsh Routing & NAT (Dùng để chia sẻ mạng, Router)

Lệnh Chức năng
netsh interface portproxy add v4tov4 listenport=8080 connectaddress=192.168.1.2 connectport=80 Chuyển tiếp cổng 8080 đến IP nội bộ 192.168.1.2:80.
netsh interface portproxy show all Hiển thị danh sách các quy tắc NAT/Port Forwarding.
netsh interface portproxy delete v4tov4 listenport=8080 Xóa quy tắc NAT cổng 8080.

06. Lệnh Netsh LAN (Quản lý Ethernet)

Lệnh Chức năng
netsh lan show interfaces Hiển thị danh sách các adapter mạng có dây.
netsh lan show profiles Hiển thị danh sách profile mạng LAN đã lưu.
netsh lan connect name="MyEthernet" Kết nối tới mạng LAN có profile đã lưu.

07. Lệnh Netsh Proxy (Cấu hình proxy trên Windows)

Lệnh Chức năng
netsh winhttp show proxy Xem cài đặt proxy hiện tại.
netsh winhttp set proxy 192.168.1.1:8080 Thiết lập proxy.
netsh winhttp reset proxy Xóa cài đặt proxy.

Kết luận

🔹 netsh là 01 công cụ mạnh mẽ giúp quản lý mạng trên Windows.
🔹 Bạn có thể dùng nó để sửa lỗi kết nối, thiết lập IP, quản lý Wi-Fi, kiểm soát tường lửa, và nhiều tính năng khác.

Made by AI

Không có nhận xét nào:

Đăng nhận xét

Facebook Youtube RSS