Här visas konfigurationen av en L3 switch (3560) som VTP och DHCP server för VLAN 10, 20 och 30. Som VTP server kommer att distribuera VLAN-konfigurationer till VTP klienter (S1, S2, S3, och S4). Det intressanta med exemplet är att switchen ska dirigera nätverkstrafik precis som en router.
Kommunikationen mellan switcharna kräver trunk-funktioner och därför konfigureras trunk på MLS switch portar Fa/01, FA0/2, Fa0/3 och Fa0/4. De andra switchar har den förmåga att anpassa arbetssättet som trunk på portarna anslutna till MLS switchen och därför behöver de inte konfigureras.
Nätverkstopologi
Konfigurationer
- Switch> enable
- Switch# configure terminal
- Switch(config)# hostname MLS
- MLS(config)# vlan 10
- MLS(config-vlan)# name LAN10
- MLS(config-vlan)# exit
- MLS(config)# vlan 20
- MLS(config-vlan)# name LAN20
- MLS(config-vlan)# exit
- MLS(config)# vlan 30
- MLS(config-vlan)# name LAN30
- MLS(config-vlan)# exit
- MLS(config)# vlan 40
- MLS(config-vlan)# name LAN40
- MLS(config-vlan)# exit
- MLS(config)# vlan 100
- MLS(config-vlan)# name Management
- MLS(config-vlan)# exit
- MLS(config)# vtp mode server
- MLS(config)# vtp domain diginto.se
- MLS(config)# interface vlan 10
- MLS(config-if)# description Connected to LAN10
- MLS(config-if)# ip address 192.168.10.1 255.255.255.0
- MLS(config-if)# no shutdown
- MLS(config-if)# exit
- MLS(config)# interface vlan 20
- MLS(config-if)# description Connected to LAN20
- MLS(config-if)# ip address 192.168.20.1 255.255.255.0
- MLS(config-if)# no shutdown
- MLS(config-if)# exit
- MLS(config)# interface vlan 30
- MLS(config-if)# description Connected to LAN30
- MLS(config-if)# ip address 192.168.30.1 255.255.255.0
- MLS(config-if)# no shutdown
- MLS(config-if)# exit
- MLS(config)# interface vlan 40
- MLS(config-if)# description Connected to LAN40
- MLS(config-if)# ip address 192.168.40.1 255.255.255.0
- MLS(config-if)# no shutdown
- MLS(config-if)# exit
- MLS(config)# interface vlan 100
- MLS(config-if)# description Connected to Management
- MLS(config-if)# ip address 192.168.100.1 255.255.255.0
- MLS(config-if)# no shutdown
- MLS(config-if)# exit
- MLS(config)#
- MLS(config)# interface range fa0/1-4
- MLS(config-if)# switchport trunk encapsulation dot1q
- MLS(config-if)# switchport mode trunk
- MLS(config-if)# switchport trunk allowed vlan 10,20,30,40,100
- MLS(config-if)# end
- MLS#
- MLS(config)# ip dhcp excluded-address 192.168.10.1
- MLS(config)# ip dhcp excluded-address 192.168.20.1
- MLS(config)# ip dhcp excluded-address 192.168.30.1
- MLS(config)# ip dhcp excluded-address 192.168.40.1
- MLS(config)# ip dhcp pool dhcpLAN10
- MLS(DHCP-config)# network 192.168.10.0 255.255.255.0
- MLS(DHCP-config)# default-router 192.168.10.1
- MLS(DHCP-config)# dns-server 8.8.8.8
- MLS(DHCP-config)# domain-name diginto.se
- MLS(DHCP-config)# exit
- MLS(config)# ip dhcp pool dhcpLAN20
- MLS(DHCP-config)# network 192.168.20.0 255.255.255.0
- MLS(DHCP-config)# default-router 192.168.20.1
- MLS(DHCP-config)# dns-server 8.8.8.8
- MLS(DHCP-config)# domain-name diginto.se
- MLS(DHCP-config)# exit
- MLS(config)# ip dhcp pool dhcpLAN30
- MLS(DHCP-config)# network 192.168.30.0 255.255.255.0
- MLS(DHCP-config)# default-router 192.168.30.1
- MLS(DHCP-config)# dns-server 8.8.8.8
- MLS(DHCP-config)# domain-name diginto.se
- MLS(DHCP-config)# exit
- MLS(config)# ip dhcp pool dhcpLAN40
- MLS(DHCP-config)# network 192.168.40.0 255.255.255.0
- MLS(DHCP-config)# default-router 192.168.40.1
- MLS(DHCP-config)# dns-server 8.8.8.8
- MLS(DHCP-config)# domain-name diginto.se
- MLS(DHCP-config)# exit
- MLS(config)# end
- MLS#
- Switch> enable
- Switch# configure terminal
- Switch(config)# hostname S1
- S1(config)# vtp mode client
- S1(config)# interface fa 0/2
- S1(config)# switchport mode access
- S1(config)# switchport access vlan 10
- S1(config)# exit
- S1(config)# interface fa 0/3
- S1(config)# switchport mode access
- S1(config)# switchport access vlan 20
- S1(config)# exit
- S1(config)# interface fa 0/4
- S1(config)# switchport mode access
- S1(config)# switchport access vlan 30
- S1(config)# exit
- S1# show vtp status
- S1# show vlan brief
- Switch> enable
- Switch# configure terminal
- Switch(config)# hostname S2
- S2(config)# vtp mode client
- S2(config)# interface fa 0/2
- S2(config)# switchport mode access
- S2(config)# switchport access vlan 40
- S2(config)# exit
- S2# show vtp status
- S2# show vlan brief
- Switch> enable
- Switch# configure terminal
- Switch(config)# hostname S3
- S3(config)# vtp mode client
- S3(config)# interface fa 0/2
- S3(config-if)# switchport mode access
- S3(config-if)# switchport access vlan 10
- S3(config-if)# exit
- S3(config)# interface fa 0/3
- S3(config-if)# switchport mode access
- S3(config-if)# switchport access vlan 20
- S3(config-if)# exit
- S3(config)# interface fa 0/4
- S3(config-if)# switchport mode access
- S3(config-if)# switchport access vlan 30
- S3(config-if)# end
- S3# show vtp status
- S3# show vlan brief
- Switch> enable
- Switch# configure terminal
- Switch(config)# hostname S4
- S4(config)# vtp mode client
- S4(config)# interface fa 0/2
- S4(config-if)# switchport mode access
- S4(config-if)# switchport access vlan 100
- S4(config-if)# end
- S4# show vtp status
- S4# show vlan brief