2011年12月16日 星期五

CIDR (Classless Inter-Domain Routing)


[ N * Class_C Cases]:
  1. A.B.C.0/24 ::= A.B.C.0 255.255.255.0 :: 11111111.11111111.11111111.0 (1 setgment)
  2. A.B.C.0/23 ::= A.B.C.0 255.255.254.0 :: 11111111.11111111.11111110.0 (2 setgment)
  3. A.B.C.0/22 ::= A.B.C.0 255.255.252.0 :: 11111111.11111111.11111110.0 (4 setgment)
  4. A.B.C.0/21 ::= A.B.C.0 255.255.248.0 :: 11111111.11111111.11111000.0 (8 setgment)
  5. A.B.C.0/20 ::= A.B.C.0 255.255.240.0 :: 11111111.11111111.11110000.0 (16 setgment)
  6. A.B.C.0/19 ::= A.B.C.0 255.255.224.0 :: 11111111.11111111.11100000.0 (32 setgment)
  7. A.B.C.0/18 ::= A.B.C.0 255.255.192.0 :: 11111111.11111111.11000000.0 (64 setgment)
  8. A.B.C.0/17 ::= A.B.C.0 255.255.128.0 :: 11111111.11111111.10000000.0 (128 setgment)
  9. A.B.C.0/16 ::= A.B.0.0 255.255.0.0 :: 11111111.11111111.00000000.0 (256 setgment)

[ N * IP Cases]:
  1. A.B.C.D/32 ::= A.B.C.D 255.255.255.255 :: 11111111.11111111.11111111.11111111 (1 IP)
  2. A.B.C.D/31 ::= A.B.C.D 255.255.255.254 :: 11111111.11111111.11111111.11111110 (2 IP)
  3. A.B.C.D/30 ::= A.B.C.D 255.255.255.252 :: 11111111.11111111.11111111.11111110 (4 IP)
  4. A.B.C.D/29 ::= A.B.C.D 255.255.255.248 :: 11111111.11111111.11111111.11111000 (8 IP)
  5. A.B.C.D/28 ::= A.B.C.D 255.255.255.240 :: 11111111.11111111.11111111.11110000 (16 IP)
  6. A.B.C.D/27 ::= A.B.C.D 255.255.255.224 :: 11111111.11111111.11111111.11100000 (32 IP)
  7. A.B.C.D/26 ::= A.B.C.D 255.255.255.192 :: 11111111.11111111.11111111.11000000 (64 IP)
  8. A.B.C.D/25 ::= A.B.C.D 255.255.255.128 :: 11111111.11111111.11111111.10000000 (128 IP)
  9. A.B.C.0/24 ::= A.B.C.0 255.255.255.0 :: 11111111.11111111.11111111.00000000 (256 IP)

2011年12月14日 星期三

[FreeBSD]更改預設分析信件收件者


#vi /etc/mail/aliases
root: me@my.domain.com
#newaliases

"daily run output" 及 "security check output"會寄到指定的信箱。

USHA Pro 設定 Client


安裝client程式
Windows
1.執行 SD_USHA Service_4.20.exe
2.設定
IP Address: 輸入 USHA 卡的 IP位址(非本機電腦位址)
Client Name: 識別名稱,自己取或電腦抓
Shutdown Delay: 延遲關機時間



Linux:
# tar xvf SD_LINUX_4_20_USHA.tar 
# ./install.sh 

# vi /etc/uGuard.conf
RemoteHostIP = 0.0.0.0

ClientName = YourClientName
ShutdownDelay = 120
AcFail = 1   
BatteryLow = 1 

# /etc/uGuard -s  // 啟動

其他常用指令
# /etc/uGuard -h    // 看help
# /etc/uGuard -s  // 啟動
# /etc/uGuard -p // 看設定資訊
# /etc/uGuard -e // 編輯設定


Shutdown Delay 時間
斷電開始時間 + Shutdown Delay = 執行電腦關機
ex:
斷電時間 12:00
Shutdown Delay 為 120s
電腦關機時間就是 12:02



查看UPS連接設備
監控UPS → 連接設備表格

[CentOS]查看 CentOS 版本


1.查看linux kernel 版本
$uname -r
2.查看centos版本
$cat /etc/redhat -release

3.查看php版本
$php -v
4.查看mysql版本
$mysql -v

5.查看apache版本
 5-1 $rpm -qa httpd

2011年11月16日 星期三

[CentOS]安裝篇

1.取消所有預設的安裝
2.開始安裝
3.useradd and passwd 
4.修改 ssh 登入權限
    #cp /etc/ssh/sshd_config /etc/ssh/sshd_config.bak
    #vi /etc/ssh/sshd_config
    PermitRootLogin no
    AllowUsers Username

    #在檔案最後面加上這一行,這樣就只有 sysadm 可以使用 ssh 連線了
    #若要設定多人,就用空格隔開:AllowUsers User1 User2

    #/etc/init.d/sshd restart
    
    
5.更新
    #yum update
    #yum install wget squid gcc gcc-c++ make

6.關閉 SELinux
    #rm /etc/rc3.d/S08iptables(Disable iptables)
    #vi /etc/selinux/config
    SELINUX=disabled 

ASP + LDAP 認證

主要是 strvaliddn 參數,請參考貴單位的設定。

<%
struser= "user帳號"
strpwd= "user密碼"
strvaliddn= "cn=" & struser & ",ou=unit,o=users"
strservername="192.xx.xx.xx:389"


Set conn = CreateObject("ADODB.Connection")
conn.Provider = "ADsDSOObject"
conn.Open "ADs Provider", strvaliddn, strpwd

Set objldap = CreateObject("ADODB.Command")
objldap.ActiveConnection = conn
on error resume next
objldap.CommandText = "Select cn FROM 'LDAP://" & strservername & "/" & strvaliddn & "' "
set rs = objldap.Execute

If rs.eof or rs.bof then 
   authresult="N"
else
   authresult="Y"
end if

response.write authresult
set objldap=nothing
set rs=nothing
Set conn=nothing
%> 

清掉所有使用的網路連線帳號密碼

Windows
CMD

net use * /Delete /Y