Configure System Fire Prevention and network with netsh.exe

Source: Internet
Author: User

 Configure System Fire Prevention and network with netsh.exe

(1), View, enable, or disable system firewall

Open the command prompt, enter the command "netsh firewallshow State", and press enter to view the firewall status. The display result shows the disabling and enabling of each functional module of the firewall. The "netsh firewall set opmode disable" command is used to disable the system firewall. The opposite command is "netsh firewall set opmode enable" to enable the firewall.

(2)Allow file and print sharing

Files and printers are commonly used in LAN sharing. To allow clients to access shared files or printers on the local machine, enter and execute the following commands: netsh Firewall add portopening UDP 137 NetBIOS-NS (allow the client to access port 137 of UDP protocol on the server) Netsh Firewall add portopening UDP 138 NetBIOS-DGM (Allow access to UDP port 138) Netsh Firewall add portopening tcp 139 NetBIOS-SSN (Allow access to TCP port 139) after the netsh Firewall add portopening TCP 445 NetBIOS-DS (allow access to TCP port 445) command is executed, all the ports required for file and print sharing are opened by the firewall.

(3)Allow ICMP echo

By default, external hosts are not allowed to ping Windows 7 for security reasons. However, in a secure LAN environment, the ping test is necessary for the Administrator to test the network. How can I allow the ping test echo on Windows 7? Of course, through the system firewall console you can set the file and print share (echo request-ICMPv4-In) rule in inbound rules to allow (if the network uses IPv6, you must also allowICMPv6-In.). However, we can use the netsh command in the command line to quickly implement it. Run the "netsh firewall set icmpsetting 8" command to Enable ICMP Echo. Otherwise, Run "netsh firewall set icmpsetting 8 disable" to disable the echo.

 

(4)Display Network Interface Information

Netsh interface show Interface

 

(5), Disable and enable the NIC

Netsh interface set interface name ="Wireless Network Connection "Admin = Disabled &&

Netsh interface set interface name ="Wireless Network Connection "Admin = Enabled

 

(6)Set the IP address and DNS of the NIC

Netsh interface IP Set addressName ="Local Connection "Source = DHCP

Netsh interface IP Set addressName ="Local Connection "Source = static

ADDR = 192.168.0.10 mask = 255.255.255.0 gateway = 192.168.0.1

Netsh interface IP Add DNSName ="Local Connection"ADDR = 192.168.0.120

 

(7)Enable "network and Sharing Center"

Control.exe/name Microsoft. networkandsharingcenter

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.