1. dns 服務
named.conf 配置文件 和 地址庫文件解析:
/etc/named.conf 服務的配置文件:
options {
listen 53 {ip };
directory {/var/named}; 地址庫文件
allow {};
}
zone 'tedu.cn' IN {
type 'master';
file 'tedu.cn.zone';
}
/var/named/ 地址庫文件:
$TTL 86400
@ IN SOA @ root.tedu.cn. {
更新序號
重試時間
刷新間隔
失效時間
}
@ IN NA ns.tedu.cn
ns IN A 192.168.90.109
www IN A 192.168.90.1
A 正向, PTR 反向。
ack "mylan" {
ip1,ip2}
view "聯通" {
match-clients { mylan };
zone "tedu.cn" IN {
file "filepath";
} ; }
2. kvm
工具:virt-manager 存儲位置 加 系統安裝包 ,構成了一臺虛擬機
kvm 是紅帽的,virsh 命令來管理虛擬機
virsh nodeinfo ,virsh list ,virsh start a,virsh destory all ,
kvm 虛擬機組成 配置文件 + 磁盤文件
virsh-clone -o a -n b -f file
3.iptables
-m state --status NEW,ESTABLISHED
-m mac --mac-source
-m multiport --sports --dports port1:port10 連續,port11,port14 分別
-m iprange --src-range ip-ip --dst-range ip1-ipn
-p tcp --dport --sport
-s 192.168.90.0/24
iptables -t nat -A POSTROUTING -s 192.168.90.0/24 -o eth1 -j SNAT --to-source 173.1.1.1 / -j MASQUERADE
iptables -t nat -A PREROUTING -d 173.1.1.1 -i eth1 -p tcp --dport 80 -j DNAT --to-destination 192.168.90.9 端口換就加端口,端口不變可以不加。 --to-destination 172.16.90.09:8000
-i 如網卡 -o 出網卡 -s -d ip
iptables-save > iptables-restore<
4. rsync
rsync -a source/ desc/ 只同步source 下的文件,不包含source 目錄
rsync -a source desc 同步source 目錄及下面的文件和目錄
-v 顯示詳情, --delete 刪除目標文件內多餘的文檔,-v 傳輸過程中壓縮 ,
rsync file root@ip:file 上行
rsync root@ip:file file 下行
與rsync 服務器同步,服務器配置允許訪問的用戶名和密碼,以及同步的目錄
rsync --password-file=/password [email protected]::file /tmp
password-file 是 rsync 客戶端的密碼,裏邊放的是 user 賬戶對應的密碼,免除交互,file 是 rsync 服務端配置的允許同步的目錄之一。
inotify + rsync
inotifywait -m 啓用監控 -r 遞歸目錄 -q quite,-e 監控的事件類型
/bin/bash
target=/opt
rsy=rsync -az /opt/ /tmp
inotifywait -rmq -e move,create,delete,modify,attrib /top| while read x y z
do
$rsy
done