単純なキャンパス ネットワークをシミュレートする
1. レイヤ2スイッチ構成、分割VLAN
寮 vlan10、教棟 vlan20、寮ネットワークは 1.1.1.0/24 ネットワーク セグメント、教棟ネットワーク セグメントは 2.2.2.0/24 ネットワーク セグメント
1.DHCPサーバーの設定
デスクトップ –> IP 構成 –> 関連する VLAN ネットワーク セグメントのゲートウェイとサブネット マスクを構成します
DHCP(ドミトリー)
2. ドミトリースイッチの設定
fa0/2 vlan 10
fa0/1 トランク
Switch#config
Switch#configure t
Switch#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
Switch(config)#hostname sw1
sw1(config)#vlan 10
sw1(config-vlan)#exit
sw1(config)#int
sw1(config)#interface f
sw1(config)#interface fastEthernet 0/2
sw1(config-if)#sw
sw1(config-if)#switchport a
sw1(config-if)#switchport access v
sw1(config-if)#switchport access vlan 10
sw1(config-if)#exit
sw1(config)#in
sw1(config)#interface f
sw1(config)#interface fastEthernet 0/1
sw1(config-if)#sw
sw1(config-if)#switchport m
sw1(config-if)#switchport mode t
sw1(config-if)#switchport mode trunk
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to down
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to up
sw1(config-if)#
sw1(config-if)#exit
sw1(config)#
同様に、2 つの教室用スイッチ sw1 および sw2 を構成し、vlan 20 を構成します。
3. スイッチ sw0 の設定
各ネットワークセグメントのDHCP構成はDHCP(寮)とDHCP(教舎)のVLANを分け、その他のインターフェースはトランクモードに設定
Switch>
Switch>
Switch>en
Switch#conf
Switch#configure t
Switch#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
Switch(config)#
Switch(config)#h
Switch(config)#hostname sw0
sw0(config)#vlan 10
sw0(config-vlan)#vlan 20
sw0(config-vlan)#exit
sw0(config)#int
sw0(config)#interface f
sw0(config)#interface fastEthernet 0/1
sw0(config-if)#sw
sw0(config-if)#switchport m
sw0(config-if)#switchport mode t
sw0(config-if)#switchport mode trunk
sw0(config-if)#exit
sw0(config)#int
sw0(config)#interface f
sw0(config)#interface fastEthernet 0/2
sw0(config-if)#sw
sw0(config-if)#switchport a
sw0(config-if)#switchport access v
sw0(config-if)#switchport access vlan 10
sw0(config-if)#exit
sw0(config)#int
sw0(config)#interface f
sw0(config)#interface fastEthernet 0/3
sw0(config-if)#sw
sw0(config-if)#switchport m
sw0(config-if)#switchport mode t
sw0(config-if)#switchport mode trunk
sw0(config-if)#exit
sw0(config)#int
sw0(config)#interface f
sw0(config)#interface fastEthernet 0/4
sw0(config-if)#sw
sw0(config-if)#switchport m
sw0(config-if)#switchport mode t
sw0(config-if)#switchport mode trunk
sw0(config-if)#exit
sw0(config)#
sw0(config)#int
sw0(config)#interface f
sw0(config)#interface fastEthernet 0/5
sw0(config-if)#sw
sw0(config-if)#switchport m
sw0(config-if)#switchport mode t
sw0(config-if)#switchport mode trunk
sw0(config-if)#exit
sw0(config)#int
sw0(config)#interface f
sw0(config)#interface fastEthernet 0/6
sw0(config-if)#sw
sw0(config-if)#switchport a
sw0(config-if)#switchport access v
sw0(config-if)#switchport access vlan 20
sw0(config-if)#exit
sw0(config)#int
sw0(config)#interface f
sw0(config)#interface fastEthernet 0/7
sw0(config-if)#sw
sw0(config-if)#switchport m
sw0(config-if)#switchport mode t
sw0(config-if)#switchport mode trunk
sw0(config-if)#
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/7, changed state to down
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/7, changed state to up
sw0(config-if)#exit
sw0(config)#
DHCP設定が成功し、端末が自動的にIP情報を取得します。
現時点では、同じ VLAN 内のデバイスには ping を送信できますが、異なる VLAN 内のデバイスには ping を送信できません。
4. レイヤ3スイッチの構成
まず、デバイス 4 の 3 層スイッチの vlan 機能を設定して、スイッチの機能を実現します。
Switch>
Switch>
Switch>en
Switch#conf
Switch#configure t
Switch#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
Switch(config)#h
Switch(config)#hostname 4
4(config)#vlan 20
4(config-vlan)#exit
4(config)#int
4(config)#interface vl
4(config)#interface vlan 20
%LINK-5-CHANGED: Interface Vlan20, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan20, changed state to up
4(config-if)#ad
4(config-if)#ip
4(config-if)#ip ad
4(config-if)#ip address 2.2.2.254 255.255.255.0
4(config-if)#no sh
4(config-if)#no shutdown
4(config-if)#exit
ping テスト: 現時点では、同じ VLAN 内のデバイスは相互に ping を送信できます。
5.寮VLANのルーティング設定(イントラネット2設定)
Router>
Router>en
Router#conf
Router#configure t
Router#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#h
Router(config)#hostname 2
2(config)#int
2(config)#interface f
2(config)#interface fastEthernet 0/0
2(config-if)#no sh
2(config-if)#no shutdown
%LINK-5-CHANGED: Interface FastEthernet0/0, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed state to up
2(config-if)#exit
2(config)#int
2(config)#interface f
2(config)#interface fastEthernet 0/0.10
%LINK-5-CHANGED: Interface FastEthernet0/0.10, changed state to up
2(config-subif)#
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0.10, changed state to up
2(config-subif)#e
2(config-subif)#e
2(config-subif)#e
2(config-subif)#en
2(config-subif)#encapsulation
2(config-subif)#encapsulation dot1Q 10
2(config-subif)#ip ad
2(config-subif)#ip address 1.1.1.254 255.255.255.0
2(config-subif)#exit
2(config)#ro
2(config)#router r
2(config)#router rip
2(config-router)#ne
2(config-router)#network 1.1.1.0
2(config-router)#exit
ターミナル寮での1pingテスト:合格可能
2、ルーティング OSPF 設定
イントラネット1ルーターの設定
2階→3階
Router>en
Router#conf
Router#configure t
Router#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#h
Router(config)#hostname 1
1(config)#int
1(config)#interface fa
1(config)#interface fastEthernet 0/0
1(config-if)#ip ad
1(config-if)#ip address 12.12.12.1 255.255.255.0
1(config-if)#no s
1(config-if)#no sh
1(config-if)#no shutdown
1(config-if)#
%LINK-5-CHANGED: Interface FastEthernet0/0, changed state to up
1(config-if)#fa
1(config-if)#int
1(config-if)#exit
1(config)#int
1(config)#interface f
1(config)#interface fastEthernet 0/1
1(config-if)#ip ad
1(config-if)#ip address 13.13.13.1 255.255.255.0
1(config-if)#no sh
1(config-if)#no shutdown
1(config-if)#
%LINK-5-CHANGED: Interface FastEthernet0/1, changed state to up
1(config-if)#exit
1(config)#int
1(config)#interface f
1(config)#interface e
1(config)#interface ethernet 0/1/0
1(config-if)#ip ad
1(config-if)#ip address 15.15.15.1 255.255.255.0
1(config-if)#no sh
1(config-if)#no shutdown
1(config-if)#
%LINK-5-CHANGED: Interface Ethernet0/1/0, changed state to up
exit
1(config)#ro
1(config)#router o
1(config)#router ospf 1
1(config-router)#ro
1(config-router)#router-id 1.1.1.1
1(config-router)#network 12.12.12.0 0.0.0.255 area 1
1(config-router)#network 13.13.13.0 0.0.0.255 area 1
1(config-router)#ne
1(config-router)#network 15.15.15.0 0.0.0.255 a
1(config-router)#network 15.15.15.0 0.0.0.255 area 0
1(config-router)#exit
イントラネット 2 のルーティング設定
2>
2>en
2#conf
2#configure t
2#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
2(config)#int
2(config)#interface f
2(config)#interface fastEthernet 0/1
2(config-if)#ip ad
2(config-if)#ip address 12.12.12.2 255.255.255.0
2(config-if)#no sh
2(config-if)#no shutdown
%LINK-5-CHANGED: Interface FastEthernet0/1, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to up
2(config-if)#exit
2(config)#int
2(config)#interface e
2(config)#interface ethernet 0/1/0
2(config-if)#ip ad
2(config-if)#ip address 24.24.24.1 255.255.255.0
2(config-if)#no sh
2(config-if)#no shutdown
%LINK-5-CHANGED: Interface Ethernet0/1/0, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface Ethernet0/1/0, changed state to up
2(config-if)#exit
2(config)#ro
2(config)#router o
2(config)#router ospf 1
2(config-router)#ro
2(config-router)#router-id 2.2.2.2
2(config-router)#do show ip osp
2(config-router)#do show ip osp
Routing Process "ospf 1" with ID 2.2.2.2
Supports only single TOS(TOS0) routes
Supports opaque LSA
SPF schedule delay 5 secs, Hold time between two SPFs 10 secs
Minimum LSA interval 5 secs. Minimum LSA arrival 1 secs
Number of external LSA 0. Checksum Sum 0x000000
Number of opaque AS LSA 0. Checksum Sum 0x000000
Number of DCbitless external and opaque AS LSA 0
Number of DoNotAge external and opaque AS LSA 0
Number of areas in this router is 0. 0 normal 0 stub 0 nssa
External flood list length 0
2(config-router)#do show ip rou
Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP
i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area
* - candidate default, U - per-user static route, o - ODR
P - periodic downloaded static route
Gateway of last resort is not set
1.0.0.0/24 is subnetted, 1 subnets
C 1.1.1.0 is directly connected, FastEthernet0/0.10
12.0.0.0/24 is subnetted, 1 subnets
C 12.12.12.0 is directly connected, FastEthernet0/1
24.0.0.0/24 is subnetted, 1 subnets
C 24.24.24.0 is directly connected, Ethernet0/1/0
2(config-router)#ne
2(config-router)#network 1.1.1.0 0.0.0.255 a
2(config-router)#network 1.1.1.0 0.0.0.255 area 1
2(config-router)#ne
2(config-router)#network 12.12.12.0 0.0.0.255 a
2(config-router)#network 12.12.12.0 0.0.0.255 area 1
2(config-router)#ne
2(config-router)#network 24.24.24.0 00.
2(config-router)#network 24.24.24.0 0.0.0.255 a
2(config-router)#network 24.24.24.0 0.0.0.255 area 1
2(config-router)#exit
2(config)#
この時点で、イントラネット 1 ルーターから寮に ping できるようになります。
イントラネット 3 のルーティング設定
Router>
Router>en
Router#conf
Router#configure t
Router#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#h
Router(config)#hostname 3
3(config)#int
3(config)#interface f
3(config)#interface fastEthernet 0/0
3(config-if)#ip a
3(config-if)#ip ad
3(config-if)#ip address 13.13.13.2 255.255.255.0
3(config-if)#no sh
3(config-if)#no shutdown
3(config-if)#
%LINK-5-CHANGED: Interface FastEthernet0/0, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed state to up
exit
3(config)#int
3(config)#interface f
3(config)#interface fastEthernet 0/1
3(config-if)#ip ad
3(config-if)#ip address 34.34.34.0 255.255.255.0
Bad mask /24 for address 34.34.34.0
3(config-if)#ip address 34.34.34.1 255.255.255.0
3(config-if)#no sh
3(config-if)#no shutdown
%LINK-5-CHANGED: Interface FastEthernet0/1, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to up
3(config-if)#exit
3(config)#int
3(config)#interface e
3(config)#interface ethernet 0/1/0
3(config-if)#ip ad
3(config-if)#ip address 3.3.3.254 255.255.255.0
3(config-if)#no sh
3(config-if)#no shutdown
%LINK-5-CHANGED: Interface Ethernet0/1/0, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface Ethernet0/1/0, changed state to up
3(config-if)#exit
3(config)#rou
3(config)#router o
3(config)#router ospf 1
3(config-router)#ro
3(config-router)#router-id 3.3.3.3
3(config-router)#do show ip rou
Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP
i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area
* - candidate default, U - per-user static route, o - ODR
P - periodic downloaded static route
Gateway of last resort is not set
3.0.0.0/24 is subnetted, 1 subnets
C 3.3.3.0 is directly connected, Ethernet0/1/0
13.0.0.0/24 is subnetted, 1 subnets
C 13.13.13.0 is directly connected, FastEthernet0/0
34.0.0.0/24 is subnetted, 1 subnets
C 34.34.34.0 is directly connected, FastEthernet0/1
3(config-router)#ne
3(config-router)#network 3.3.3.3 0.0.0.255 a
3(config-router)#network 3.3.3.3 0.0.0.255 area 1
3(config-router)#ne
3(config-router)#network 13.13.13.0 0.0.0.255 a
3(config-router)#network 13.13.13.0 0.0.0.255 area 1
3(config-router)#n
3(config-router)#ne
3(config-router)#network 34.34.34
01:18:03: %OSPF-5-ADJCHG: Process 1, Nbr 1.1.1.1 on FastEthernet0/0 from LOADING to FULL, Loading Done
.0
3(config-router)#network 34.34.34.0 0.0.0.255 a
3(config-router)#network 34.34.34.0 0.0.0.255 area 1
3(config-router)#exit
3(config)#
レイヤ 3 スイッチのルーティング設定
4>en
4#conf
4#configure t
4#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
4(config)#int
4(config)#interface f
4(config)#interface fastEthernet 0/2
4(config-if)#ip ad
4(config-if)#ip ad
4(config-if)#ip ad
4(config-if)#no sw
4(config-if)#no switchport
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/2, changed state to down
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/2, changed state to up
4(config-if)#ip ad
4(config-if)#ip address 24.24.24.2 255.255.255.0
4(config-if)#no sh
4(config-if)#no shutdown
4(config-if)#exit
4(config)#int
4(config)#interface f
4(config)#interface fastEthernet 0/3
4(config-if)#no s
4(config-if)#no sw
4(config-if)#no switchport
4(config-if)#
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/3, changed state to down
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/3, changed state to up
4(config-if)#ip ad
4(config-if)#ip address 34.34.34.2 255.255.255.0
4(config-if)#no sh
4(config-if)#no shutdown
4(config-if)#exit
4(config)#rou
4(config)#router o
4(config)#router ospf 1
4(config-router)#rou
4(config-router)#router-id 4.4.4.4
4(config-router)#net
4(config-router)#do show ip rou
Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP
i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area
* - candidate default, U - per-user static route, o - ODR
P - periodic downloaded static route
Gateway of last resort is not set
2.0.0.0/24 is subnetted, 1 subnets
C 2.2.2.0 is directly connected, Vlan20
24.0.0.0/24 is subnetted, 1 subnets
C 24.24.24.0 is directly connected, FastEthernet0/2
34.0.0.0/24 is subnetted, 1 subnets
C 34.34.34.0 is directly connected, FastEthernet0/3
4(config-router)#net
4(config-router)#network 2.2.2.0 0.0.0.255 a
4(config-router)#network 2.2.2.0 0.0.0.255 area 1
4(config-router)#ne
4(config-router)#network 24.24.24.0 0.0.0.255 a
4(config-router)#network 24.24.24.0 0.0.0.255 area 1
4(config-router)#ne
4(config-router)#network 34.34.34.0
00:46:31: %OSPF-5-ADJCHG: Process 1, Nbr 2.2.2.2 on FastEthernet0/2 from LOADING to FULL, Loading Done
4(config-router)#network 34.34.34.0 0.0.0.255 a
4(config-router)#network 34.34.34.0 0.0.0.255 area 1
4(config-router)#exit
4(config)#
00:46:53: %OSPF-5-ADJCHG: Process 1, Nbr 3.3.3.3 on FastEthernet0/3 from EXCHANGE to FULL, Exchange Done
^Z
4#
%SYS-5-CONFIG_I: Configured from console by console
4#w
4#write
Building configuration...
[OK]
現時点では、左側から ping が可能です。
キャンパス 2 ルーティング設定
Router>
Router>en
Router#conf
Router#configure t
Router#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#h
Router(config)#hostname 5
5(config)#int
5(config)#interface f
5(config)#interface fastEthernet 0/0
5(config-if)#ip ad
5(config-if)#ip address 15.15.15.2 255.255.255.0
5(config-if)#no sh
5(config-if)#no shutdown
%LINK-5-CHANGED: Interface FastEthernet0/0, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed state to up
5(config-if)#exit
5(config)#rou
5(config)#router o
5(config)#router ospf 1
5(config-router)#rou
5(config-router)#router-id 5.5.5.5
5(config-router)#ne
5(config-router)#network 15.15.15.0 0.0.0.255 a
5(config-router)#network 15.15.15.0 0.0.0.255 area 0
5(config-router)#^Z
5#
%SYS-5-CONFIG_I: Configured from console by console
w
5#write
Building configuration...
[OK]
この時点で、すべての端末が
3、DNS、HTTP設定
DNSサーバーの設定
静的IPを設定する
構成インターフェースにHTTPサーバーのドメイン名とアドレスを追加します。
ルーターの設定
2>en
2#conf
2#configure t
2#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
2(config)#int
2(config)#interface e
2(config)#interface ethernet 0/0/0
2(config-if)#ip ad
2(config-if)#ip address 100.100.100.254 255.255.255.0
2(config-if)#no sh
2(config-if)#no shutdown
%LINK-5-CHANGED: Interface Ethernet0/0/0, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface Ethernet0/0/0, changed state to up
2(config-if)#^Z
2#
%SYS-5-CONFIG_I: Configured from console by console
2#w
2#write
Building configuration...
[OK]
HTTP設定
静的ルートの設定 3.3.3.254