Linux Iptables Block Outgoing Access To Selected or Specific IP Address / Port
2017-03-20 21:02
429 查看
https://www.cyberciti.biz/tips/linux-iptables-6-how-to-block-outgoing-access-to-selectedspecific-ip-address.html
You would like to block outgoing access to particular remote host/ip or port for all or selected service/port. In this quick tutorial I will explain how to use iptables to block outgoing access.
The above will block chat server ip address or site having dangerous contains such as viruses or malware.
To block tcp port # 5050 for an IP address 192.168.1.2 only, enter:
Finally, you need to
save your firewall rules. Under CentOS / RHEL / Fedora Linux, enter:
OR
For more information see
Linux iptables(8) man page or our Linux firewall tutorials from the following resources:
You would like to block outgoing access to particular remote host/ip or port for all or selected service/port. In this quick tutorial I will explain how to use iptables to block outgoing access.
Block Access To Outgoing IP Address
The following rule will block ip address 202.54.1.22 from making any outgoing connection:iptables -A OUTPUT -d 202.54.1.22 -j DROP
The above will block chat server ip address or site having dangerous contains such as viruses or malware.
Block Access To Outgoing IP TCP / UDP Port Number
To block specific port number such tcp port # 5050, enter:iptables -A OUTPUT -p tcp --dport 5050 -j DROP
To block tcp port # 5050 for an IP address 192.168.1.2 only, enter:
iptables -A OUTPUT -p tcp -d 192.168.1.2 --dport 5050 -j DROP
Finally, you need to
save your firewall rules. Under CentOS / RHEL / Fedora Linux, enter:
# /sbin/service iptables save
OR
# /etc/init.d/iptables save
For more information see
Linux iptables(8) man page or our Linux firewall tutorials from the following resources:
相关文章推荐
- Forward a TCP port to another IP or port using NAT with Iptables
- How to Add Route to TCP/IP Routing Table With Windows Routing And Remote Access Console or DOS Promp
- EOP / Office 365: Block or Allow IP Address in Connection Filtering
- 转载《Adding a Second IP Address to an Existing Network Adapter on Linux》
- Apache Address already in use: make_sock: could not bind to port 80 or 443 error and solution
- JAVA: Serial Port access with javax.comm or rxtx on Windows, Linux etc.
- Resolving www.linuxde.net... failed: Name or service not known. wget: unable to resolve host address
- [Yii2]Access to debugger is denied due to IP address restriction. The requesting IP address is
- Nginx Block And Deny IP Address OR Network Subnets
- redis数据导出,报错Could not connect to Redis at ip:port: Cannot assign requested address解决方法
- How to check ip address in linux
- Linux 启动grub error 24: Attempt to access block outside partition 解决
- How to allow/block PING on Linux server – IPTables rules for icmp---reference
- about to search or kill the process and the port in the linux
- How to run program or process on specific CPU cores on Linux(转)
- Android之invalid address or address of corrupt block 0xabb494a0 passed to dlfree崩溃解决办法
- Linux Force DHCP Client (dhclient) to Renew IP Address
- how to find out the switch port by IP address
- How to Find Your IP Address in Ubuntu Linux
- How to check ip address in linux