CentOS system, find the port file of the current machine in the /etc/sysconfig/network-scripts directory, and the file name is usually ifcfg- network connection name.
Vim opens the editor, adding and modifying allocation modes, IP addresses, masks, DNS, etc. A complete example is as follows:
After the modification is completed, execute systemctl restart network to restart the network card to take effect.
Ubuntu20 configuration value is static ip, so /etc/netplan needs to be modified. The following is a yaml file named network,1-network-manager-all.YAML. The following is a configuration example:
(here, use ifconfig or ip addr command to look at your network card number first. My number is enpls0).
After modification, enter the command: sudo netplan apply to make the configuration effective.
After the configuration is completed, ping other machines or external network addresses to see if the network is connected. If the configuration is still invalid, you can try to restart the machine (if the restart does not affect it).
View port information
Netstat -tunlp |grep port number View the progress of the specified port number, such as viewing port 8000, netstat -tunlp |grep 8000.
Nmap 127.0.0. 1 Look at the open ports of this machine, and all ports will be scanned.
Lsof -i: port number View the process where the port is located -9
Start the firewall
System startup firewall d
Disable firewall
System stop firewall d
Set/disable startup
Systemctl enable/disable firewall d
Restart the firewall
Firewall-Command-Reload
View status
System control status firewall d/firewall d-cmd-status
View version
Firewall-Command-Version
View help
Firewall -cmd-help
View area information
Firewall-Command-Activate-Zone
View the area information of the specified interface.
Firewall-cmd-get-zone-of-interface = eth0.
Reject all packages
Firewall-Command-Emergency-Open
Cancel the rejection status
Firewall-Command-Emergency Shutdown
See if you refuse or not.
Firewall-Command-Query -panicpor
Add interfaces to the zone (default interfaces are all public)
Firewall-cmd-zone = public-add-interface = eth0 (permanently valid plus-permanently and then reload the firewall)
Set the default interface area
Firewall-cmd-set-default-zone = public (effective immediately, no need to restart)
Update firewall rules
Firewall-cmd-reload or firewall-cmd-complete-reload (the difference between the two is that the first one does not need to disconnect, which is one of the functions of firewalld to dynamically add rules, and the second one needs to disconnect, which is similar to restarting services).
View all open ports in the specified area.
Firewall-Command-List-Port
firewall-cmd-zone = public-list-port
Open the port in the designated area (after opening, you need to restart the firewall to take effect)
Firewall-cmd-zone = public-add-port = 80/TCP (permanent effective plus permanent)
Reference website:/article/20b68a 88943059796 cec622e.html.