我不明白BADIPS=$(egrep -v "^#|^$" $tDB)。你能解释一下吗?完整代码:
#!/bin/bash
# Purpose: Block all traffic from AFGHANISTAN (af) and CHINA (CN). Use ISO code. #
# See url for more info - http://www.cyberciti.biz/faq/?p=3402
# Author: nixCraft <www.cyberciti.biz> under GPL v.2.0+
# -------------------------------------------------------------------------------
ISO="af cn"
### Set PATH ###
IPT=/sbin/iptables
WGET=/usr/bin/wget
EGREP=/bin/egrep
### No editing below ###
SPAMLIST="countrydrop"
ZONEROOT="/root/iptables"
DLROOT="http://www.ipdeny.com/ipblocks/data/countries"
cleanOldRules(){
$IPT -F
$IPT -X
$IPT -t nat -F
$IPT -t nat -X
$IPT -t mangle -F
$IPT -t mangle -X
$IPT -P INPUT …Run Code Online (Sandbox Code Playgroud) 我尝试bind在 Ubuntu 中设置DNS。
我有两台机器:
机器 A 是客户端:
IP: 192.168.190.176
hostname: example.com
Run Code Online (Sandbox Code Playgroud)
机器 B 是 DNS 服务器:
IP: 192.168.190.171
Run Code Online (Sandbox Code Playgroud)
在 DNS 服务器中:
/etc/bind/named.conf.local:
zone "example.com" {
type master;
file "/etc/bind/db.example.com";
};
//reverse zone
zone "190.168.192.in-addr.arpa" {
type master;
file "/etc/bind/db.192";
};
Run Code Online (Sandbox Code Playgroud)
/etc/bind/db.example.com:
$TTL 604800
@ IN SOA example.com. root.example.com. (
2 ; Serial
604800 ; Refresh
86400 ; Retry
2419200 ; Expire
604800 ) ; Negative Cache TTL
;
@ IN NS example.com.
@ IN A 192.168.190.176 …Run Code Online (Sandbox Code Playgroud)