ラベル Cisco の投稿を表示しています。 すべての投稿を表示
ラベル Cisco の投稿を表示しています。 すべての投稿を表示

2010年9月15日水曜日

Cisco ルータから WOL を実施する

通常、WOL ではマジックパケットと呼ばれる特殊なパケットを、起動したいマシン宛てに送信しなくてはなりません。
我が家では、常時電源が入っている機器が Cisco ルータしかありません。
そこで、Cisco ルータにログインして、そこからマジックパケットを送信できればいいのですが、方法が思いつきませんでした。

WOL で起動したい自宅の Ubuntu マシンで WOL の設定を確認してみると、ユニキャストパケットに反応する設定ができる NIC でした。

$ sudo ethtool eth0 | grep "Supports Wake-on"
Supports Wake-on: pumbg

u (unicast) と g (MagicPacket) を指定します。

$ sudo ethtool -s eth0 wol ug

これで、ユニキャストにも反応してマシンを起動することができます。

起動するマシンの MAC アドレスを 0123.4567.89ab とします。
ARP テーブルにこのアドレスをスタティックに登録しておきます。

(config)#arp 192.168.1.11 0123.4567.89ab ARPA
(config-kron-occurrence)#^Z

192.168.1.11 に PING すれば、Cisco ルータからでも WOL で起動できるようになりました。


ping の実行を予めスケジュールしておけば、決まった時間にマシンを起動することもできます。

(config)#kron policy-list WAKE
(config-kron-policy)#cli ping 192.168.1.11
(config-kron-policy)#exit
(config)#kron occurrence WAKE at 13:00 oneshot
(config-kron-occurrence)#policy-list WAKE
(config-kron-occurrence)#^Z

これで、13:00 に Ubuntu マシンを起動できます。

2010年8月22日日曜日

Cisco ルータで設定変更するまえに reload を仕掛けておく

Cisco ルータで遠隔からログインして設定変更を実施する場合、誤ってログインができなくなってしまうと困ります。
そこで、設定変更を実施するまえに、10分後に再起動するように仕掛けておきます。
設定変更でログインできなくなっても、10分待てば再起動して、再度ログインできるので安心です。

C1812J#reload in 10 !---- 10分後に再起動するように設定します。
Reload scheduled for 14:25:54 JST Sun Aug 22 2010 (in 10 minutes) by nonsugar on vty0 (192.168.1.10)
Reload reason: Reload Command
Proceed with reload? [confirm] !---- [Enter] キーを押します。
C1812J#show reload !---- 再起動のスケジュールを確認します。
Reload scheduled for 14:26:08 JST Sun Aug 22 2010 (in 9 minutes) by nonsugar on vty0 (192.168.1.10)
Reload reason: Reload Command
!
!---- 設定変更を実施します。
!
C1812J#reload cancel !---- 再起動のスケジュールをキャンセルします。
C1812J#
***
*** --- SHUTDOWN ABORTED ---
***
C1812J#show reload !---- 再起動のスケジュールが残っていないことを確認します。
No reload is scheduled.

2010年8月8日日曜日

6to4 を試してみる

6to4 を試してみました。

ネットワーク構成

  • Cisco 1812J の Dialer1 で IPv4 インターネットに接続しています。
  • Cisco 1812J の Dialer1 には、IPv4 のグローバル アドレスが割り当てられますが動的です。

(作成中...)




Cisco1812J の設定

Dialer1 に動的に割り当てられた IPv4 のグローバル アドレスを調べます。

C1812J#sh ip int brief | inc Dialer1

ここでは、仮に 192.0.2.1 が割り当てられたと仮定して説明します。

6to4 のアドレスは、2002:IPV4ADDR::/48 のプレフィックスになりますので、6to4 用のトンネル インタフェース (Tunnel2002) に割り当てるアドレスをそこから選択します。

アドレスは、Linux で計算できます。

$ printf "2002:%02x%02x:%02x%02x::1/128\n" 192 0 2 1
2002:c000:0201::1/128

このアドレスを Tunnel 2002 に割り当てます。

Tunnel 2002 では、ICMP と TCP の ESTABLIESHD、UDP/53 (DNS) のみ許可することとします。

