Configure iptables to only allow nfs and ssh services

Source: Internet
Author: User
1. modify the configuration file/etc/services (vi/etc/services) and add it to the row: mountd925/tcp # mountd process (you can change 925 to another available port) mountd925/udp2: modify the iptables configuration file/etc/sysconfig/iptables (vi/etc/sysconfig/iptables) 1. modify the configuration file/etc/services (vi/etc/services)
Add row: mountd 925/tcp # mountd process (change 925 to another available port)
Mountd 925/udp

2. modify IptablesConfiguration file/etc/sysconfig/ Iptables(Vi/etc/sysconfig/iptables)
The content is as follows:
* Filter
: Input accept [0: 0]
: Forward accept [0: 0]
: Output accept [0: 0]
-A input-p icmp -- icmp-type any-j ACCEPT
-A input-m state -- state ESTABLISHED, RELATED-jACCEPT
-A input-p tcp -- dport 2049-jACCEPT
-A input-p udp -- dport 2049-j ACCEPT
-A input-p udp -- dport 111-j ACCEPT
-A input-p tcp -- dport 111-j ACCEPT
-A input-p udp -- dport 925-j ACCEPT
-A input-p udp -- dport 925-j ACCEPT
-A input-p tcp -- dport 22-j ACCEPT
-A input-j REJECT -- reject-with icmp-host-prohibited
COMMIT

3. restart iptables (/etc/rc. d/init. d/iptables restart)

4. restart the client server
Related Article

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.