dns view 功能初步了解

December 13th, 2009 nomyself No comments

最近,一直忙着写毕业论文,没时间写blog,下面这段时间要好好整理下。

bind9的view功能可以根据不同的地区,不同的客户端解析为不同的ip地址。在中国国,常用于解决南北互通问题。

这篇文章只是基本了解下view功能,大牛直接无视(指点下更好^_^)。配置的前提是dns已经能够跑起来了。

1:首先,在named.conf中添加如下配置。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
include  "cnc_acl.conf";
include  "telecom_acl.conf";
 
view "view_cnc"
{
	match-clients
	{
		CNC;
	};
	zone "."
	{
		type hint;
		file "/etc/named.root";
	};
	zone "test.com"
	{
		type master;
		file "cnc/test.com";
	};
};
 
view "view_telecom"
{
	match-clients
	{
		TELECOM;
	};
	zone "."
	{
	type hint;
	file "/etc/named.root";
	};
	zone "test.com"
	{
		type master;
		file "telecom/test.com";
	};
};

2:编辑cnc_acl.conf和telecom_acl.conf,此处为了测试,所有数据自定义。

1
2
3
4
5
6
7
8
9
10
[root@centos etc]# cat ../var/named/cnc_acl.conf 
acl "CNC"
{
	192.168.0.20;
};
[root@centos etc]# cat ../var/named/telecom_acl.conf 
acl "TELECOM"
{
	192.168.0.1;
};

3:编辑test.com域名文件

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
[root@centos etc]# cat ../var/named/cnc/test.com 
$TTL 3600
$ORIGIN test.com.
@ IN SOA         ns.test.com.    root.ns.test.com. (
                  2008080901;       Serial
                  3600      ;       Refresh ( seconds )
                  900       ;       Retry ( seconds )
                  68400     ;       Expire ( seconds )
                  15        ;       Minimum TTL for Zone ( seconds )
                  )
@         IN     NS      ns.test.com.
ns         IN      A       192.168.0.20
www       IN      A        1.1.1.1
[root@centos etc]# cat ../var/named/telecom/test.com 
$TTL 3600
$ORIGIN test.com.
@ IN SOA         ns.test.com.    root.ns.test.com. (
                  2008080901;       Serial
                  3600      ;       Refresh ( seconds )
                  900       ;       Retry ( seconds )
                  68400     ;       Expire ( seconds )
                  15        ;       Minimum TTL for Zone ( seconds )
                  )
@         IN     NS      ns.test.com.
ns         IN      A       192.168.0.20
www       IN      A        2.2.2.2

4:测试使用ip为192.168.0.1和192.168.0.20的机器测试

1
2
3
4
[root@centos ~]# dig @192.168.0.20 www.test.com +short
1.1.1.1
(137)code@ ~$ dig @192.168.0.20 www.test.com +short
2.2.2.2

参考文章:
http://blog.chinaunix.net/u/27493/showart_222474.html
http://blog.bjchild.com/user0707/enigma1981/archives/2009/36614.html

Categories: Linux, bind Tags:

cacti 监控 windows xp

November 1st, 2009 nomyself No comments

上篇文章已经安装好了cacti监控环境,如果没有安装,先参考安装.

环境:centos 5.4 + virtualbox + xp

首先,这个监控是基于snmp协议的,所以xp上必须安装snmp。
install snmp

进行配置snmp
snmp config

cacti监控添加设备,成功后可以看见主机信息.
graphs conf

Categories: Linux Tags: ,

yum install cacti on centos 5.4

October 31st, 2009 nomyself No comments

添加仓库

1
2
3
4
5
6
[dag]
name=Dag RPM Repository for Red Hat Enterprise Linux
baseurl=http://apt.sw.be/redhat/el$releasever/en/$basearch/dag
gpgcheck=0
enabled=1
protect=0

安装

1
yum install net-snmp net-snmp-utils mysql mysql-server cacti

编辑cacti.conf,修改deny规则

1
2
3
4
5
6
7
8
9
10
11
12
13
[root@cacti ~]# cat /etc/httpd/conf.d/cacti.conf
Alias /cacti/ /var/www/cacti/
<Directory /var/www/cacti/>
    DirectoryIndex index.php
    Options -Indexes
    AllowOverride all
    order deny,allow
    deny from all
    allow from 127.0.0.1 192.168.0.0/24
    AddType application/x-httpd-php .php
    php_flag magic_quotes_gpc on
    php_flag track_vars on
</Directory>

启动服务,建立数据库

1
2
3
4
5
6
7
8
9
10
11
server mysqld start
server httpd start
chkconfig mysqld --level 345 on
chkconfig httpd --level 345 on
 
mysqladmin --user=root create cacti
mysql -u root cacti < /var/www/cacti/cacti.sql
mysql -u root
mysql> GRANT ALL ON cacti.* TO cactiuser@localhost IDENTIFIED BY ‘cactiuser’;
mysql> flush privileges;
mysql>exit

建立crontab,添加

1
*/5 * * * * cacti php /var/www/cacti/poller.php >/dev/null 2>&1

cacti-1

cacti-2

Categories: Linux Tags:

centos rsync 安装和使用

October 27th, 2009 nomyself No comments

RSYNC介绍:

rsync是个给Unix系统用的应用软件,它使从一个地方到另一个地方的文件与目录同步,并同时恰当的利用差分编码以减少数据传输。rsync的一个大部分类似程序或协议中所未见重要特性是镜像发生在每个方向只需要一次传送。rsync可拷贝/显示目录属性,以及拷贝文件,并可选择性的压缩以及递归拷贝。

在常驻模式(daemon mode),rsync监听默认TCP端口873,以本地rsync传输协议或者通过远程shell如RSH或者SSH伺服文件。在后面的SSH情况下,rsync客戶端运行程序必须安装在本地和远程机器上。—–来自wiki。

安装rsync:

1
2
3
4
5
6
7
8
[root@localhost ~]# rpm -qa | grep rsync
rsync-2.6.8-3.1
#如果没有安装
yum -y install rsync
 
#配置文件
[root@localhost ~]# rpm -q --configfiles rsync
/etc/xinetd.d/rsync

作为命令使用:

1
2
3
4
5
(34)code@ ~$ rsync -azv --delete nginx:~/log /tmp/rsync/
receiving file list ... done
 
sent 20 bytes  received 125 bytes  290.00 bytes/sec
total size is 23939  speedup is 165.10

配置成服务器:

适合没有开通ssh的。

1
2
3
4
5
6
mkdir /etc/rsyncd
cd /etc/rsyncd
touch rsyncd.{conf,motd,secrets}
chmod 600 rsyncd.secrets
[root@localhost rsyncd]# ls -l rsyncd.secrets 
-rw------- 1 root root 0 Oct 27 17:19 rsyncd.secrets

配置:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
[root@localhost ~]# more /etc/rsyncd/rsyncd.conf
 
address = 192.168.0.30
port = 873
pid file = /var/run/rsyncd.pid
uid = nobody
gid = nobody
use chroot = no
read only = yes
hosts allow = 192.168.0.0/255.255.255.0
hosts deny= *
 
log file = /var/log/rsync.log
transfer logging = yes
 
[test]
path = /root/log
auth users = root
list = no
uid = root
gid = root
ignore errors
secrets file = /etc/rsyncd/rsyncd.secrets
 
[root@localhost ~]# cat /etc/rsyncd/rsyncd.secrets 
root:test

测试:

1
2
3
4
5
6
7
8
9
10
(58)code@ /tmp$ rsync -azv rsync://root@192.168.0.30/test /tmp/test/
Password:
receiving file list ... done
./
anaconda-ks.cfg
install.log
install.log.syslog
 
sent 173 bytes  received 7020 bytes  2055.14 bytes/sec
total size is 23939  speedup is 3.33

参考:
http://samba.anu.edu.au/rsync/documentation.html

http://www.linuxfly.org/read.php?13

http://www.linuxsir.org/main/?q=node/256

Categories: Linux Tags:

简化firefox操作

October 25th, 2009 nomyself No comments

自从装了vimperator插件以后,firefox的空间就最大程度的呈现了。
但也有一些不方便的地方,那就是有些扩展需要展开menu菜单来点击。

为了更好更方便的使用,于是便开始google和参阅faq。还是找到了
一些解决办法的。

对应vimperator中的设置:

1
2
map <F4> <Esc>:tabopen chrome://fireftp/content/fireftp.xul<CR>
map <Leader>i <Esc>:tabopen chrome://chatzilla/content/chatzilla.xul<CR>

这样就方便打开fireftp和chatzilla了。
firefox近照:
screenshot_012

Categories: App Tags: