美文网首页
2018-10-25

2018-10-25

作者: 越来越好_1472 | 来源:发表于2018-10-25 23:36 被阅读0次

10月25日任务

10.11 Linux网络相关

ifconfig在centos6里面有

ifconfig -a 在网卡down下也是可以查看的

7里面需要先安装 yum install net-tools

ip add 查看

ifdown ens33 无法在远程上面使用,否则会断掉

首先要ifup ens33

ifdown ens33 ifup ens33

主要是针对某一指定网卡进行重启,不需要全部重启

不能在远程连接下使用ifdown ens33

可以这样操作 ifdown ens33 && ifup ens33 联合起来使用

还可以给虚拟网卡增加ip

配置文件中不要脱义:

lvs keepalived 会使用到虚拟网卡

如何看网卡是否link ok

mii - tool ens33

ethtool ens33 会显示link detect 显示yes or no

修改hostname

hostnamectl set-hostname aminglinux-001

修改后

输入bash

再exit再看

linux 和windows 都存在/etc /hosts

只在本机生效。linux上修改了,Windows没起作用

支持一个ip 对应多个域名

10.12 firewalld和netfilter

防火墙 在配置密钥认证的时候 要关闭selinux

setenfoce 0 临时关闭

vi /etc/selinux/config 编辑配置文件,永久关闭

centos5/6 使用的是netfilter

centos7 使用的是firewalld

实际上二者内部的工具iptables 命令

部分企业使用的linux的防火墙可能是旧版本。

一般都是关闭状态下。

centos7下默认使用firewalld,关闭的是netfilter

systemctl disable firewalld 

systemctl stop firewalld  停掉 安装包 打开以下

yum install -y iptables-service

systemvtl enable iptables

systemctl start iptables

iptables -nvL 查看内容

步骤

首先关闭

firewalld --> close/disable + stop

再开启

netfilter -- > open --> iptables-sevice -->enable iptables-->start iptables

防火墙实际上不是iptables(是工具) 正常应该是netfilter

10.13 netfilter5表5链介绍

man iptables

本机

非本机

10.14 iptables语法

cat /etc/sysconfig/iptabels

iptables -F清除

service iptables save 如果已经清空了的话,实际上是没有了

重启服务器或者iptables。都会重新加载iptables里面的规则 

iptables -t filter 不加t 就是默认的表

iptables -Z 计数器清零

DROP扔掉(数据包不看)/REJECT拒绝掉(数据包看下 再拒绝掉)

一般DROP比较多

iptables -A 增加

iptables -I 插入,插队;-A排队;-D删除规则

在前面的话 优先过滤前面的规则

-P 默认的策略

一般不要改动,一旦改动需要从服务器主机重新启动链接shell

扩展(selinux了解即可)

1. selinux教程 http://os.51cto.com/art/201209/355490.htm

2.selinux pdf电子书 http://pan.baidu.com/s/1jGGdExK

相关文章

网友评论

      本文标题:2018-10-25

      本文链接:https://www.haomeiwen.com/subject/hqlhtqtx.html