Linux centos7 Linux network related, firewalld and netfilter, netfilter5 table 5 chain introduction, iptables syntax

1. Linux network related

yum install net-tools

 ifconfig view network card ip

ifup ens33 open the network card

 

ifdown ens33 shuts down the network card

Set virtual network card ens33:0

 

mii-toll ens33 is the same as ethtool ens33 to check whether the network card is connected

change hostname hostnamectl sethostname davery

 

 

DNS configuration file vi /etc/resoly.conf /etc/host file

 

Temporarily change IP

vim /cat/hosts Edit

 

Second, firewalld and netfilter

selinux temporarily turns off setenforce 0

selinux shuts down permanently

vi /etc/selinux/config  

change SELINUX=disabled

become

The previous version of centos7 used netfilter firewall

centos7 uses firewalld firewall

Turn off firewalld and turn on the netfilter method

 systemctl stop firewalld shutdown

systemctl disable firewalld does not allow boot to start

yum install -y iptables-services

Start the iptables firewall service

systemctl enable iptables

systemctl start iptables

iptables -nvL View

Three, netfilter5 table 5 chain introduction

5 tables of netfilter

The filter table is used to filter packets. Common tables include three chains: INPUT, FORWARD, and OUTPUT.

 The nat table is used for network address translation and has three chains: PREROUTING, OUTPUT, and POSTROUTING

Fourth, ipstables syntax

View ipstables rules: ipstables -nvL

 

iptables -F clears the rules

 restart rule

 

service ipstables save saves the current rules to the configuration file

View the configuration file, showing the default rules

 

ipstables -t filter -t specifies the table

 

 

ipstables -Z can clear the counter

[root@davery ~]# iptables -I INPUT -p tcp --dport 80 -j DROP insert

[root@davery ~]# iptables -D INPUT -p tcp --dport 80 -j DROP delete

iptables -nvL --line-numbers

 

iptables -D INPUT 1

iptables -D INPUT DROP

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325880976&siteId=291194637