Suse Linux common ports on, off, disabled

Source: Internet
Author: User

Suse Linux common ports on, off, disabled

Linux there seems to be no direct command to open or close the port, because if just open the port and do not associate it with the process, the opening and closing of the port is meaningless (open the port but no program processing incoming data). In other words, the activity of the port in Linux is closely connected with the process, if you want to close a port, then just kill it to the corresponding process.

One, close the port by closing the process

For example, to turn off Port 22nd:
$ NETSTAT-ANP | Grep:22
TCP 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 1666/sshd
#-A displays all active TCP connections, as well as the TCP and UDP ports being monitored
#-N Represents the address and port number as a number and does not attempt to parse its name
#-P lists the processes related to port listening or connection (there is a place to note, which is mentioned below) (PID)
Know the process ID 1666 for Port 22nd, as long as:
$ kill-9 1666

Second, close the port by shutting down the service

SSH service is known to occupy Port 22

Close 22 Port #/etc/init.d/sshd Stop

Sometimes we need to look at the default port of a service, it is very good under Linux, no need to search the Internet, directly to see the "/etc/service" file to meet the needs. There is a mapping of the port number to the service.

For example, we want to see that the IPP protocol uses the default port to pass this command:
# Cat/etc/service|grep IPP

Third, disable port through firewall

Turn off port number: iptables-a input-p TCP--drop port number-j drop

Iptables-a output-p TCP--dport port number-j DROP

Open port number: iptables-a input-ptcp--dport port number-j ACCEPT

Under SuSE, after you turn on the firewall, you will find that the SSH service is unusable and the HTTP service is inaccessible. This is because firewalls are blocking these ports by default. Now add an exception policy that allows SSH and HTTP services to be used when the firewall is turned on.

4.1 Open the terminal, perform yast-- security and user- Firewall (Firewall );

650) this.width=650; "src=" Http://s4.51cto.com/wyfs02/M02/7A/7A/wKioL1ap5MvwRlhSAAF-9IJjZDU024.jpg "title=" QQ picture 20160128174819.jpg "alt=" Wkiol1ap5mvwrlhsaaf-9ijjzdu024.jpg "/>

Allowed Services ( allowed Services );

650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M01/7A/7A/wKioL1ap5OaSb6_nAAFocr5YKBo571.jpg "title=" QQ picture 20160128174847.jpg "alt=" Wkiol1ap5oasb6_naafocr5ykbo571.jpg "/>

External Area ( External Zone )-- the services to be allowed (service to allow);

650) this.width=650; "src=" Http://s5.51cto.com/wyfs02/M01/7A/7A/wKioL1ap5QeThQMIAAFwttYQDyQ659.jpg "title=" QQ picture 20160128174915.jpg "alt=" Wkiol1ap5qethqmiaafwttyqdyq659.jpg "/>

Add http server (add HTTP Server);

650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M00/7A/7B/wKiom1ap5Nrxu67AAAGRUEIM8EE355.jpg "title=" QQ picture 20160128174946.jpg "alt=" Wkiom1ap5nrxu67aaagrueim8ee355.jpg "/>

Add ( Add);

650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M02/7A/7B/wKiom1ap5PTx1cKLAAGBB1jaMz0468.jpg "title=" QQ picture 20160128175011.jpg "alt=" Wkiom1ap5ptx1cklaagbb1jamz0468.jpg "/>

Add Secure Shell Server (secureshell server);

650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M01/7A/7B/wKioL1ap5VfiwOoGAAGaUOpf8-8328.jpg "title=" QQ picture 20160128175038.jpg "alt=" Wkiol1ap5vfiwoogaagauopf8-8328.jpg "/>

Add ( Add);

650) this.width=650; "src=" Http://s5.51cto.com/wyfs02/M00/7A/7B/wKioL1ap5W_QyjU6AAGVKm1vse4723.jpg "title=" QQ picture 20160128175105.jpg "alt=" Wkiol1ap5w_qyju6aagvkm1vse4723.jpg "/>

Next (next);

650) this.width=650; "src=" Http://s5.51cto.com/wyfs02/M00/7A/7B/wKiom1ap5UTRQu8TAAFDgnMR02I262.jpg "title=" QQ picture 20160128175130.jpg "alt=" Wkiom1ap5utrqu8taafdgnmr02i262.jpg "/>

Finish.

Five, after testing, after opening the SuSE firewall,the port can still be used.


This article is from the "Han Lei" blog, make sure to keep this source http://deararvin.blog.51cto.com/11158301/1739628

Suse Linux common ports on, off, disabled

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.