2018.5.8 seven weeks three lessons (FIREWALLD and Netfilter,iptables grammar)

Source: Internet
Author: User
Tags nameserver

Linux Network related CentOS version 6, if you want to use Ifconfig to install a net-tools
     [[email protected] ~]# yum install -y net-tools
Turn off a network card
    [[email protected] ~]# ifdown ens33
Turn on the NIC
    [[email protected] ~]# ifup ens33
Restart the NIC
    [[email protected] ~]# ifdown ens33 && ifup ens33
Add a virtual network card
    [[email protected] ~]# cd /etc/sysconfig/network-scripts/    [[email protected] network-scripts]# cp ifcfg-ens33 ifcfg-ens33\:0    #进入到配置文件,拷贝一份IP目录,然后修改名为ens33:0,这里的“\”是为了脱义冒号
Modify the configuration file for the virtual network card
    [[email protected] network-scripts]# vi ifcfg-ens33:0    这里就编辑三个地方就可以,NAME和DEVICE还有IP地址    然后重启网卡:    [[email protected] network-scripts]# ifdown ens33 && ifup ens33


Added successfully.
See if a network card is plugged in.
    [[email protected] network-scripts]# mii-tool ens33 #后面跟网卡的名字    ens33: negotiated 1000baseT-FD flow-control, link ok #看看后面是不是ok
Modify host name Hostnamectl Set-hostname zhang-01
    [[email protected] ~]# hostnamectl set-hostname zhang-01    [[email protected] ~]# bash #打开一个子shell看下是否修改成功    
DNS configuration file in/etc/resolv.conf
    [[email protected] ~]# cat /etc/resolv.conf     # Generated by NetworkManager    nameserver 119.29.29.29    nameserver 114.114.114.114
Firewalld and NetFilter (firewall)
Linux防火墙-netfilter:selinux临时关闭 setenforce 0 selinux永久关闭 vi /etc/selinux/config centos7之前使用netfilter防火墙 centos7开始使用firewalld防火墙 关闭firewalld开启netfilter方法 systemctl stop firewalld 服务关掉 systemctl disable firewalled 关闭firewalled 不让开机启动 yum install -y iptables-services 如果再开启firewalled需要安装一个包 systemctl enable iptables  systemctl start iptables 开启
Permanently shut down the firewall, edit the configuration file selinux=enforcing modify to Disabled
    

View Iptables Services
    [[email protected] ~]# iptables -nvL #可以查看里面默认的规则 5表5列
Linux firewall-netfilter
netfilter的5个表 filter表用于过滤包,最常用的表,有INPUT、FORWARD、OUTPUT三个链 nat表用于网络地址转换,有PREROUTING、OUTPUT、POSTROUTING三个链 managle表用于给数据包做标记,几乎用不到 raw表可以实现不追踪某些数据包,阿铭从来不用

2018.5.8 seven weeks three lessons (FIREWALLD and Netfilter,iptables grammar)

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.