2013年12月13日

建Gateway


If you’re trying to set up a home network, you probably want to set up a permiter facing computer connected to your DSL/Cable modem, and then put all of your computers behind that firewall box to keep them safe. This tutorial will show you how to use a single external connection on the gateway computer (using Iptables firewall), and a second internal connection on the same box so you can connect the computers on the inside of your home/office to it, and automatically give them IP’s when you hook them up (using DHCP server). Iptables can be very complicated, we will only configure a basic firewall, you can add more security later without breaking things. In Linux there are many ways to do this, this one is hopefully simple enough and will teach you the basics. I did this on a CentOS 6 box, though it would work on Debian variants with only slight modifications. During this tutorial I’m logged in as root, which you should generally NOT do, but it makes the tutorial simpler, but if you prefer to do it more securely, add “sudo” before each command and it will work.
The computers on the inside of your office will also be able to talk to each other, so you can hook up printers, computers and share network connections through the switch as well. You can also set up things on your Gateway server box later like a network backup drive for all your computers using Samba relatively simply. There’s a lot of expandability in this setup, but we’ll keep it simple for now.
The first thing to do on your Gateway server is configure and enable Iptables, the default firewall that comes with CentOS. We will tell it to allow outbound traffic from your eth1 interface to the internet. You have to add an Iptables entry, save it and restart Iptables.
Step 1. Add 2 Network cards to the Linux box
Step 2. Verify the Network cards, check if they installed properly or not
Step 3. Configure eth0 for Internet with a Public (External network or Internet)
# vi /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
BOOTPROTO=static
HWADDR=00:0c:29:d2:c2:75
IPADDR=192.168.1.10
BROADCAST=192.168.1.255
NETMASK=255.255.255.0
NETWORK=192.168.1.0
GATEWAY=192.168.1.1
DNS1=8.8.8.8
DNS2=8.8.4.4
ONBOOT=yes
TYPE=Ethernet
USERCTL=no
IPV6INIT=no
PEERDNS=yes
Step 4. Configure eth1 for LAN with a Private IP (Internal private network)
# vi /etc/sysconfig/network-scripts/ifcfg-eth1
DEVICE=eth1
BOOTPROTO=static
HWADDR=00:0c:29:d2:c2:7f
IPADDR=192.168.10.1
BROADCAST=192.168.10.255
NETMASK=255.255.255.0
NETWORK=192.168.10.0
GATEWAY=192.168.1.10       # Enter Ip of eth0
ONBOOT=yes
TYPE=Ethernet
USERCTL=no
IPV6INIT=no
PEERDNS=yes
If you get error can’t bringing up interface eth1, and type:
# service NetworkManager stop
# chkconfig NetworkManager off
# service network start
# chkconfig network on
Step 5. Host Configuration (Optional)
# vi /etc/hosts
 
127.0.0.1 nat localhost.localdomain localhost
Step 6. Gateway Configuration
# vi /etc/sysconfig/network
NETWORKING=yes
HOSTNAME=nat
GATEWAY=192.168.1.1  # Internet Gateway, provided by the ISP
Step 7. DNS Configuration
# vi /etc/resolv.conf
nameserver 8.8.8.8 # Primary DNS Server provided by the ISP
nameserver 8.8.4.4 # Secondary DNS Server provided by the ISP
Step 8. Configure DHCP server to give out the IP’s to the computers on the inside of the LAN
We do that by installing the DHCP server like this:
# yum install dhcp
# vi /etc/dhcp/dhcpd.conf
option domain-name    "vjetnamnet.com";
option domain-name-servers 8.8.8.8, 8.8.4.4;
default-lease-time 600;
max-lease-time 7200;
ddns-update-style none;
authoritative;
subnet 192.168.10.0 netmask 255.255.255.0 {
  range dynamic-bootp 192.168.10.10 192.168.10.20;
  option broadcast-address 192.168.10.255;
  option routers 192.168.10.1;
}
Step 9. NAT configuration with IP Tables
First of all you have to flush and delete existing firewall rules. So flush rules by typing in terminal:
# iptables -F
 
# iptables -t nat -F
 
# iptables -t mangle -F
Now delete these chains:
# iptables -X
 
# iptables -t nat -X
 
# iptables -t mangle -X
Set up IP FORWARDing and Masquerading
# iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
 
# iptables -A FORWARD -i eth1 -j ACCEPT
Enables packet forwarding by kernel (save this setting in /etc/sysctl.conf file)
# echo 1 > /proc/sys/net/ipv4/ip_forward
and edit to make the change permanent
# vi /etc/sysctl.conf
 
