Các bạn xây dựng mô hình như trong hình topo nhé !
Các bạn xây dựng mô hình như trong hình topo nhé !
Cấu hình trên SW0 (Bên trái)
Current configuration : 1256 bytes
!
version 12.2
no service timestamps log datetime msec
no service timestamps debug datetime msec
no service password-encryption
!
hostname Switch
!
!
spanning-tree mode pvst
!
interface FastEthernet0/1
switchport mode trunk
!
interface FastEthernet0/2
switchport access vlan 3
switchport mode access
!
interface FastEthernet0/3
switchport access vlan 3
switchport mode access
!
interface FastEthernet0/4
switchport access vlan 2
switchport mode access
!
interface FastEthernet0/5
switchport access vlan 2
switchport mode access
!
!
version 12.2
no service timestamps log datetime msec
no service timestamps debug datetime msec
no service password-encryption
!
hostname Switch
!
!
spanning-tree mode pvst
!
interface FastEthernet0/1
switchport mode trunk
!
interface FastEthernet0/2
switchport access vlan 3
switchport mode access
!
interface FastEthernet0/3
switchport access vlan 3
switchport mode access
!
interface FastEthernet0/4
switchport access vlan 2
switchport mode access
!
interface FastEthernet0/5
switchport access vlan 2
switchport mode access
!
Current configuration : 1256 bytes
!
version 12.2
no service timestamps log datetime msec
no service timestamps debug datetime msec
no service password-encryption
!
hostname Switch
!
!
spanning-tree mode pvst
!
interface FastEthernet0/1
switchport mode trunk
!
interface FastEthernet0/2
switchport access vlan 5
switchport mode access
!
interface FastEthernet0/3
switchport access vlan 5
switchport mode access
!
interface FastEthernet0/4
switchport access vlan 4
switchport mode access
!
interface FastEthernet0/5
switchport access vlan 4
switchport mode access
!
!
version 12.2
no service timestamps log datetime msec
no service timestamps debug datetime msec
no service password-encryption
!
hostname Switch
!
!
spanning-tree mode pvst
!
interface FastEthernet0/1
switchport mode trunk
!
interface FastEthernet0/2
switchport access vlan 5
switchport mode access
!
interface FastEthernet0/3
switchport access vlan 5
switchport mode access
!
interface FastEthernet0/4
switchport access vlan 4
switchport mode access
!
interface FastEthernet0/5
switchport access vlan 4
switchport mode access
!
Building configuration...
Current configuration : 1075 bytes
!
version 12.2
no service timestamps log datetime msec
no service timestamps debug datetime msec
no service password-encryption
!
hostname Router
!
!
!
!
!
ip dhcp pool Dai2
network 192.168.2.0 255.255.255.0
default-router 192.168.2.1
ip dhcp pool Dai3
network 192.168.3.0 255.255.255.0
default-router 192.168.3.1
ip dhcp pool Dai4
network 192.168.4.0 255.255.255.0
default-router 192.168.4.1
ip dhcp pool Dai5
network 192.168.5.0 255.255.255.0
default-router 192.168.5.1
!
!
!
!
!
!
!
!
!
!
!
!
!
interface FastEthernet0/0
no ip address
duplex auto
speed auto
!
interface FastEthernet0/0.2
encapsulation dot1Q 2
ip address 192.168.2.1 255.255.255.0
!
interface FastEthernet0/0.3
encapsulation dot1Q 3
ip address 192.168.3.1 255.255.255.0
!
interface FastEthernet1/0
no ip address
duplex auto
speed auto
!
interface FastEthernet1/0.4
encapsulation dot1Q 4
ip address 192.168.4.1 255.255.255.0
!
interface FastEthernet1/0.5
encapsulation dot1Q 5
ip address 192.168.5.1 255.255.255.0
!
ip classless
!
!
!
!
!
!
!
line con 0
line vty 0 4
login
!
!
!
end
Trên Switch0:
Code:
Switch> Switch>ena Switch#vlan database % Warning: It is recommended to configure VLAN from config mode, as VLAN database mode is being deprecated. Please consult user documentation for configuring VTP/VLAN in config mode. Switch(vlan)#vlan 2 name vlan2 VLAN 2 added: Name: vlan2 Switch(vlan)#vlan 3 name vlan3 VLAN 3 added: Name: vlan3 Switch(vlan)#exit APPLY completed. Exiting.... Switch# Switch#conf t Enter configuration commands, one per line. End with CNTL/Z. Switch(config)#int range f0/2-3 Switch(config-if-range)#switchport mode access Switch(config-if-range)#switchport access vlan 3 Switch(config-if-range)#exit Switch(config)#int rang f0/4-5 Switch(config-if-range)#switchport mode access Switch(config-if-range)#switchport access vlan 2 Switch(config-if-range)#exit Switch(config)#int f0/1 Switch(config-if)#switchport mode trunk Switch(config-if)#exit
Code:
Switch> Switch>ena Switch#vlan database % Warning: It is recommended to configure VLAN from config mode, as VLAN database mode is being deprecated. Please consult user documentation for configuring VTP/VLAN in config mode. Switch(vlan)#vlan 4 name vlan4 VLAN 4 added: Name: vlan5 Switch(vlan)#vlan 5 name vlan5 VLAN 3 added: Name: vlan5 Switch(vlan)#exit APPLY completed. Exiting.... Switch# Switch#conf t Enter configuration commands, one per line. End with CNTL/Z. Switch(config)#int range f0/2-3 Switch(config-if-range)#switchport mode access Switch(config-if-range)#switchport access vlan 5 Switch(config-if-range)#exit Switch(config)#int rang f0/4-5 Switch(config-if-range)#switchport mode access Switch(config-if-range)#switchport access vlan 4 Switch(config-if-range)#exit Switch(config)#int f0/1 Switch(config-if)#switchport mode trunk Switch(config-if)#exit
Code:
Router>ena Router#conf t Enter configuration commands, one per line. End with CNTL/Z. Router(config)#int f0/0 Router(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 Router(config-if)#exit Router(config)#int f1/0 Router(config-if)#no shutdown %LINK-5-CHANGED: Interface FastEthernet1/0, changed state to up %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet1/0, changed state to up Router(config-if)#exit Router(config)#ip dhcp pool Dai2 Router(dhcp-config)#network 192.168.2.0 255.255.255.0 Router(dhcp-config)#default-router 192.168.2.1 Router(dhcp-config)#exit Router(config)# Router(config)#ip dhcp pool Dai3 Router(dhcp-config)#network 192.168.3.0 255.255.255.0 Router(dhcp-config)#default-router 192.168.3.1 Router(dhcp-config)#exit Router(config)# Router(config)#ip dhcp pool Dai4 Router(dhcp-config)#network 192.168.4.0 255.255.255.0 Router(dhcp-config)#default-router 192.168.4.1 Router(dhcp-config)#exit Router(config)# Router(config)#ip dhcp pool Dai5 Router(dhcp-config)#network 192.168.5.0 255.255.255.0 Router(dhcp-config)#default-router 192.168.5.1 Router(dhcp-config)#exit Router(config)# Router(config)#int f0/0.2 %LINK-5-CHANGED: Interface FastEthernet0/0.2, changed state to up %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0.2, changed state to up Router(config-subif)#encapsulation dot1Q 2 Router(config-subif)#ip address 192.168.2.1 255.255.255.0 Router(config-subif)#exit Router(config)# Router(config)#int f0/0.3 %LINK-5-CHANGED: Interface FastEthernet0/0.3, changed state to up %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0.3, changed state to up Router(config-subif)#encapsulation dot1Q 3 Router(config-subif)#ip address 192.168.3.1 255.255.255.0 Router(config-subif)#exit Router(config)# Router(config)#int f1/0.4 %LINK-5-CHANGED: Interface FastEthernet1/0.4, changed state to up %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet1/0.4, changed state to up Router(config-subif)#encapsulation dot1Q 4 Router(config-subif)#ip address 192.168.4.1 255.255.255.0 Router(config-subif)#exit Router(config)#int f1/0.5 %LINK-5-CHANGED: Interface FastEthernet1/0.5, changed state to up %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet1/0.5, changed state to up Router(config-subif)#encapsulation dot1Q 5 Router(config-subif)#ip address 192.168.5.1 255.255.255.0 Router(config-subif)#exit Router(config)#exit