!
ipv6 access-list IPV6-IN
permit icmp any any
permit tcp any any gt 1023 established
permit udp any eq domain any gt 1023
deny ipv6 any any log
!
interface Tunnel2002
description 6to4 tunnel
no ip address
no ip redirects
!--- Dialer1 に割り当てられた IP アドレスが 192.0.2.1 の場合
ipv6 address 2002:C000:0201::1/128
ipv6 traffic-filter IPV6-IN in
tunnel source Dialer1
tunnel mode ipv6ip 6to4
!
interface Vlan1
ipv6 address 2002:C000:0201:1::1/64
!
ip access-list extended FW
permit 41 any any !--- プロトコル番号41 は、IPv6
!
interface Dialer1
ip access-group FW in
!
!---- ISATAP と組み合わせることも可能
interface Tunnel11
description ISATAP Tunnel
no ip address
no ip redirects
ipv6 address 2002:C000:0201:11::1/64
no ipv6 nd ra suppress
tunnel source Dot11Radio0
tunnel mode ipv6ip isatap
!
ipv6 route 2002::/16 Tunnel2002
ipv6 route ::/0 2002:C058:6301:: !--- 6to4 IPv6 relay anycast address


参考

ISATAP を試してみる

ネットワーク構成

[IPv6: 2001:db8:1::254]----{IPv6: 2001:DB8:1::/64}----Vlan1[C1812J]Dot0 ~~~~{192.168.11.0/24}~~~~[WinXP]


C1812J の設定

interface Dot11Radio0
ip address 192.168.11.1 255.255.255.0
!
interface Tunnel11
description ISATAP Tunnel
no ip address
no ip redirects
ipv6 address 2001:DB8:11::1/64
no ipv6 nd ra suppress
tunnel source Dot11Radio0
tunnel mode ipv6ip isatap

WinXP の設定

[%systemroot%\system32\drivers\etc\hosts] に追加する。
192.168.11.1 ISATAP


WinXP からの PING

>ping 2001:db8:1::254

Pinging 2001:db8:1::254 with 32 bytes of data:

Reply from 2001:db8:1::254: time=2ms
Reply from 2001:db8:1::254: time=1ms
Reply from 2001:db8:1::254: time=1ms
Reply from 2001:db8:1::254: time=1ms

Ping statistics for 2001:db8:1::254:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 1ms, Maximum = 2ms, Average = 1ms


参考

2010年7月24日土曜日

Gene 氏の「CCIE Routing & Switching ラボ模擬試験 Vol.1」を買ってみた

CCIE ラボ試験対策用問題集としては、英語のものはいくつかありますが、
日本語で書かれているものとしては、Gene 氏のものしか存在しないのではないでしょうか。

早速購入してみました。
Dynamips/Dyangen で動作するように作成されているのも嬉しいところです。
私は、Ubuntu で GNS3 を使っています。
自分の環境で動作するように .net ファイルを編集してみます。

#### 初期設定ファイルをコピー
$ cp '/SOMEPATH/CCIE Prep1_init.net' lab.net

#### イメージのパスを修正
$ perl -pi -e 's!image =.*$!image = /var/gns3/images/c3640.image!' lab.net

#### イメージに合わせて idlepc 値を訂正
$ perl -pi -e 's/#?idlepc =.*$/idlepc = 0x12345678/' lab.net

#### イメージに合わせて DRAM の容量を修正
$ perl -pi -e 's/dram =.*$/dram = 128/' lab.net

#### メモリが十分あるので、メモリ関係の設定を修正
$ perl -pi -e 's/mmap =.*$/mmap = False/' lab.net
$ perl -pi -e 's/ghostios =.*$/ghostios = False/' lab.net
$ perl -pi -e 's/sparsemem =.*$/sparsemem = False/' lab.net

#### 設定ファイルを .net ファイルでなく、テキストファイルから読み込むための修正
$ perl -pi -e 's/configuration =.*$//' lab.net
$ perl -pi -e 's!\[\[ROUTER (\w+)\]\]$!$&\n cnfg = lab_configs/$1.cfg!' lab.net

#### 作業用ディレクトリの作成
$ mkdir {lab_configs,lab_working}

#### 初期設定ファイルをコピーする
$ cp '/SOMEPATH/CCIE Prep Init/'*.cfg lab_configs/

#### workingdir の設定
perl -pi -e \
's!\[localhost:720\d\]!$&\n workingdir = /SOMEPATH/lab_working!' lab.net

#### GNS3 のディレクトリ設定
$ cat >>lab.net <<'EOM'
[GNS3-DATA]
configs = lab_configs
workdir = lab_working
EOM

#### GNS3 で起動してみる。
$ gns3 lab.net &


参考

2010年2月25日木曜日

Proxy ARP

Proxy arp について調べています。

■ ネットワーク構成

[10.0.0.10]----F0/1[Cisco]F0/0----{192.168.1.0}----eth0[Ubuntu]eth1----[10.0.0.11]

■ Cisco

int fa0/0
ip address 192.168.1.1 255.255.255.0
no ip proxy-arp
!
int fa0/1
ip address 10.0.0.1 255.255.255.0
ip proxy-arp ! デフォルト値
!
ip route 10.0.0.11 255.255.255.255 192.168.1.2