net.ipv4.ip_forward=1
Apply the configuration
# service iptables save
 
# service iptables restart
Check if iptables is set to start during boot up
# chkconfig --list iptables
Step 10. Testing
Ping the Gateway of the network from client system:
# ping 192.168.10.1
Try it on your client systems:
# ping google.com
Configuring PCs on the network (Clients)
All PC’s on the private office network should set their “gateway” to be the local private network IP address of the Linux gateway computer.
The DNS should be set to that of the ISP on the internet.

smtp test

[good@mail ~]$ telnet 140.116.16.16 25
# 使用 telnet 連線到目的 mail server 的 25 port ↑↑↑ 
Trying 140.116.16.16... 
Connected to 140.116.16.16 (140.116.16.16). 
Escape character is '^]'. 
220 mx1.localdomain ESMTP Postfix 
# 連線到目的主機的回應 ↑↑↑ 
helo mail.nsysu.edu.tw 
# 跟目的主機宣稱自己是誰 ↑↑↑ 
250 mx1.localdomain 
# 目的主機的回應 ↑↑↑ 
mail from: greenth@nsysu.edu.tw 
# 設定寄信者的 email ↑↑↑ 
250 2.1.0 Ok 
rcpt to:greenmow@hotmail.com.tw 
# 設定收件者的 email ↑↑↑ 
250 2.1.5 Ok
data 

# 使用 data 指令說明底下為信件內容 ↑↑↑ 
354 End data with .
subject: test mail from nsysu
test mail 20120919 15:46
greenth
.
# 使用 . 表示信件內容的結尾 ↑↑↑
250 2.0.0 Ok: queued as EAFE87FA04
quit
# 使用 quit 指令離開 ↑↑↑
221 2.0.0 Bye 
Connection closed by foreign host.

2013年4月23日

IBM相關文件位置

=========
 TSM相關
=========
IBM Tivoli Storage Manager 5.5 版說明文件
http://publib.boulder.ibm.com/infocenter/tivihelp/v1r1/index.jsp

IBM Tivoli Storage Manager Version 6.2 information center

http://pic.dhe.ibm.com/infocenter/tsminfo/v6r2/index.jsp


IBM Tivoli Storage Manager 6.3 版資訊中心
http://pic.dhe.ibm.com/infocenter/tsminfo/v6r3/index.jsp

Installing the Tivoli Storage Manager Linux x86_64 client
http://pic.dhe.ibm.com/infocenter/tsminfo/v6r3/index.jsp?topic=%2Fcom.ibm.itsm.client.doc%2Ft_inst_linuxx86client.html

Configure the Tivoli Storage Manager client
http://pic.dhe.ibm.com/infocenter/tsminfo/v6r3/index.jsp?topic=%2Fcom.ibm.itsm.client.doc%2Ft_inst_linuxx86client.html


ANS4042E Unrecognized characters during backup of data from Linux clients

http://www-01.ibm.com/support/docview.wss?uid=swg21290640

==========
 TS3500相關
==========
IBM System Storage TS3500 Tape Library Information Center
http://publib.boulder.ibm.com/infocenter/ts3500tl/v1r0/index.jsp?topic=%2Fcom.ibm.storage.ts3500.doc%2Fts3500_ichome.html

Resolving errors with the Ultrium tape drives
http://publib.boulder.ibm.com/infocenter/ts3500tl/v1r0/index.jsp?topic=%2Fcom.ibm.storage.ts3500.doc%2Fopg_3584_a69m4bfs0.html

TSM SQL常用語法

找尋還有哪些Volumes還是Scratch
SELECT STATUS, VOLUME_NAME FROM LIBVOLUMES WHERE STATUS='Scratch'

找尋有Error的Volumes
SELECT VOLUME_NAME, WRITE_ERRORS, READ_ERRORS FROM VOLUMES WHERE WRITE_ERRORS>1 OR READ_ERRORS>1

找尋沒有並置群組的Node
SELECT NODE_NAME,CONTACT,DOMAIN_NAME FROM NODES WHERE COLLOCGROUP_NAME IS NULL

找尋磁帶內有哪些Node資料
SELECT NODE_NAME, STGPOOL_NAME, VOLUME_NAME FROM VOLUMEUSAGE WHERE VOLUME_NAME='XXXXXX'

找尋磁帶內Node的詳細資料
SELECT FILE_NAME, FILESPACE_NAME, NODE_NAME, VOLUME_NAME FROM CONTENTS WHERE NODE_NAME='XXXXXX' AND VOLUME_NAME='YYYYYY'

