Modifying the firewall configuration requires modifying the file /etc/sysconfig/iptables. If you want to open any ports, please add one to them.
-ARH-Firewall- 1-INPUT-mstate-state new-mtcp-ptcp-dport 152 1-jACCEPT
Do this, where 152 1 is the port number to open, and then restart the firewall service of linux.
Command to stop/start the firewall service:
After logging in as root, execute.
serviceiptablesstopstop
Serviceiptablesstart-go
(The service command is located in /sbin)
Firewall rules can only be activated when the iptables service is running. To start the service manually, use the following command:
/sbirviceiptablesrestart
To ensure that it starts at system boot, use the following command:
/sbin/chkconfig-level 345 iptableson
Ipchains service cannot run at the same time as iptables service. To determine whether the ipchains service is disabled, execute the following command:
/sbin/chkconfig-level 345 ipchainsoff
Add an open port number on the Linux server. How to drive 8080?
Opening the port requires starting a tcp service, such as starting apache or tomcat, and changing the listening port to 8080.
How does linux open and close ports?
First, check which ports netstat-anp has opened. Second, close the port number: iptables-a input-ptcp-drop port number -jdropptitables-aoutput-ptcp-dport port number-jdrop. Third, open the port number: iptables-a input-ptcp-dport port number -jACCEPT. Four, the following is the use of linux open port command. NC-LP23 (telnet) netstat-an | grep23 (check whether to open port 23) V. linux open port command Each open port needs a corresponding listener to suit the learning path of entry. Please read "This is how Linux should learn".
Linux port command?
Commands for viewing ports on Linux:
Type 1: lsof-i: port number.
The second type: netstat-nltp|grep port number.
-a: Displays all connection ports and listening ports of this machine.
-n: The form of network IP address, which shows the currently established valid connections and ports.
-r: display routing table information
-s: Display statistics by protocol.
-v: Displays the currently valid connections.
-t: display all TCP protocol connections.
-u: Show all UDP protocol connections.
-i: Displays the status of the auto-configuration port.
-l: Only the service network status with the connection status of monitoring is displayed.
-p: display pid/programname.