FreeBSD 4.9 ネットワークの設定

#ifconfig

でデバイス名を確認する
fxp0 とか。

viで /etc/rc.conf を開く

次の行を追加

gateway_enable="YES"
ifconfig_fxp0="inet 192.168.128.100 netmask 255.255.255.0"
defaultrouter="192.168.128.1"

みたいな。

vi
日本語キーボードでは
_ … Shift + “ほ” のキー
= … “へ” のキー
” … “け” のキー
でした。。。

fortalesa

ルーターのファームウェアを8.3.8へアップデート

NEC UnevergeIX2015 のファームウェアを8.3.8へアップデート

攻めルータ!まもルータ!IX2015のファームウェアをアップデートしたのでそのメモを。。。
tftpサーバの設定などはこちら
ルータのtftpコマンド(get と put だけ)はtftpサーバで設定した初期フォルダを参照します。

【準備】

PCのアドレス:192.168.128.194/24

ハブを通してルータのFastEther1とLANケーブルで接続
ルータのコンソールポートとシリアルケーブルで接続(9600)

最初flashの容量が少なくて、消さないと新しいのをダウンロードできませんでした。。。

起動してコンフィグモードに入ります
NEC Portable Internetwork Core Operating System Software
Copyright Notices:
Copyright (c) 2001-2008 NEC Infrontia All Rights Reserved.
Copyright (c) 1985-1998 OpenROUTE Networks, Inc.
Copyright (c) 1984-1987, 1989 J. Noel Chiappa.
Router#
NEC Diagnostic Software
Copyright (c) NEC Corporation 2001-2005. All rights reserved.
%DIAG-INFO: Starting System POST(Power On Self Test)
DRAM TEST 1: Pass
DRAM TEST 2: Pass
NVRAM TEST: Fail
CPU TEST: Pass
PLD TEST: Pass
LAN1(FE0/0) TEST: Pass
LAN2(FE0/1) TEST: Pass
SECURITY TEST: Pass
VOLTAGE STATUS: 3.268V Pass
TEMPERATURE STATUS: +25.0degC Pass
NEC Bootstrap Software
Copyright (c) NEC Corporation 2001-2005. All rights reserved.
%BOOT-INFO: No boot records found, attempting flash load.
%BOOT-INFO: Trying flash load, exec-image [ix2010-ms-6.3.23.ldc].
Loading: ############################################ [OK]
NEC Diagnostic Software
Copyright (c) NEC Corporation 2001-2005. All rights reserved.
%DIAG-INFO: Starting Interface Unit POST(Power On Self Test)
%DIAG-INFO: Interface unit is 4FESW-BRI
HUB(SW)1-4 TEST: Pass
BRI TEST: Pass
Starting at 0x20000
Configuring router subsystems (before IDB proc): done.
Constructing IDB(Interface Database): done.
Configuring router subsystems (after IDB proc): done.
Initializing router subsystems: done.
Starting router subsystems: done.
All router subsystems coming up.
NEC Portable Internetwork Core Operating System Software
Copyright Notices:
Copyright (c) NEC Corporation 2001-2005. All rights reserved.
Copyright (c) 1985-1998 OpenROUTE Networks, Inc.
Copyright (c) 1984-1987, 1989 J. Noel Chiappa.
Router# en
Enter configuration commands, one per line. End with CNTL/Z.
バージョンを確認します

Router(config)# show version
NEC Portable Internetwork Core Operating System Software
IX Series IX2010 (magellan-sec) Software, Version 6.3.23, RELEASE SOFTWARE
Compiled Nov 17-Thu-2005 11:45:52 JST #2 by takai, coregen-7.3(21)
ROM: System Bootstrap, Version 16.6
System Diagnostic, Version 14.4
System uptime is 1 minute
System woke up by reload, caused by power-on
System started at Feb 14-Sun-2055 06:16:48 JST
System image file is "ix2010-ms-6.3.23.ldc"
Processor board ID <2>
IX2015 (MPC8270A) processor with 65536K bytes of memory.
3 FastEthernet/IEEE 802.3 interfaces
1 ISDN Basic Rate interface
512K bytes of non-volatile configuration memory.
8192K bytes of processor board System flash (Read/Write)

バージョンは6.3.23です。

ルータのポートへIPアドレスを割り当てます
Router(config)# interface FastEthernet1/0.0
Router(config-FastEthernet1/0.0)# ip address 192.168.128.199/24
Router(config-FastEthernet1/0.0)# no shutdown
Router(config-FastEthernet1/0.0)# exit
フラッシュの中身を確認します
Router(config)# show flash
Length     Name/status
2850546    ix2010-ms-6.3.23.ldc runnable
[2850546 bytes used, 4188562 available, 7039108 total]
6912 Kbytes of processor board System flash (Read/Write)
TFTPで現在のファームウェアをバックアップします
Router(config)# tftp put ix2010-ms-6.3.23.ldc
% Expects a subcommand or item selection.
Router(config)# tftp put ix2010-ms-6.3.23.ldc 192.168.128.194:ix2010-ms-6.3.23.
ldc
............................................................................................................................................................................
TFTP transfer complete
バックアップしたら消去します
Router(config)# erase ix2010-ms-6.3.23.ldc
Now erasing ix2010-ms-7.3.21.ldc please wait...
TFTPで新しいバージョンのファームウェアをPCからダウンロードします
Router(config)# tftp get 192.168.128.194:ix2010-boot-22.2-gate-ms-8.3.8.rap ix2
010-boot-22.2-gate-ms-8.3.8.rap
...................................................................................................................................................................................................................................................................
TFTP transfer complete
FLASHの中を確認します
Router(config)# show flash
Length     Name/status
4311933    ix2010-boot-22.2-gate-ms-8.3.8.rap runnable
[4311933 bytes used, 2748706 available, 7060639 total]
6912 Kbytes of processor board System flash (Read/Write)

↑ファイル(ix2010-boot-22.2-gate-ms-8.3.8.rap)がダウンロードされています。

