10月25日任務
10.11 Linux網(wǎng)絡相關
ifconfig在centos6里面有
ifconfig -a 在網(wǎng)卡down下也是可以查看的
7里面需要先安裝 yum install net-tools
ip add 查看
ifdown ens33 無法在遠程上面使用,否則會斷掉
首先要ifup ens33
ifdown ens33 ifup ens33
主要是針對某一指定網(wǎng)卡進行重啟,不需要全部重啟
不能在遠程連接下使用ifdown ens33
可以這樣操作 ifdown ens33 && ifup ens33 聯(lián)合起來使用
還可以給虛擬網(wǎng)卡增加ip
配置文件中不要脫義:

lvs keepalived 會使用到虛擬網(wǎng)卡
如何看網(wǎng)卡是否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 命令
部分企業(yè)使用的linux的防火墻可能是舊版本。
一般都是關閉狀態(tài)下。
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 如果已經(jīng)清空了的話,實際上是沒有了
重啟服務器或者iptables。都會重新加載iptables里面的規(guī)則?
iptables -t filter 不加t 就是默認的表
iptables -Z 計數(shù)器清零
DROP扔掉(數(shù)據(jù)包不看)/REJECT拒絕掉(數(shù)據(jù)包看下 再拒絕掉)
一般DROP比較多
iptables -A 增加

iptables -I 插入,插隊;-A排隊;-D刪除規(guī)則
在前面的話 優(yōu)先過濾前面的規(guī)則

-P 默認的策略
一般不要改動,一旦改動需要從服務器主機重新啟動鏈接shell
擴展(selinux了解即可)
1. selinux教程 http://os.51cto.com/art/201209/355490.htm
2.selinux pdf電子書 http://pan.baidu.com/s/1jGGdExK