找尋Node使用的磁帶
SELECT NODE_NAME, STGPOOL_NAME, VOLUME_NAME FROM VOLUMEUSAGE WHERE NODE_NAME='XXXXXX'

找尋檔案在哪捲磁帶
SELECT FILE_NAME, FILESPACE_NAME, NODE_NAME, VOLUME_NAME FROM CONTENTS WHERE FILE_NAME='AAA' AND FILESPACE_NAME='BBB' AND NODE_NAME='CCC' AND VOLUME_NAME='DDD'
!!!注意!!!,此指令耗費極久的搜尋時間


=============
  其餘相關指令
=============
SELECT DISTINCT =>橫列

DB2裡面需要查詢特定關鍵字則用%取代*
select * from VOLUMEUSAGE where node_name like '%NAGI%'

=============
 參考資料
=============
http://thobias.org/tsm/sql/index.html
http://www.tsmsql.com/query/5500/
http://www.lascon.co.uk/tsm-sql-queries.php#sqlnode

2013年4月21日

TSM client 啟動


nohup dsmc schedule 2> /dev/null &

tsmclient:2345:once:/usr/bin/dsmc sched > /dev/null 2>&1 # TSM scheduler

2012年9月19日

TSM4升級6.2.1 -> 6.2.4


因使用SQL語法無法顯示SpMg type欄,系統建議升級至6.2.3,目前最新為6.2.4,故升級之
http://www-01.ibm.com/support/docview.wss?uid=swg1IC70800

這次升級應該也會解決之前DB Backup link error情形

APAR status
Closed as program error.
Error description
When using SQL to query the OCCUPANCY table,  the columns

 - TYPE
 - FILESPACE_NAME
 - FILESPACE_ID

will be blank for file systems containing space managed data.

NODE_NAME: GPFS_CLUSTER
TYPE:                                            <====
FILESPACE_NAME:                                  <====
STGPOOL_NAME: SMSTGP
NUM_FILES: 1
PHYSICAL_MB: 8.19
LOGICAL_MB: 8.19
REPORTING_MB: 1512.65
FILESPACE_ID:                                    <====

A QUERY OCCUPANCY against the same file space produces the
expected results.

GPFS_CLUSTER SpMg /gpfsdata 2 SMSTGP 1 8.19 8.19
Local fix
Use QUERY OCCUPANCY instead of SELECT FROM OCCUPANCY.
Problem summary
****************************************************************
* USERS AFFECTED: All Tivoli Storage Manager server users.     *
****************************************************************
* PROBLEM DESCRIPTION: See ERROR DESCRIPTION.                  *
****************************************************************
* RECOMMENDATION: Apply fixing level when available. This      *
*                 problem is currently projected to be fixed   *
*                 in levels 6.1.5 and 6.2.3.                   *
*                 Note that this is subject to change at       *
*                 the discretion of IBM.                       *
****************************************************************
*
Problem conclusion
This problem was fixed.
Affected platforms: AIX, HP-UX, Sun Solaris, Linux, Windows .

2012年3月8日

來源 http://www-01.ibm.com/support/docview.wss?uid=swg27019794

