12/12/2011

更改ubuntu預設editor

#update-alternatives --config editor

提供“editor”的替換項式共有 4。

可使用的替換項目
===========================
*+ 1 /bin/nano
2 /bin/ed
3 /usr/bin/vim.basic
4 /usr/bin/vim.tiny

按下 enter 來指定預設選項[*],或者輸入選擇的號碼:3

4/20/2011

iptables 自動執行

step1:vim ~/iptables.sh
chmod 755 iptables.sh
step2:ln -s ~/iptables.sh /etc/init.d/iptables.sh
step3:update-rc.d -f iptables.sh defaults

down

重新抓取網路卡

rm /etc/udev/rules.d/70*
reboot

4/18/2011

查詢套件版本

dpkg -l | grep {software name}

4/17/2011

ubuntu 10.04 DNS 安裝設定

step1:apt-get install bind9
step2:vim /etc/bind/named.conf
include "/etc/bind/rndc.key";
include "/etc/bind/named.conf.options";
include "/etc/bind/named.conf.local";
//include "/etc/bind/named.conf.default-zones";
include "/etc/bind/named.conf.internal-zones";
include "/etc/bind/named.conf.external-zones";

step3:vim /etc/bind/named.conf.options
options {
directory "/etc/bind";
dump-file "/etc/bind/dump.db";
listen-on port 53 { any; };
allow-query { any; };
allow-transfer { xxx.xxx.xxx.xxx; }; //設定slave ip
recursion no;
version "U guess!";
};

step4:cp named.conf.default-zones named.conf.external-zones
view "external" {
match-clients {
any;
};
zone "." {
type hint;
file "db.root";
};
zone "test.com.tw" {
type master;
file "test.com.tw.wan";
allow-update { xxx.xxx.xxx.xxx; };//允許slave ip 更新
};
zone "xxx.xxx.xxx.in-addr.arpa" {
type master;
file "db.xxx.xxx.xxx";
allow-update { xxx.xxx.xxx.xxx; };
};
};

step5:cp db.0 test.com.tw.wan
$TTL 86400
@ IN SOA ns1.test.com.tw. root.test.com.tw (
1 ; Serial
604800 ; Refresh
86400 ; Retry
2419200 ; Expire
86400 ) ; Negative Cache TTL
;
@ IN NS ns1.test.com.tw.
@ IN NS ns2.test.com.tw.
@ IN MX 10 mail.test.com.tw.
ns1 IN A xxx.xxx.xxx.xxx
ns2 IN A xxx.xxx.xxx.xxx
mail IN A xxx.xxx.xxx.xxx

step6: cp db.0 db.xxx.xxx.xxx.xxx
$TTL 86400
@ IN SOA ns1.test.tw. root.test.com.tw. (
1 ; Serial
604800 ; Refresh
86400 ; Retry
2419200 ; Expire
86400 ) ; Negative Cache TTL
;
@ IN NS ns1.test.com.tw.
xx IN PTR ns1.test.com.tw.
xx IN PTR mail.test.com.tw.

step7:/etc/init.d/bind9 restart