■ Ubuntu
[/etc/network/interfaces]
auto eth1
iface eth1 inet static
address 192.168.1.2
netmask 255.255.255.0

auto eth1
iface eth1 inet static
address 10.0.0.1
netmask 255.255.255.0
up echo 1 >/proc/sys/net/ipv4/conf/eth1/proxy_arp
up route add -host 10.0.0.10 gw 192.168.1.1
down echo 0 >/proc/sys/net/ipv4/conf/eth1/proxy_arp
down route del -host 10.0.0.10 gw 192.168.1.1


参考

2009年12月29日火曜日

BPDU パケット フォーマット

PVST+ が有効な 802.1Q トランクポートの BPDU をキャプチャしてみました。
結果、VLAN1 の BPDU として、802.1d BPDU と PVST+ BPDU (802.1Q の native VLAN) の両方でキャプチャできました。
他の VLAN は、802.1Q のタグ付きで、PVST+ BPDU がキャプチャできました。

宛先 MAC アドレスは、802.1d BPDU は、01:80:c2:00:00:00 です。
PVST+ BPDU は、01:00:0c:cc:cc:cd です。


802.1d BPDU フォーマット (VLAN1)

+[22] IEEE 802.3 Ethernet
│ [06] Destination: Spanning-tree (01:80:c2:00:00:00)
│ [06] Source
│ [02] Length: 38
│ [08] Trailer
+[03] Logical-Link Control
│ [01] DSAP: Spanning Tree BPDU (0x42)
│ [01] SSAP: Spanning Tree BPDU (0x42)
│ [01] Control field: UI (0x03)
+[35] Spanning Tree Protocol
│ [02] Protocol Identifier: Spanning Tree Protocol (0x0000)
│ [01] Protocol Version Identifier: Spanning Tree (0)
│ [01] BPDU Type Configuration (config bpdu = 0x00, tcn bpdu = 0x80)
│ [01] BPDU flags
│ [08] Root Identifier (Root Bridge Priority + Root Bridge System ID)
│ [04] Root Path Cost
│ [08] Bridge Identifier (Bridge Priority + Bridge System ID)
│ [02] Port Identifier
│ [02] Message Age
│ [02] Max Age: 20sec (0x1400)
│ [02] Hello Time: 2sec (0x0200)
│ [02] Forward Delay: 15sec (0f00)


PVST+ BPDU フォーマット

+[14] IEEE 802.3 Ethernet
│ [06] Destination: PVST+ (01:00:0c:cc:cc:cd)
│ [06] Source
│ [02] Type: 802.1Q Virtual LAN (0x8100)
+[04] 802.1Q Virtual LAN
│ [02] Priority / CFI / ID
│ [02] Length: 50
+[08] Logical-Link Control
│ [01] DSAP: SNAP (0xaa)
│ [01] SSAP: SNAP (0xaa)
│ [01] Control field: UI (0x03)
│ [03] Organization Code: Cisco (0x00000c)
│ [02] PID: PVSTP+ (0x010b)
+[42] Spanning Tree Protocol
│ [02] Protocol Identifier: Spanning Tree Protocol (0x0000)
│ [01] Protocol Version Identifier: Spanning Tree (0)
│ [01] BPDU Type Configuration (config bpdu = 0x00, tcn bpdu = 0x80)
│ [01] BPDU flags
│ [08] Root Identifier (Root Bridge Priority + Root Bridge System ID)
│ [04] Root Path Cost
│ [08] Bridge Identifier (Bridge Priority + Bridge System ID)
│ [02] Port Identifier
│ [02] Message Age
│ [02] Max Age: 20sec (0x1400)
│ [02] Hello Time: 2sec (0x0200)
│ [02] Forward Delay: 15sec (0f00)
│ [07] ????


参考

2009年11月25日水曜日

IP Accounting

インタフェースを出入りする IP パケットの IP Precedence 毎のパケット数をカウントする方法。

int s1/0
ip accounting precedence input
ip accounting precedence output
!
ip accounting-threshold 50000 ← 保存するエントリ数


#sh int s1/0 precedence
Serial1/0 To R2
Input
Precedence 2: 15605 packets, 18884970 bytes
Precedence 6: 27 packets, 1572 bytes
Output
Precedence 0: 2 packets, 228 bytes
Precedence 2: 15625 packets, 18909796 bytes
Precedence 6: 100 packets, 6569 bytes

任意の IP Precedence のパケットを出力するには、拡張 PING で ToS フィールドを指定すればよい。

参考

2009年11月8日日曜日

GNS3 で Frame Relay Switch の設定


条件

■ 物理的な接続
R1-Se0/0 -- FRSW-Se0/0
R2-Se0/0 -- FRSW-Se0/1
R3-Se0/0 -- FRSW-Se0/2

■ Frame Relay Switch の設定
DLCI=102 -- DLCI=201
DLCI=103 -- DLCI=301
DLCI=203 -- DLCI=302

■ IP アドレス
R1-Lo0: 10.10.1.1/24
R2-Lo0: 10.10.2.2/24
R3-Lo0: 10.10.3.3/24

R1-Se0/0.102: DLCI=102: 192.168.12.1/24
R1-Se0/0.103 DLCI=103: 192.168.13.1/24
R2-Se0/0.201: DLCI=201: 192.168.12.2/24
R2-Se0/0.203: DLCI=203: 192.168.23.2/24
R3-Se0/0.301: DLCI=301: 192.168.13.3/24
R3-Se0/0.302: DLCI=302: 192.168.23.3/24

■ ルーティング
R1, R2, R3: EIGRP 10


設定

■ FRSW
frame-relay switching
!
interface Serial0/0
description to R1
no ip address
encapsulation frame-relay
clock rate 2000000 !--- Dynamips では自動で入る。
frame-relay intf-type dce
frame-relay route 102 interface Serial0/1 201
frame-relay route 103 interface Serial0/2 301
!
interface Serial0/1
description to R2
no ip address
encapsulation frame-relay
clock rate 2000000 !--- Dynamips では自動で入る。
frame-relay intf-type dce
frame-relay route 201 interface Serial0/0 102
frame-relay route 203 interface Serial0/2 302
!
interface Serial0/2
description to R3
no ip address
encapsulation frame-relay
clock rate 2000000 !--- Dynamips では自動で入る。
frame-relay intf-type dce
frame-relay route 301 interface Serial0/0 103
frame-relay route 302 interface Serial0/1 203

■ R1
interface Loopback0
ip address 10.10.1.1 255.255.255.0
!
interface Serial0/0
no ip address
encapsulation frame-relay
clock rate 2000000 !--- Dynamips では自動で入る。
!
interface Serial0/0.102 point-to-point
description to R2
ip address 192.168.12.1 255.255.255.0
frame-relay interface-dlci 102
!
interface Serial0/0.103 point-to-point
description to R3
ip address 192.168.13.1 255.255.255.0
frame-relay interface-dlci 103
!
router eigrp 10
network 0.0.0.0
no auto-summary

■ R2
(略)

■ R3
(略)


出力
■ FRSW
FRSW#sh frame-relay route
Input Intf Input Dlci Output Intf Output Dlci Status
Serial0/0 102 Serial0/1 201 active
Serial0/0 103 Serial0/2 301 active
Serial0/1 201 Serial0/0 102 active
Serial0/1 203 Serial0/2 302 active
Serial0/2 301 Serial0/0 103 active
Serial0/2 302 Serial0/1 203 active

■ R1
R1#sh frame-relay map
Serial0/0.102 (up): point-to-point dlci, dlci 102(0x66,0x1860), broadcast
status defined, active
Serial0/0.103 (up): point-to-point dlci, dlci 103(0x67,0x1870), broadcast
status defined, active

R1#sh ip ro | b ^Gate
Gateway of last resort is not set
C 192.168.12.0/24 is directly connected, Serial0/0.102
C 192.168.13.0/24 is directly connected, Serial0/0.103
10.0.0.0/24 is subnetted, 3 subnets
C 10.10.1.0 is directly connected, Loopback0
D 10.10.2.0 [90/2297856] via 192.168.12.2, 00:12:26, Serial0/0.102
D 10.10.3.0 [90/2297856] via 192.168.13.3, 00:12:21, Serial0/0.103
D 192.168.23.0/24 [90/2681856] via 192.168.13.3, 00:12:26, Serial0/0.103
[90/2681856] via 192.168.12.2, 00:12:26, Serial0/0.102

R1#p 10.10.2.2 so lo0
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 10.10.2.2, timeout is 2 seconds:
Packet sent with a source address of 10.10.1.1
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 8/48/76 ms

R1#p 10.10.3.3 so lo0
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 10.10.3.3, timeout is 2 seconds:
Packet sent with a source address of 10.10.1.1
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 12/36/48 ms


注意
  • GNS3 (Dyanmips) では、"clock rate" の設定を明示的に入れる必要はありません。実機では、シリアルケーブルの DCE 側で、必ず "clock rate" の設定を入れる必要があります。
  • ルータの物理インタフェース (Serial) で "no shut" が必要です。

2009年10月26日月曜日

NTP の設定

Cisco ルータの NTP の設定です。

設定