リロードすると新しいファームウェアで起動します
Router(config)# exit
Router# reload
% Warning: current running-configuration is not saved yet.
Notice: The router will be RELOADED. This is to ensure that
the peripheral devices are properly initialized.
Are you sure you want to reload the router? (Yes or [No]): y
NEC Bootstrap Software
Copyright (c) NEC Corporation 2001-2005. All rights reserved.
%BOOT-INFO: No boot records found, attempting flash load.
%BOOT-INFO: Trying flash load, exec-image [ix2010-boot-22.2-gate-ms-8.3.8.rap].
Loading: ################################################################## [OK]
NEC Bootstrap Software, Version 22.2
Copyright (c) 2001-2008 NEC Infrontia All Rights Reserved.
FLASH MEMORY IMAGE UPDATER
%UPDATE-INFO: Starting update.
%UPDATE-INFO: [Bootstrap Software] [Gateway Software]
%UPDATE-INFO: Cleanup all FLASH area, please wait for a while.
%UPDATE-INFO: Overwrite VPD area.
%UPDATE-INFO: 0x00100020 > 0xfe000000 update done.
%UPDATE-INFO: 0x00110020 > 0xfe010000 update done.
%UPDATE-INFO: 0x00120020 > 0xfe020000 update done.
%UPDATE-INFO: 0x00130020 > 0xfe030000 update done.
%UPDATE-INFO: 0x00140040 > 0xfe140000 update done.
%UPDATE-INFO: 0x00150040 > 0xfe150000 update done.
%UPDATE-INFO: 0x00160040 > 0xfe160000 update done.
%UPDATE-INFO: 0x00170040 > 0xfe170000 update done.
%UPDATE-INFO: 0x00180040 > 0xfe180000 update done.
%UPDATE-INFO: 0x00190040 > 0xfe190000 update done.
%UPDATE-INFO: 0x001a0040 > 0xfe1a0000 update done.
%UPDATE-INFO: 0x001b0040 > 0xfe1b0000 update done.
%UPDATE-INFO: 0x001c0040 > 0xfe1c0000 update done.
%UPDATE-INFO: 0x001d0040 > 0xfe1d0000 update done.
%UPDATE-INFO: 0x001e0040 > 0xfe1e0000 update done.
%UPDATE-INFO: 0x001f0040 > 0xfe1f0000 update done.
%UPDATE-INFO: 0x00200040 > 0xfe200000 update done.
%UPDATE-INFO: 0x00210040 > 0xfe210000 update done.
%UPDATE-INFO: 0x00220040 > 0xfe220000 update done.
%UPDATE-INFO: 0x00230040 > 0xfe230000 update done.
%UPDATE-INFO: 0x00240040 > 0xfe240000 update done.
%UPDATE-INFO: 0x00250040 > 0xfe250000 update done.
%UPDATE-INFO: 0x00260040 > 0xfe260000 update done.
%UPDATE-INFO: 0x00270040 > 0xfe270000 update done.
%UPDATE-INFO: 0x00280040 > 0xfe280000 update done.
%UPDATE-INFO: 0x00290040 > 0xfe290000 update done.
%UPDATE-INFO: 0x002a0040 > 0xfe2a0000 update done.
%UPDATE-INFO: 0x002b0040 > 0xfe2b0000 update done.
%UPDATE-INFO: 0x002c0040 > 0xfe2c0000 update done.
%UPDATE-INFO: 0x002d0040 > 0xfe2d0000 update done.
%UPDATE-INFO: 0x002e0040 > 0xfe2e0000 update done.
%UPDATE-INFO: 0x002f0040 > 0xfe2f0000 update done.
%UPDATE-INFO: 0x00300040 > 0xfe300000 update done.
%UPDATE-INFO: 0x00310040 > 0xfe310000 update done.
%UPDATE-INFO: 0x00320040 > 0xfe320000 update done.
%UPDATE-INFO: 0x00330040 > 0xfe330000 update done.
%UPDATE-INFO: 0x00340040 > 0xfe340000 update done.
%UPDATE-INFO: 0x00350040 > 0xfe350000 update done.
%UPDATE-INFO: 0x00360040 > 0xfe360000 update done.
%UPDATE-INFO: 0x00370040 > 0xfe370000 update done.
%UPDATE-INFO: 0x00380040 > 0xfe380000 update done.
%UPDATE-INFO: 0x00390040 > 0xfe390000 update done.
%UPDATE-INFO: 0x003a0040 > 0xfe3a0000 update done.
%UPDATE-INFO: 0x003b0040 > 0xfe3b0000 update done.
%UPDATE-INFO: 0x003c0040 > 0xfe3c0000 update done.
%UPDATE-INFO: 0x003d0040 > 0xfe3d0000 update done.
%UPDATE-INFO: 0x003e0040 > 0xfe3e0000 update done.
%UPDATE-INFO: 0x003f0040 > 0xfe3f0000 update done.
%UPDATE-INFO: 0x00400040 > 0xfe400000 update done.
%UPDATE-INFO: 0x00410040 > 0xfe410000 update done.
%UPDATE-INFO: 0x00420040 > 0xfe420000 update done.
%UPDATE-INFO: 0x00430040 > 0xfe430000 update done.
%UPDATE-INFO: 0x00440040 > 0xfe440000 update done.
%UPDATE-INFO: 0x00450040 > 0xfe450000 update done.
%UPDATE-INFO: 0x00460040 > 0xfe460000 update done.
%UPDATE-INFO: 0x00470040 > 0xfe470000 update done.
%UPDATE-INFO: 0x00480040 > 0xfe480000 update done.
%UPDATE-INFO: 0x00490040 > 0xfe490000 update done.
%UPDATE-INFO: 0x004a0040 > 0xfe4a0000 update done.
%UPDATE-INFO: 0x004b0040 > 0xfe4b0000 update done.
%UPDATE-INFO: Update completed.
NEC Bootstrap Software
Copyright (c) 2001-2008 NEC Infrontia All Rights Reserved.
%BOOT-INFO: No boot records found, attempting flash load.
%BOOT-INFO: Trying flash load, exec-image [ix2010-ms-8.3.8.ldc].
Loading: ######################################################## [OK]
Starting at 0x20000
Configuring router subsystems (before IDB proc): done.
Constructing IDB(Interface Database): done.
Configuring router subsystems (after IDB proc): done.
Initializing router subsystems: done.
Starting router subsystems: done.
All router subsystems coming up.
NEC Portable Internetwork Core Operating System Software
Copyright Notices:
Copyright (c) 2001-2008 NEC Infrontia All Rights Reserved.
Copyright (c) 1985-1998 OpenROUTE Networks, Inc.
Copyright (c) 1984-1987, 1989 J. Noel Chiappa.
Router# en
Enter configuration commands, one per line. End with CNTL/Z.
バージョンを確認します
Router(config)# show version
NEC Portable Internetwork Core Operating System Software
IX Series IX2010 (magellan-sec) Software, Version 8.3.8, RELEASE SOFTWARE
Compiled Nov 07-Fri-2008 10:58:12 JST #1 by sw-build, coregen-8.3(8)
ROM: System Bootstrap, Version 22.2
System Diagnostic, Version 20.2
System uptime is 0 minute
System woke up by reload, caused by command execution
System started at Feb 14-Sun-2055 14:45:12 JST
System image file is "ix2010-ms-8.3.8.ldc"
Processor board ID <2>
IX2015 (MPC8270A) processor with 65536K bytes of memory.
3 FastEthernet/IEEE 802.3 interfaces
1 ISDN Basic Rate interface
512K bytes of non-volatile configuration memory.
8192K bytes of processor board System flash (Read/Write)
This product includes software developed by the OpenSSL Project
for use in the OpenSSL Toolkit (http://www.openssl.org/).
Router(config)#

参考サイト:http://www.rtk.jp

ユーザー関数を定義する

function [関数名]( [引数] ) {
内容
 }

※引数を修正する関数のときは&をつける

ex.英語の挨拶をポルトガル語に置き換える関数”en2pt”

function en2pt(&$val) {
$val = str_replace ("hello", "oi", $val);
$val = str_replace ("my name is", "meu nome e", $val);
$val = str_replace ("masumi", "massumi", $val);
}

使うときはこんな感じ↓

$str = "hello! my name is masumi<br>";
print $str;
en2pt($str);
print $str;

実行結果

hello! my name is masumi
oi! meu nome e massumi

maisa / RN

Posted in PHP

BASIC認証をかける

.htaccess と .htpasswd を作って置くだけ。

管理画面など、公開しないファイルが入っているディレクトリにBasic認証をかけてアクセスを制限する。
検索エンジンも来ないので検索されることも無い。

↑こういうの

f:id:masomi79:20090526111621g:image
↑ID・パスワードが無いとこう

.htaccessと .htpasswd ファイルを作成して、制限したいディレクトリに設置するだけ。

.htaccessの例

AuthUserFile /var/www/html/sample/.htpasswd
AuthGroupFile /dev/null
AuthName “Please enter your ID and password”
AuthType Basic
Require valid-user

※上記の例では/var/www/html/sample/以下の全てのファイルに制限がかかる

.htpasswdの例

Nickey:J8DeyRb/Rcchc

※パスワードは暗号化して記入

nl2br

フォームで送信した文章中の改行コードを
に変換して格納する

<form method=post action=enroll.php>
<textarea name=text>

$text = nl2br($_POST[“text”]);
print $text;

ABOLIÇÃO IV / MOSSORÓ - RN

Posted in PHP

お勉強メモ

RPM  RedHatのソフトウェアのパッケージ管理システム。「rpm」というコマンドで操作する。
 dag  Redhat系のパッケージで、オフィシャルでパッケージ化されていないソフトウェアをパッケージ化して管理・配布しているサイト
locale 言語の設定を確認
/etc/passwd ユーザー一覧

外部から接続できるようにvsftpdを設定する…

サービスが起動しているかどうか確認

service vsftpd status

vsftpd (pid 13015) を実行中…

プロセスが起動しているかどうか確認

ps -ef | grep vsftpd

root 13015 1 0 10:37 ? 00:00:00 /usr/sbin/vsftpd /etc/vsftpd/vsftpd.conf –force-background
root 13107 12896 0 11:48 pts/1 00:00:00 grep vsftpd

vsftp.confの設定

vi /etc/vsftpd/vsftpd.conf

userlistで許可したユーザーのみログイン許可
  追加 → userlist_deny=NO

パッシブモードを有効にする
  追加 → pasv_promiscuous=YES

vsftp.user_listの設定

vi /etc/vsftpd.user_list

  一番下にユーザー名を記述する

hosts.allowの設定

vi /etc/hosts.allow

  追加 → vsftpd : 209.85.201.104 (接続を許可するIPアドレス)

再起動

接続の確認

>netstat 接続状況の確認
netstat -a 全ての接続
netstat -l listen状態の接続を表示
netstat -i インターフェイスごとのパケット数
/etc/rc.d/init.d/vsftpd restart

Quitoの旧市街

ciudad antigua / Quito, Ecuador