2019/04/07

[CCNA Notes 8-3] Routing Between VLANs

不同的 VLAN 間溝通的方法有 :用 Router (1.有多個界面 2.單個界面跟做法)、L3 Switch(最常見的做法)。

1.多個界面:Router with a Separate Interface in Each VLAN

在[8-2]裡我們已經設好這兩台 Switch 及各電腦的 ip ,現在用一台 Router 來做 Routing ,因為有兩個 vlan 我們先用兩條線,不同的 vlan 的電腦請設好各自的 gateway。

SwitchA 的 fa0/23 跟 Router 的 fa0/0 規劃給 vlan 10走,SwitchA 的 fa0/24 與 Router fa0/1 給 vlan 20

Router(config)#int fa0/0
Router(config-if)#ip addr 192.168.10.254 255.255.255.0
Router(config-if)#no sh


Router(config)#int fa0/1
Router(config-if)#no sh
Router(config-if)#ip addr 192.168.20.254 255.255.255.0
Router(config-if)#do sh ip int b
Interface              IP-Address      OK? Method Status                Protocol
FastEthernet0/0        192.168.10.254  YES manual up                    up
FastEthernet0/1        192.168.20.254  YES manual up                    up
Vlan1                  unassigned      YES unset  administratively down down

Switch(config)#int fa 0/23
Switch(config-if)#switchport mode access
Switch(config-if)#switchport access vlan 10

Switch(config-if)#int fa0/24
Switch(config-if)#switchport mode access
Switch(config-if)#switchport access vlan 20

Switch(config-if)#do sh vlan
VLAN Name Status Ports
---- -------------------------------- --------- -------------------------------
1 default active Fa0/6, Fa0/7, Fa0/8, Fa0/9
                          Fa0/10, Fa0/11, Fa0/12, Fa0/13
                          Fa0/14, Fa0/15, Fa0/16, Fa0/17
                          Fa0/18, Fa0/19, Fa0/21, Fa0/22
10 HR active     Fa0/1, Fa0/2, Fa0/3, Fa0/23

20 Sales active  Fa0/4, Fa0/5, Fa0/24


PCA>ping 192.168.20.1.......D

Pinging 192.168.20.1 with 32 bytes of data:
Reply from 192.168.20.1: bytes=32 time=2ms TTL=127
Reply from 192.168.20.1: bytes=32 time=0ms TTL=127
Reply from 192.168.20.1: bytes=32 time=0ms TTL=127
Reply from 192.168.20.1: bytes=32 time=0ms TTL=127

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

PCA>ping 192.168.20.5........J

Pinging 192.168.20.5 with 32 bytes of data:
Request timed out.
Reply from 192.168.20.5: bytes=32 time=0ms TTL=127
Reply from 192.168.20.5: bytes=32 time=0ms TTL=127
Reply from 192.168.20.5: bytes=32 time=0ms TTL=127

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

2.單個界面 Router on a Stick

Router(config)#int fa0/1
Router(config-if)#no sh
Router(config-if)#int Fa0/0.10
Router(config-subif)#encapsulation dot1Q 10
Router(config-subif)#ip address 192.168.10.254 255.255.255.0

Router(config-if)#interface FastEthernet0/0.20
Router(config-subif)#encapsulation dot1Q 20
Router(config-subif)#ip address 192.168.20.254 255.255.255.0

Switch(config)#int fa 0/21
Switch(config-if)#switchport mode trunk

PCA>ping 192.168.20.3........H
Pinging 192.168.20.3 with 32 bytes of data:
Request timed out.
Reply from 192.168.20.3: bytes=32 time=0ms TTL=127
Reply from 192.168.20.3: bytes=32 time=0ms TTL=127
Reply from 192.168.20.3: bytes=32 time=0ms TTL=127
Ping statistics for 192.168.20.3:
Packets: Sent = 4, Received = 3, Lost = 1 (25% loss),
Approximate round trip times in milli-seconds:

Minimum = 0ms, Maximum = 0ms, Average = 0ms

沒有留言: