`
xitong
  • 浏览: 6210375 次
文章分类
社区版块
存档分类
最新评论

尚观第14天学习 DNS与iptables

 
阅读更多
主从dns:
主dns配置:
1).主DNS
zone "wing.com" IN
{
type master;
file "wing.com.zone";
notify yes; //当主DNS有更新是主动通告从DNS服务器
allow-transfer { 192.168.250.99; }; //允许谁更新我的zone
};


2).从DNS
zone "wing.com" IN
{
type slave;
file "slave.wing.com.zone";
masters { 192.168.250.250; };
};
主从加密:
先用下列命令做密码:
#dnssec-keygen -a hmac-md5 -b 128 -n HOST wingkey
1). 主dns:
key wingkey { //定义一个key
algorithm hmac-md5;
secret "BmGdrEJzYDFegy4wM8TBdQ==";
};
zone "wing.com" IN {
type master;
file "wing.com.zone";
allow-transfer { key wingkey; }; //使用key
};


2).从dns:
key wingkey {
algorithm hmac-md5;
secret "BmGdrEJzYDFegy4wM8TBdQ==";
};
zone "wing.com" IN {
type slave;
file "slave.wing.com.zone";
masters { 192.168.1.254 key wingkey; };
};


view视图:
options
{
directory "/var/named";
};


acl tel //定义电信的地址范围
{
172.168.0.0/24;
202.18.8.0/24;
};


acl uni //定义网通的地址范围
{
192.168.8.0/24;
191.168.9.0/24;
};


view TEL //定义视图
{
match-clients {tel;}; //匹配哪个acl
match-destinations {any;};
recursion no;
zone "wing.com" IN //电信区域的配置
{
type master;
file "tel.wing.com.zone"; //定义电信区域配置文件的名称
};
};
view UNI {
match-clients {uni;};
match-destinations {any;};
recursion no;
zone "wing.com" IN
{
type master;
file "uni.wing.com.zone";
};
};


子域授权:
修改主DNS区域配置文件
例如管理区域wing.com.的主机授权给下面的主机管理他的子域uplooking
uplooking.wing.com. IN NS dns.uplooking.wing.com.
dns.uplooking.wing.com. IN A 192.168.250.8


iptables:


内核态:netfilter
用户态:iptables








语法:
#iptables -t 表 动作 链 匹配规则 目标
#iptables -L -nv 查看 默认是filter表
#iptables -t nat -L 查看指定的表


简单例子:
#iptables -t filter -A INPUT -p icmp -j DROP






动作:
-A 添加一条规则


-I 插入一条规则


--line-number 查看的时候显示行号,一般和-L连用
[root@open ~]# iptables -I INPUT 2 -p tcp -j REJECT


-D 删除一条规则
[root@open ~]# iptables -D INPUT -p tcp -j REJECT
[root@open ~]# iptables -D INPUT 3


-F 清空规则
-F [chain] 清空指定的链里面的规则
-Z 清空计数




-R 替换一条规则
[root@open ~]# iptables -R INPUT 1 -s 192.168.100.8 -j REJECT


-N 自定义链
[root@open ~]# iptables -N wing
[root@open ~]# iptables -A wing -p icmp -j DROP
[root@open ~]# iptables -A INPUT -j wing

-E 修改自定义链
[root@open ~]# iptables -E wing WING

-X 删除自定义链


-P 修改默认规则
[root@open ~]# iptables -P INPUT DROP




表:raw mangle nat filter 从前往后依次查看
链:prerouting input forward output postrouting
从前往后依次查看


---------------->------------->----------------->
| raw: prerouting output
v
| mangle: prerouting input forward output postrouting
v
| nat: prerouting output postrouting
v
| filter: input forward output
v


匹配规则:
-s 源地址 -d 目标地址
--sport 源端口 --dport 目标端口
-p [tcp | udp | icmp]


[root@open ~]# iptables -A INPUT -p tcp --dport 22 -j DROP


目标:
-j [ ACCEPT | DROP | REJECT | LOG | 自定义的链 ]
-g 链名 跳转到某一个链从新开始匹配
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics