1.[開始]->[群組原則管理]
2.點選[Default Domain Policy]->右邊[設定]分頁簽
3.點開[安全性設定]->[帳戶原則/密碼原則]->案右鍵編輯
4.展開[電腦設定]>[原則]>[Windows設定]>[安全性設定]>[帳戶原則]>[密碼原則]
蒼穹 發表在 痞客邦 留言(0) 人氣(4,354)
當架好Ubuntu Linux後,可以進階使用Iptables功能,將Ubuntu變成一台Router並對應到內部的IP開放相關服務,如[ftp][www]...等等。
環境介紹:
Server端
兩張網卡:當然你也可以將一張網卡給兩個IP
eth0:192.168.10.10 ===>外部IP
eth1:192.168.20.10 ===>內部IP(所有內網LAN透過這IP當作Gateway出去)
PC端網路卡設定
IP Address:192.168.20.20
Gateway:192.168.20.10
Server設定如下所示:
一、將以下這段文字寫入rc.local檔案,這樣重新啟動Linux就會載入這些設定。
#vim /etc/rc.local
#!/bin/sh
##### iptables.rule #####
EIF="eth0" # 對外的網路介面
IIF="eth1" # 對內的網路介面
INNET="192.168.20.0/24" # 內部子網域
# forwarding
# 讓內部網路的封包可以轉送到外部
echo "1" > /proc/sys/net/ipv4/ip_forward
# flush all rules
iptables -F
iptables -X
iptables -t nat -F
iptables -t nat -X
# 定義 policy
# Policy指的是當進來的封包不屬於rule中的任何一條時,所預設的動作。
iptables -P INPUT DROP
iptables -P OUTPUT ACCEPT
iptables -P FORWARD ACCEPT
# localhost
iptables -A INPUT -i lo -j ACCEPT
iptables -A OUTPUT -o lo -j ACCEPT
# 讓主機主動建立的連線可以進來
iptables -A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
# 設定主機上提供的服務可讓外部網路存取
iptables -A INPUT -i $EIF -p tcp --dport 22 -j ACCEPT # ssh
iptables -A INPUT -i $EIF -p udp --dport 22 -j ACCEPT
iptables -A INPUT -i $EIF -p tcp --dport 80 -j ACCEPT # http
# NAT 內部區域透過NAT瀏覽外網
iptables -t nat -A POSTROUTING -o $EIF -s $INNET -j MASQUERADE
#將80port對應到內部IP 192.168.20.20
iptables -t nat -A PREROUTING -p tcp -i $EIF --dport 80 -j DNAT --to-destination 192.168.20.20:80 # WWW
二、重新啟動Linux
#sudo reboot
測試看看是否只有提供ssh與www服務而已,開啟IE連接192.168.10.10,應該會導入到192.168.20.20的網頁。
蒼穹 發表在 痞客邦 留言(4) 人氣(13,188)
當重新啟動DNS時會發生rndc: connect failed: 127.0.0.1#953: connection refused 錯誤訊息,解決方式
1.重新產生檔案
$rndc-confgen > /etc/rndc.conf
如下
# key "rndc-key" {
# algorithm hmac-md5;
# secret "ozs3jAYNxzKNPmy4GJFqKA==";
# };
2.把上面這段取代掉/etc/bind/rndc.key理面的key "rndc-key"的內容,以前的註解掉
$vim /etc/bind/rndc.key
#key "rndc-key" {
# algorithm hmac-md5;
# secret "Ed3VmzsCSMSGLJts09IxEw==";
#};
#=======把上面以前的註解掉===========
key "rndc-key" {
algorithm hmac-md5;
secret "ozs3jAYNxzKNPmy4GJFqKA==";
};
#==========用上面這段取代===========
3.重新啟動DNS
$/etc/init.d/bind9 restart
另一個方式
1.查看DNS配置問題,用下面的指令查看
$named -g
/etc/bind/rndc.key: permission denied
$chmod 644 /etc/bind/rcnd.key
$named -g
OK
蒼穹 發表在 痞客邦 留言(0) 人氣(3,738)
有時候我們會備份相關資料如/etc資料夾 or 網站資料 or 資料庫,這時可以使用 tar+ logrotate 加入排程讓系統備份7天的資料
1.排程備份/etc資料夾 and /var/www資料夾,壓縮後放到/backup 資料夾內
#crontab -e
0 1 * * * tar zcvf /backup/etc.tar.gz /etc/ > /dev/null 2>&1
0 1 * * * tar zcvf /backup/www.tar.gz /var/www/ > /dev/null 2>&1
2.建議規則檔案,備份七天檔案並循環
#vim /etc/backup.conf
/backup/*gz {
missingok
notifempty
sharedscripts
postrotate
endscript
rotate 7
}
3.加入排程自動做
#crontab -e
58 0 * * * logrotate -f /etc/backup.conf > /dev/null 2>&1
4.完成。記得去/backup/檢查看看
蒼穹 發表在 痞客邦 留言(0) 人氣(2,493)