2013年4月30日 星期二

DHCP IPv6

網頁:https://www.isc.org/software/dhcp/

手動安裝方式:
安裝版本:DHCP 4.2.5-P1
系統環境:CentOS 6.4
環境需求:
yum install gcc
安裝方式:
#./configure
#make
#mkae install
執行檔位置:/usr/local/sbin/dhcpd
設定檔位置:/usr/local/etc/dhcpd.conf 
( 如果同一台機器同時提供IPv6和IPv4的dhcpd服務執行檔同一支daemon 但設定檔要分開 )

執行指令:
  • IPv6
dhcpd -6 -cf /etc/dhcpd6.connf
  • IPv4
dhcpd -4 -cf /etc/dhcpd.connf

yum 方式安裝:
安裝版本:DHCP 4.1.1
系統環境:CentOS 6.4
安裝方式:
yum install dhcp
 設定檔位置:
  • IPv4
/etc/dhcp/dhcp.conf
  • IPv6
/etc/dhcp/dhcp6.conf
服務啟動 :
  •  IPv4
service dhcpd start
  • IPv6
service dhcpd6 start
說明:
dhcpd和dhcpd6 的啟動的script 中透過指令"diff /etc/init.d/dhcpd  /etc/init.d/dhcpd6"可以看到兩者都是透過dhcpd 執行 ,差別在於執行的參數( -4和 -6 )和設定檔的不同。
dhcpd6 的script 中 lease 檔案位於 /var/lib/dhcpd/dhcpd6.lease ,如果要放到/var/db 下 要修正 script內容。

範例 sample位置 :
/usr/share/doc/dhcp*/dhcpd6.conf.sample

default-lease-time 2592000;
preferred-lifetime 604800;
option dhcp-renewal-time 3600;
option dhcp-rebinding-time 7200;
allow leasequery;

option dhcp6.name-servers 3ffe:501:ffff:100:200:ff:fe00:3f3e;
option dhcp6.domain-search "test.example.com","example.com";
option dhcp6.info-refresh-time 21600;
dhcpv6-lease-file-name "/usr/local/var/db/dhcpd6.leases";

host myclient {
        host-identifier option
                dhcp6.client-id 00:01:00:01:00:04:93:e0:00:00:00:00:a2:a2;
        fixed-address6 3ffe:501:ffff:100::1234;
        fixed-prefix6 3ffe:501:ffff:101::/64;
        option dhcp6.name-servers 3ffe:501:ffff:100:200:ff:fe00:4f4e;
}

host otherclient {
        hardware ethernet 01:00:80:a2:55:67;
        fixed-address6 3ffe:501:ffff:100::4321;
}
subnet6 3ffe:501:ffff:100::/64 {
        range6 3ffe:501:ffff:100::10 3ffe:501:ffff:100::11;
        range6 3ffe:501:ffff:100:: temporary;
        prefix6 3ffe:501:ffff:100:: 3ffe:501:ffff:111:: /64;
}

subnet6 3ffe:501:ffff:101::/64 {
        range6 3ffe:501:ffff:101::10 3ffe:501:ffff:101::11;
        option dhcp6.name-servers 3ffe:501:ffff:101:200:ff:fe00:3f3e;
}

subnet6 3ffe:501:ffff:102::/64 {
        range6 3ffe:501:ffff:102::10 3ffe:501:ffff:102::11;
}

DHCPv6 message
DHCPv6 message

DHCPv6 server log

 dhcpd: Internet Systems Consortium DHCP Server 4.1.1-P1
 dhcpd: Copyright 2004-2010 Internet Systems Consortium.
 dhcpd: All rights reserved.
 dhcpd: For info, please visit https://www.isc.org/software/dhcp/
 dhcpd: Wrote 0 deleted host decls to leases file.
 dhcpd: Wrote 0 new dynamic host decls to leases file.
 dhcpd: Wrote 0 leases to leases file.
 dhcpd: Bound to *:547
 dhcpd: Listening on Socket/5/eth0/2001:288:2274:5::/64
 dhcpd: Sending on   Socket/5/eth0/2001:288:2274:5::/64
 dhcpd: Solicit message from fe80::853b:3223:1d42:98b4 port 546, transaction ID 0xA791A600
 dhcpd: Sending Advertise to fe80::853b:3223:1d42:98b4 port 546
 dhcpd: Request message from fe80::853b:3223:1d42:98b4 port 546, transaction ID 0xA791A600
 dhcpd: Sending Reply to fe80::853b:3223:1d42:98b4 port 546

2013年4月22日 星期一

syslog-ng安裝

syslog-ng  網頁http://www.balabit.com/
詳細參考資料Administrator Guide
安裝版本syslog-ng open source edition
系統環境CentOS 6.4
環境需求
EventLog library ( eventlog_0.2.12.tar.gz )
tar xvfz eventlog-_0.2.12+20120504+1700.tar.gz
cd eventlog-0.2.12+20120504+1700
./configure
make && make install
gcc , flex , bison , glib,glib2-devel


、介紹
syslog-ng是一個彈性和可擴充性的日誌系統 ,可以建立集中化的日誌機制。 syslog-ng 有三個版本Open Source Edition、Premium Edition和硬體式的Store Box。


在Linux 上原有的Syslog 記錄到 秒 的等級,syslog-ng的3.4版本之後 (syslog-ng Open Source Edition)可以記錄到 毫秒(ms)和 微秒(µs)的等級。
、安裝
需要套件 glib2-devel
#tar zxvf syslog-ng_3.4.1.tar.gzcd syslog-ng_3.4.1
#export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:$PKG_CONFIG_PATH
#cd syslog-ng-3.4.1
#./configure --enable-ipv6
#make
#make install
三、設定
原有CentOS6.4 的rsyslog 服務要停掉。 
# chkconfig rsyslog off
設定檔位於 /usr/local/etc/syslog-ng.conf概念上是 client-serever 的架構
server 範例

@version: 3.4
@include "scl.conf"

source s_local {
        system();
        internal();
};
 
source s_network {
        udp();
        udp6();

};


template my_template {
        template("$DATE.$USEC $MSG\n"); template_escape(no);
};
destination d_local {
        file("/var/log/messages" template(my_template));
};
##
使用時透過範例template 中加入  $MSEC 或 $USEC,讓寫入紀錄的log可以參考到這個template
##
log {
        source(s_local);
        # uncomment this line to open port 514 to receive messages
        #source(s_network);
        destination(d_local);
};

log {
        source(s_network6);
        destination(d_local);
};


說明
USECC_USECR_USECS_USEC
微秒(microsecond)

C_USEC when syslog-ng OSE processes the message
R_USEC syslog-ng OSE has received the message ( syslog-ng 收到syslog的時間 )
S_USECthe message sent by the original application(  syslog發送的的時間  )
client 範例 ( rsyslog ):
*.*               @[2001:288:2274:5::250]
local6.*      @[2001:288:2274:5::250]