以下為備份
Abstract
This document assists customers who want to use the Tivoli® Storage Manager V5.5 Operational Reporting feature with Tivoli Storage Manager V6 servers, before making the transition to the reporting and monitoring feature that is available in V6. The instructions for configuring V5.5 Operational Reporting to work with V6 servers are provided as is, and no additional support will be provided by IBM. See the full document for restrictions and instructions.
Content
Rules of use
Background information
Preparation
Modifying reports
Modifying monitors
Modifying custom reports
Rules of use
The instructions for configuring V5.5 Operational Reporting to work with V6 servers are provided as is. No additional support will be provided by IBM.
Follow the instructions to modify the V5.5 Operational Reporting feature to make the default reports and monitors work with V6.1 and V6.2 servers.
You may run both the V5.5 Operational Reporting feature and the V6.1 or V6.2 reporting and monitoring feature at the same time. However, you must install and run the features on different systems.
The V5.5 Operational Reporting feature cannot be installed on the same system as the V6.1 or V6.2 Management Console.
Apply the latest fix pack for the Tivoli Storage Manager V6.1 or V6.2 server to ensure that any available fixes are in place for SELECT statements or output.
V5.5 Operational Reporting is part of Tivoli Storage Manager V5.5 and as such, continues to be supported by IBM for use with V5.5 servers.
Back to top
Background information
Tivoli Storage Manager V6 introduces the reporting and monitoring feature, which has new, extensive reporting functions that replace Tivoli Storage Manager V5.5 Operational Reporting. The Tivoli Storage Manager V6 reporting and monitoring feature collects historical Tivoli Storage Manager data, so a separate server is required to run the feature. The Tivoli Storage Manager V6 reporting and monitoring feature supports reporting for both Tivoli Storage Manager V5.5 and V6 servers. For details, see Installing the reporting and monitoring feature.
Also introduced with Tivoli Storage Manager V6 is the change from a proprietary Tivoli Storage Manager database to a DB2® database. Because the DB2 program is the database manager, Tivoli Storage Manager V6 introduces fundamental changes to the database and recovery log architecture. The Tivoli Storage Manager database schema and the SELECT syntax also changed, both of which are used by Tivoli Storage Manager Operational Reporting. For information about the V6 changes, see Server database updates overview and Changes to the SELECT command.
Tivoli Storage Manager V5.5 Operational Reporting is part of the Tivoli Storage Manager Management Console for V5.5 servers, which runs only on Windows® systems. V5.5 Operational Reporting is not supported and not included with Tivoli Storage Manager V6. If a Tivoli Storage Manager V5.5 server on a Windows system is upgraded to Tivoli Storage Manager V6, the Tivoli Storage Manager V6 Management Console is installed without the Operational Reporting feature.
Without modification, the V5.5 Operational Reporting feature does not work with V6 servers. The default Custom Summary report sections in reports and monitors fail for a Tivoli Storage Manager V6 server, typically with error messages that cite syntax errors or references to columns that do not exist in the V6 server database. Customized reports might also fail.
Back to top
Preparation
To modify Tivoli Storage Manager V5.5 Operational Reporting to work with a Tivoli Storage Manager V6 server, the Tivoli Storage Manager V5.5 Management Console, which includes Operational Reporting, must be installed on a separate physical or virtual Windows device.
Important: After you make the changes that are described in this document, the reports and monitors that you modify will not work with a V5 server.
If you do not already have the Tivoli Storage Manager V5.5 Management Console installed on a separate physical or virtual Windows device, download the program and install it.
Go to the FTP site for V5.5 downloads for Windows systems: ftp://public.dhe.ibm.com/storage/tivoli-storage-management/maintenance/server/v5r5/WIN/LATEST
Download the file for the Tivoli Storage Manager V5.5 Management Console, which has a name like 5.5.x.x-TIV-TSMCON-Windows.exe, where the x.x are numbers that indicate the fix level.
Run the file that you downloaded to install the Tivoli Storage Manager V5.5 Management Console.
Configure Tivoli Storage Manager V5.5 Operational Reporting according to the instructions at this link: http://publib.boulder.ibm.com/infocenter/tivihelp/v1r1/index.jsp?topic=/com.ibm.itsmcw.doc/anrwgd55668.htm
Back up the default XML template files for reports and monitors:
C:\Program Files\Tivoli\TSM\console\default_rep_eng.xml
C:\Program Files\Tivoli\TSM\console\default_mon_eng.xml
Create a report XML template file to use for modification of reports by copying this file:
C:\Program Files\Tivoli\TSM\console\default_rep_eng.xml
Rename the copy of the file:
C:\Program Files\Tivoli\TSM\console\default_rep_eng_TSM6.xml
Create a monitor XML template file to use for modification of monitors by copying this file:
C:\Program Files\Tivoli\TSM\console\default_mon_eng.xml
Rename the copy of the file:
C:\Program Files\Tivoli\TSM\console\default_mon_eng_TSM6.xml
Back to top
Modifying reports
When first installed, Tivoli Storage Manager Operational Reporting contains a model template for a Daily Report. You must modify the Custom Summary report section of this Daily Report.
Start the Tivoli Storage Manager 5.5 Management Console: Start > All Programs > Tivoli Storage Manager > Management Console
Click Operational Reports and create a new report or update the properties of an existing report.
On the Report Details tab, select Custom Summary and click Settings.
Click Browse and select the report template file that you created in a previous step: C:\Program Files\Tivoli\TSM\console\default_rep_eng_TSM6.xml
Edit each of the following Select Variables, and modify the select statements.
LDBB (Last Database Backup)
Original select statement:
select substr(char(last_backup_date), 1, 16) as
LDBB from db where cast((current_timestamp-last_backup_date)hours
as decimal)<%s Modified select statement: select substr(char(last_backup_date), 1, 16) as LDBB from db where TIMESTAMPDIFF (8,CHAR(current_timestamp-last_backup_date ))<%s PCTUTILIZED (%Database Utilization) Original select statement: select pct_utilized from db Suggested modified select statement: select sum(100-(free_space_mb*100) / tot_file_system_mb) as PCT_UTILIZED from db The PCT_UTILIZED variable has no direct equivalent in Tivoli Storage Manager V6 servers. To monitor the usage of database space, the ratio of FREE_SPACE_MB to TOT_FILE_SYSTEM_MB can be used to give similar results. The suggested select statement gives the percent utilized of the space available to the database. To be automatically warned when the space available to the database is nearly full, activate a notification rule to receive a message if this value reaches a high percentage, for example 85%. CACHE_PCT (Database Cache Hit Ratio) Original select statement: select CACHE_HIT_PCT as CACHE_PCT from DB Modified select statement: select BUFF_HIT_RATIO as CACHE_PCT from DB MAX_PCT_UTILIZED (% Maximum Recovery Log Utilization) Original select statement: select max_pct_utilized from log You can either delete this Select Variable, or change it to report on the file system where the active log is located. A suggested modified select statement: select cast(sum(used_space_mb *100 / total_space_MB) as decimal(3,1)) as MAX_PCT_UTILIZED from log The suggested select statement reports the percent utilized of the file system where the active log resides. The number is important because problems occur if the file system where the active log resides fills up. RESET_BUFFPOOL Original select statement: reset bufpool Delete this Select Variable. Tivoli Storage Manager servers at V6.1 and later do not reset the buffer pool. TMS (Number of tape mounts) Original select statement: select count(*) as TMS from summary where activity='TAPE MOUNT' and cast((current_timestamp-start_time)hours as decimal)<%s Modified select statement: select count(*) as TMS from summary where activity='TAPE MOUNT' and TIMESTAMPDIFF (8,CHAR(current_timestamp-start_time ))<%s MTM (Total number of minutes tape were mounted) Original select statement: select (sum(end_time-start_time))minutes as MTM from summary where activity='TAPE MOUNT' and cast((current_timestamp-start_time)hours as decimal)<%s Modified select statement: select (sum(TIMESTAMPDIFF(4,end_time-start_time))) as MTM from summary where activity='TAPE MOUNT' and TIMESTAMPDIFF (8,CHAR(current_timestamp-start_time )) <%s Click OK, then click Yes to save the changes. Back to top Modifying monitors When first installed, Tivoli Storage Manager Operational Reporting contains a model template for an Hourly Monitor. You must modify the Custom Summary report section of the Hourly Monitor. Start the Tivoli Storage Manager V5.5 Management Console: Start > All Programs > Tivoli Storage Manager > Management Console
Click Operational Monitors and create a new Hourly Monitor, or update the properties of an existing monitor.
On the Monitor Details tab, select Custom Summary, then click Settings.
Click Browse and select the monitor template file that you created in a previous step: C:\Program Files\Tivoli\TSM\console\default_mon_eng_TSM6.xml
Edit the following Select Variables, and modify the select statements.
PCTUTILIZED (%Database Utilization)
Original select statement:
select pct_utilized from db
Suggested modified select statement:
select sum(100-(free_space_mb*100) / tot_file_system_mb) as PCT_UTILIZED
from db
The PCT_UTILIZED variable has no direct equivalent in Tivoli Storage Manager V6 servers. To monitor the usage of database space, the ratio of FREE_SPACE_MB to TOT_FILE_SYSTEM_MB can be used to give similar results. The suggested select statement gives the percent utilized of the space available to the database.
MAX_PCT_UTILIZED (% Maximum Recovery Log Utilization)
Original select statement:
select max_pct_utilized from log
You can either delete this Select Variable, or change it to report on the file system where the active log is located. A suggested modified select statement:
select cast(sum(used_space_mb *100 / total_space_MB) as decimal(3,1))
as MAX_PCT_UTILIZED from log
The suggested select statement reports the percent utilized of the file system where the active log resides. The number is important because problems occur if the file system where the active log resides fills up.
Click OK, then click Yes to save the changes.
Back to top
Modifying custom reports
If custom reports have been created in the Operational Reporting feature, verify that the syntax of custom select statements is correct for V6 servers. Review the information in the following document to learn about the changes that were made to the Tivoli Storage Manager server SELECT command between V5.5 and V6: Changes to the SELECT command.
For additions and corrections to this information about the SELECT command, see the technote: http://www.ibm.com/support/docview.wss?uid=swg21380830
Back to top