Skip to content

Instantly share code, notes, and snippets.

@iamdylanngo
Last active April 1, 2020 02:02
Show Gist options
  • Select an option

  • Save iamdylanngo/203421f1b07f8721e792290c854acead to your computer and use it in GitHub Desktop.

Select an option

Save iamdylanngo/203421f1b07f8721e792290c854acead to your computer and use it in GitHub Desktop.
blockip-centos7.readme
# Check IP connecting
ifconfig
tcpdump -ani ethX port 21 or port 22
# Ping to server
nc -vz 127.0.0.1 22
or
telnet 127.0.0.1 8081
# Install firewall
yum install firewalld
systemctl start firewalld
systemctl status firewalld
- check status
firewall-cmd --state
- reload
firewall-cmd --reload
- stop
systemctl stop firewalld
- get all zones in my system
firewall-cmd --get-zones
- get default zone
firewall-cmd --get-default-zone
- get active zone and interface network
firewall-cmd --get-active-zones
- Select zone with interface network
firewall-cmd --zone=public --change-interface=eth0
- List rule
firewall-cmd --zone=public --list-services
- add rule
firewall-cmd --zone=public --add-service=http
firewall-cmd --zone=public --add-service=http --permanent
firewall-cmd --reload
- remove rule
firewall-cmd --zone=public --remove-service=http
# add rule
firewall-cmd --add-rich-rule="rule family='ipv4' source address='117.0.199.140' reject"
firewall-cmd --reload
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment