2013/06/24

centos 6 設定 netflowanalyzer

1812Jの監視のため無料版をインストール

・Netflow Analyzer
NetFlow Analyzerを登録してダウンロード
http://www.manageengine.jp/products/NetFlow_Analyzer/ 
NetFlow Analyzerをインストール
#mv ./ManageEngine_NetFlowAnalyzer_9800_64bit.bin /usr/loca/bin/
#cd /usr/local/bin
#chmod +x ManageEngine_NetFlowAnalyzer_9800_64bit.bin
#./ManageEngine_NetFlowAnalyzer_9800_64bit.bin 
ウィザードに従って進めていく(E-mailは必須)
起動確認
#cd /opt/ManageEngine/NetFlow/bin
#./run.sh
サービス登録
#./linkAsService.sh
#/etc/rc.d/init.d/netflowanalyzer start
iptablesの設定
TCP:9996,8080 UDP:9996
webブラウザから、http://localhost:8080へアクセス
パスワードを変更する
・1812J側の設定
Dialer1のinterfaceを有効
1812J(config)#interface Dialer 1
1812J(config-if)#ip route-cache flow
1812J(config-if)#ip flow ingress
1812J(config-if)#ip flow egress
Fa1のinterfaceを有効
1812J(config)#interface fastEthernet 1
1812J(config-if)#ip route-cache flow
1812J(config-if)#ip flow ingress
1812J(config-if)#ip flow egress
送信元インターフェース設定
1812J(config)#ip flow-export source FastEthernet1送信先のnetflowanalyzerのIPとポートを指定
1812J(config)#ip flow-export destination 192.168.1.XXX 9996netflowのバージョンを指定
1812J(config)#ip flow-export version 5長時間のフローを1分刻みに分割する
1812J(config)#ip flow-cache timeout active 1
インターフェース名が正しく表示される様にsnmpを指定する
1812J(config)#snmp-server ifindex persist
1812J(config)#snmp-server community public RO
グラフに表示される□□□を日本語に表示させる
# cd /opt/ManageEngine/NetFlow/jre/lib/fonts/
# mkdir fallback/
# cd fallback/
# ln -s /usr/share/fonts/vlgothic/VL-Gothic-Regular.ttf ./

2013/06/23

centos 6 設定 zabbix-server agent

環境:CentOS 6.4 ×86_64
参考:http://kodai74.blogspot.jp/2013/03/zabbix.html
zabbix SIAからインストール
・zabbix-serverインストール
#rpm -ivh http://repo.zabbix.com/zabbix/2.0/rhel/6/x86_64/zabbix-release-2.0-1.el6.noarch.rpm#yum install zabbix-agent zabbix-server-mysql zabbix-web-mysql zabbix-web-japanese
#yum install mysql-server#vi /etc/my.cnf  以下5つを[mysqld]以下に追加
[mysqld]
innodb_file_per_table
innodb_buffer_pool_size=512M
innodb_log_file_size=64M
default-character-set = utf8
skip-character-set-client-handshake
#service mysqld start
#mysqld -u root
mysql> create database zabbix character set utf8;
mysql> grant all privileges on zabbix.* to zabbix@localhost identified by ‘パスワード’;
mysql>exit
# mysql -u root zabbix < /usr/share/doc/zabbix-server-mysql-2.0.6/create/schema.sql
# mysql -u root zabbix < /usr/share/doc/zabbix-server-mysql-2.0.6/create/images.sql
# mysql -u root zabbix < /usr/share/doc/zabbix-server-mysql-2.0.6/create/data.sql 
#vi /etc/zabbix/zabbix_server.conf
DBPassword=パスワード
#service zabbix-server start
#service zabbix-agent  start 
#vi /etc/httpd/conf.d/zabbix.conf  コメント外してAsia/Tokyoに変更
php_value date.timezone Asia/Tokyo
# service httpd start 
Webブラウザからhttp://localhost/zabbixへアクセス
ウィザードにしたがって進めていく
Sign in  ->  Username:admin Password:zabbix
Profileからパスワードと言語を変更する 
あとはzabbix-serverをweb上で有効にして監視開始。

centos 6 設定 ssh iptables selinux

環境:CentOS6.4 ×86_64
SSH
sshのポート番号変更とPassword認証不可とRootlogin不可に設定
#vi /etc/ssh/sshd_configPort 22 -> Port 任意の番号(10022)
PasswordAuthentication yes -> no
PermitRootLogin no -> yes
#service sshd restart
authorized_keysを設定
$mkdir .ssh
$chmod 700 .ssh
$vi .ssh/authorized_keys

クライアントで作成したid_rsa.pubを転送して中身をコピペ
$chmod 600 .ssh/authorized_keys
 
iptables
iptablesを設定
#vi iptables-set.sh#!/bin/bash
# フィルタリングルールを消去する
/sbin/iptables -F
# デフォルトポリシーを設定(最初にすべてのポリシーをDROPに設定)
/sbin/iptables -P INPUT DROP
/sbin/iptables -P FORWARD DROP
/sbin/iptables -P OUTPUT DROP
# ループバックを許可する
/sbin/iptables -A INPUT -s 127.0.0.1 -d 127.0.0.1 -j ACCEPT
/sbin/iptables -A OUTPUT -s 127.0.0.1 -d 127.0.0.1 -j ACCEPT
# プライベートアドレスが使われているパケットを破棄
/sbin/iptables -A INPUT -i eth0 -s 10.0.0.0/8 -j DROP
/sbin/iptables -A INPUT -i eth0 -d 10.0.0.0/8 -j DROP
/sbin/iptables -A INPUT -i eth0 -s 172.16.0.0/12 -j DROP
/sbin/iptables -A INPUT -i eth0 -d 172.16.0.0/12 -j DROP
# 基本サービスを許可, SSH
/sbin/iptables -A INPUT -p tcp -m state –state NEW -m tcp –dport 10022 -j ACCEPT
# すでにコネクションを確立しているものは許可
/sbin/iptables -A INPUT -m state –state RELATED,ESTABLISHED -j ACCEPT
# Ping of Death対策
/sbin/iptables -A INPUT -p icmp –icmp-type echo-request -m limit –limit 1/s -j ACCEPT
# 外への接続は全て許可
/sbin/iptables -P OUTPUT ACCEPT
# 保存 + iptables再起動
/etc/init.d/iptables save
/etc/init.d/iptables restart
# 設定が適用されているか確認
/sbin/iptables -L
iptablesの確認
#iptables -L Chain INPUT (policy DROP)
target prot opt source destination
ACCEPT all — localhost localhost
DROP all — 10.0.0.0/8 anywhere
DROP all — anywhere 10.0.0.0/8
DROP all — 172.16.0.0/12 anywhere
DROP all — anywhere 172.16.0.0/12
ACCEPT tcp — anywhere anywhere state NEW tcp dpt:10022
ACCEPT all — anywhere anywhere state RELATED,ESTABLISHED
ACCEPT icmp — anywhere anywhere icmp echo-request limit: avg 1/sec burst 5
Chain FORWARD (policy DROP)
target prot opt source destination
Chain OUTPUT (policy ACCEPT)
target prot opt source destination
ACCEPT all — localhost localhost
iptablesのfilterテーブルは、
chainがINPUT,OUTPUT,FORWARDの3つあって
それぞれに全体のポリシー(ACCEPT/DROP)を指定して
必要があれば個別にACCEPT/DROPをする。 

selinux
一時設定(Enforcing:有効/Permissive:警告のみ/disabled:無効)
#getenforce
Enforcing
#setenforce 0
# getenforce

Permissive
設定
# vi /etc/selinux/config
SELINUX=disabled

2011/06/30

1812J 再設定3

DDNS
参考:http://yajizm.com/mydns.jpを利用して動的IPとドメイン.mydns.jpを紐付け
router#conf t router(config)#ip ddns update method ドメインrouter(DDNS-update-method)#HTTProuter(DDNS-HTTP)#add http://ログインID:パスワード@www.mydns.jp/login.htmlrouter(DDNS-HTTP)#interval maximum 0 0 30 0 router(config)#interface Dialer 1router(config-if)#ip ddns update hostname ドメイン名.mydns.jprouter(config-if)#ip ddns update ドメイン
・NTP
参考:http://kumo.chicappa.jp/?page_id=39router(config)#ntp server ntp.nict.jp
router(config)#ntp update-calendar

router#sh ntp status #Clock is synchronizedになっていれば同期中
Clock is synchronized, stratum 2, reference is 133.243.238.24
nominal freq is 250.0000 Hz, actual freq is 250.0000 Hz, precision is 2**15
reference time is D187050C.DD67F930 (13:33:16.864 JST Wed May 25 2011)
clock offset is 6.5610 msec, root delay is 25.89 msec
root dispersion is 450.84 msec, peer dispersion is 64.69 msec
loopfilter state is ‘CTRL’ (Normal Controlled Loop), drift is 0.000000045 s/s
system poll interval is 64, last update was 146 sec ago.
router#sh ntp associations #133.243・・・の横に※印があればOK
address         ref clock       st   when   poll reach  delay  offset   disp
*~133.243.238.243 .NICT.           1     29     64   177 25.896   6.561 64.699
* sys.peer, # selected, + candidate, – outlyer, x falseticker, ~ configured
・enableパスワード設定
router(config)#enable secret パスワード
router(config)#end
router#disable
router>enable
Password:パスワード
router#
ssh
参考:http://kumo.chicappa.jp/?page_id=39router(config)#crypto key generate rsa #暗号鍵作成
How many bits in the modulus [512]: 1024
% Generating 1024 bit RSA keys, keys will be non-exportable…[OK]
router(config)#username ユーザー名 password パスワード
router(config)#line vty 0 4
router(config-line)#login local #これを入れるとUSERNAMEをみにいくらしい。
router(config-line)#transport input ssh #sshの接続許可
router(config-line)#access-class 101 in      #以前作成したaccess-list 101を適用
router#show ssh #sshで接続後に実行すると誰がつながってるか見える
Connection Version Mode Encryption  Hmac         State                 Username
0          2.0     IN     aes256-cbc  hmac-sha1    Session started      ユーザー名
0          2.0     OUT  aes256-cbc  hmac-sha1    Session started      ユーザー名
%No SSHv1 server connections running.

2011/05/23

1812J 再設定2

メモリ買ってきたので続き
メモリ増設
天板の黒ネジ1本外して、両サイドのドライバーマーク付近にマイナスドライバーで引っかかた部分を押したら、
簡単に空いたので、SO-DIMM_DDR2700(256MB)を取り付けた。(中古だから200円だったw)
router#show version   #メモリ増えたか確認
Cisco 1812-J (MPC8500) processor (revision 0x400) with 354304K/38912K bytes of memory.
現在のインターネット接続環境は、光プレミアム+OCNでPPPOEで接続
router#show runnning-config
version 15.1 service timestamps debug datetime msec
service timestamps log datetime msec
no service password-encryption
boot-start-marker
boot-end-marker
!
clock timezone JST 9 0 #日本時刻へ変更
crypto pki token default removal timeout 0
!
ip dhcp pool local #localという名のdhcp poolの設定
network 192.168.1.0 255.255.255.0
default-router 192.168.1.1
dns-server xxx.xxx.xxx.xxx
!
multilink bundle-name authenticated
!
!
interface FastEthernet0
no ip address
duplex auto
speed auto
pppoe enable group global
pppoe-client dial-pool-number 1
interface FastEthernet2
interface FastEthernet4
interface FastEthernet6
interface FastEthernet8
interface Vlan1
ip address 192.168.1.1 255.255.255.0
ip nat inside
ip virtual-reassembly in
ip tcp adjust-mss 1398
ip forward-protocol nd
no ip http server
no ip http secure-server
!
logging esm config
access-list 101 permit ip 192.168.1.0 0.0.0.255 any
dialer-list 1 protocol ip permit
no cdp run
!
!
!
end
とりあえずつながったけど、よくわかってない設定もあるのでおいおい調べたり、セキュリティを上げたりしよう。
あと、TELNETはダメでSSHで接続出来るようにもしよう。

2011/05/18

1812J 再設定

1812Jを手に入れてから放置してたので今日から設定。
手に入れた当時ちょっと触ったけどあまり覚えてないからまず初期化。
USB-シリアル変換でパソコンと1812Jをつなぎ、teratermでシリアルポートに接続する。
1812Jを起動し、起動中にALT+Bを押してrommonにする。
rommon 2 > confreg 0x2141 #コンフィグレーションレジスタ変更
rommon 3 > reset
再起動
Would you like to enter the initial configuration dialog? no #セットアップモードに入りますか?
Router>enable
Router#erase startup-config  #パスワード等セッテファイル削除
Erasing the nvram filesystem will remove all configuration files! Continue? [confirm]y[OK]
Erase of nvram: complete
Router#
*May 15 10:54:34.903: %SYS-7-NV_BLOCK_INIT: Initialized the geometry of nvram
Router#configure terminal
Router(config)#config-register 0x2102
Router(config)#end
Router#reload
System configuration has been modified. Save? [yes/no]: no
Proceed with reload? [confirm]y
再起動
Would you like to enter the initial configuration dialog? no
router>show version
Configuration register is 0x2102 #コンフィグレジスタ値を確認
※もうひとつの工場出荷状態にする方法—————————————————————–※
router#write erase
Erasing the nvram filesystem will remove all configuration files! Continue? [confirm]
[OK]
Erase of nvram: complete
router#
*May 17 02:51:29.822: %SYS-7-NV_BLOCK_INIT: Initialized the geometry of nvram
router#reload
System configuration has been modified. Save? [yes/no]: no
Proceed with reload? [confirm]
※——————————————————————————————————–※
vlan設定の削除
Switch#show flash:
Switch#delete flash:vlan.dat
Delete filename [vlan.dat]?
Delete flash:vlan.dat? [confirm]
Switch#reload
Proceed with reload? [confirm]
エラーメッセージが出るので止める
%Error opening tftp://255.255.255.255/ciscortr.cfg (Timed out)
router>enable
router#configure terminal
router(config)#no service config
router(config)#exit
router#copy running-config startup-config
Destination filename [startup-config]?
Building configuration…
vlan1にIPを振る
router#conf t
router(config)#interface vlan 1
router(config-if)#ip address 192.168.11.2 255.255.255.0
IOSのバックアップと更新。
3CDaemonを探してインストール #TFTPソフトをインストール
Router#show flash  #flashに保存されているものを確認(以下の転送時に移動するファイルを確認)
router#copy flash tftp #tfpt-serverへflash内のファイルを転送
router#copy flash tftp
Source filename ? c181x-adventerprisek9-mz.150-1.M.bin
Address or name of remote host
? 192.168.11.4
Destination filename [c181x-adventerprisek9-mz.150-1.M.bin]?
flash内のIOSを削除
router#delete flash:c181x-adventerprisek9-mz.150-1.M.bin
Delete filename [c181x-adventerprisek9-mz.150-1.M.bin]?
Delete flash:/c181x-adventerprisek9-mz.150-1.M.bin? [confirm]
IOSをTFTPからアップデート
router#copy tftp flash
Address or name of remote host ? 192.168.11.4
Source filename
? c181x-adventerprisek9-mz.151-3.T.bin
Destination filename [c181x-adventerprisek9-mz.151-3.T.bin]?
設定ファイルのコピーと再起動
router#copy running-config startup-config
Destination filename [startup-config]?
Building configuration…
[OK]
router#reload
Proceed with reload? [confirm]
更新されたか確認
router>en
router#sh version
Cisco IOS Software, C181X Software (C181X-ADVENTERPRISEK9-M), Version 15.1(3)T, RELEASE SOFTWARE (fc1) ・・・・
時間設定
router(config)#clock timezone JST 9
とりあえずここまでと思ってcopy runnning-config startup-config してほっておくと
Not enough free memoryっていうメッセージが出てたのでreloadしてみたら、
1812Jが再起動を繰り返す・・・。
ぐぐってみると15.1はメモリが256MBにFLASHが64MB必要らしいので明日買ってくる。

2011/03/07

xenserver HDD 追加メモ

よくわすれるのでメモ
環境:xenserver5.6 FP1SATA-HDD4台ぶら下がっている状況でさらに2台追加。
Xenserverをシャットダウンして2台追加し、Xenserver起動。
Xenserverにつないで
[root@xenserver ~]# dmesg |less
/sde
scsi 4:0:0:0: Direct-Access     ATA      WDC WD20EARS-00M 51.0 PQ: 0 ANSI: 5
sdd:
sd 4:0:0:0: [sde] 3907029168 512-byte logical blocks: (2.00 TB/1.81 TiB)
/sdf
scsi 5:0:0:0: Direct-Access     ATA      WDC WD20EARS-00M 51.0 PQ: 0 ANSI: 5
sde:
sd 5:0:0:0: [sdf] 3907029168 512-byte logical blocks: (2.00 TB/1.81 TiB)
2台追加されていることを確認。
[root@xenserver ~]# xe sr-create name-label=”LocalStorage5″ type=lvm device-config:device=/dev/sde
82998483-c016-5a21-2f47-ca917144e9e8
sde認識されているHDDをLocalStorage5という名前でlvmのsr作成。
[root@xenserver ~]# xe sr-create name-label=”LocalStorage6″ type=lvm device-config:device=/dev/sdf
3a9ab6fd-f3de-934a-efa9-110c4278921e
sdf認識されているHDDをLocalStorage6という名前でlvmのsr作成。
後は、xencenterからLocalStorage5,6が認識されていることを確認して完了。

L2TP/IPSEC-VPN IX2025 リモートアクセス.

リモートアクセス VPN テスト シナリオ 想定1:インターネット VPN を使用したリモートアクセス VPN 想定2: VPN 構築後に iphone からインターネットに接続する 機器: NEC  IX2025(8.11.11) と iphone 目標1: LTE 通信の i...