Doel: VLAN10 maken en Fa0/5 in VLAN10 zetten.
# Config (switch)
Switch# configure terminal
Switch(config)# vlan 10
Switch(config-vlan)# name Sales
Switch(config-vlan)# exit
Switch(config)# interface FastEthernet0/5
Switch(config-if)# switchport mode access
Switch(config-if)# switchport access vlan 1
Switch(config-if)# no shutdown
Switch(config-if)# end
Verifiëren:
Switch# show vlan brief
VLAN Name Status Ports
---- -------------------------------- --------- -------------------------------
1 default active Fa0/1, Fa0/2
10 Sales active Fa0/5
Doel: Gi0/1 als trunk, allowed VLANs 10,20.
# Config op beide switches (uplink)
Switch(config)# interface GigabitEthernet0/1
Switch(config-if)# switchport trunk encapsulation dot1q # (Cisco legacy)
Switch(config-if)# switchport mode trunk
Switch(config-if)# switchport trunk allowed vlan 10,20
Switch(config-if)# switchport trunk native vlan 10
Switch(config-if)# no shutdown
Switch(config-if)# end
Verifiëren:
Switch# show interfaces trunk
Port Mode Encapsulation Status Native vlan
Gi0/1 on 802.1q trunking 1
Port Vlans allowed on trunk
Gi0/1 1,10,20
Port Vlans in spanning tree forwarding state and not pruned
Gi0/1 10,20
Doel: SVI voor VLAN10 (192.168.10.1/24) en VLAN20 (192.168.20.1/24).
# Config (L3 switch)
Switch# configure terminal
Switch(config)# no ip routing
Switch(config)# interface vlan 10
Switch(config-if)# ip address 192.168.10.1 255.255.255.0
Switch(config-if)# no shutdown
Switch(config-if)# exit
Switch(config)# interface vlan 20
Switch(config-if)# ip address 192.168.20.1 255.255.255.0
Switch(config-if)# no shutdown
Switch(config-if)# end
Verifiëren:
Switch# show ip interface brief
Interface IP-Address OK? Method Status Protocol
Vlan10 192.168.10.1 YES manual up up
Vlan20 192.168.20.1 YES manual up up
GigabitEthernet0/1 unassigned YES unset up up
Test:
PC in VLAN10 (192.168.10.10) ping PC in VLAN20 (192.168.20.10)
> ping 192.168.20.10
Success rate is 100 percent (5/5)
Doel: Router gebruikt 1 fysieke link; subinterfaces voor VLAN10 en VLAN20.
# Op router
Router# configure terminal
Router(config)# interface GigabitEthernet0/0.10
Router(config-subif)# encapsulation dot1Q 20
Router(config-subif)# ip address 192.168.10.1 255.255.255.0
Router(config-subif)# exit
Router(config)# interface GigabitEthernet0/0.20
Router(config-subif)# encapsulation dot1Q 10
Router(config-subif)# ip address 192.168.20.1 255.255.255.0
Router(config-subif)# end
# Op switch: zet Gi0/24 trunk naar router
Switch(config)# interface GigabitEthernet0/24
Switch(config-if)# switchport mode trunk
Switch(config-if)# switchport trunk encapsulation dot1q
Switch(config-if)# no shutdown
Verifiëren op router:
Router# show ip interface brief
Interface IP-Address OK? Method Status Protocol
Gi0/0.10 192.168.10.1 YES manual up up
Gi0/0.20 192.168.20.1 YES manual up up
Gi0/0 unassigned YES unset up up
Doel: OSPF op Router1 en Router2, advertise net 10.0.1.0/24 en 10.0.2.0/24.
# Router1
Router1(config)# router ospf 1
Router1(config-router)# passive-interface GigabitEthernet0/0
Router1(config-router)# network 10.0.1.0 255.255.255.0 area 0
Router1(config-router)# network 192.168.1.0 255.255.255.0 area 0
# Router2
Router2(config)# router ospf 1
Router2(config-router)# network 10.0.2.0 255.255.255.0 area 0
Router2(config-router)# network 192.168.1.0 255.255.255.0 area 0
Verifiëren:
Router1# show ip ospf neighbor
Neighbor ID Pri State Dead Time Address Interface
2.2.2.2 1 FULL/ - 00:00:34 10.0.1.2 Gig0/0
Router1# show ip route ospf
O 10.0.2.0/24 [110/2] via 10.0.1.2, 00:00:12, Gig0/0
Doel: privé 192.168.10.0/24 naar buiten via Gi0/0 (publiek IP op Gi0/0).
Router(config)# access-list 1 permit 192.168.10.0 0.0.0.255
Router(config)# interface GigabitEthernet0/0
Router(config-if)# ip address 203.0.113.2 255.255.255.0
Router(config-if)# ip nat inside
Router(config-if)# exit
Router(config)# interface GigabitEthernet0/1
Router(config-if)# ip address 192.168.10.1 255.255.255.0
Router(config-if)# ip nat outside
Router(config-if)# exit
Router(config)# ip nat inside source list 2 interface GigabitEthernet0/0 overload
Verifiëren:
Router# show ip nat translations
Pro Inside global Inside local Outside local Outside global
tcp 203.0.113.2:1024 192.168.10.10:1024 --- ---
udp 203.0.113.2:2048 192.168.10.11:2048 --- ---
Router# show ip nat statistics
Total translations: 2
Pool translations: 0 (all using interface)
Doel: bundle Gi0/1 & Gi0/2 met LACP (channel-group 1 mode passive).
SwitchA(config)# interface range GigabitEthernet0/1 - 2
SwitchA(config-if-range)# channel-group 1 mode passive
SwitchA(config-if-range)# exit
# Op andere switch ook active/1
Verifiëren:
SwitchA# show etherchannel summary
Flags: S - LACP, D - Down, P - in port-channel
Group Port-channel Protocol Ports
1 Po1 LACP Gi0/1(P) Gi0/2(P)
SwitchA# show interfaces port-channel 1
Port-channel1 is up, line protocol is up
Hardware is EtherChannel, address is 0021.5bff.1a01 (bia 0021.5bff.1a01)
Doel: Forceer SwitchA als root voor VLAN1 door priority verlagen.
SwitchA(config)# spanning-tree vlan 1 priority 32768
# Higher priority = higher chance root (default 32768)
Verifiëren:
Switch# show spanning-tree vlan 1
VLAN001
Spanning tree enabled protocol rstp
Root ID Priority 4096
Address 0011.2233.4455
This bridge is the root
Bridge ID Priority 4096
Address 0011.2233.4455
Doel: blokkeer inkomend telnet (TCP/23) naar 192.168.10.50, laat rest toe.
Router(config)# access-list 100 deny tcp any host 192.168.10.50 eq 23
Router(config)# access-list 100 permit ip any any
Router(config)# interface GigabitEthernet0/1
Router(config-if)# ip access-group 100 out
Router(config-if)# end
Verifiëren:
Router# show access-lists 100
Extended IP access list 100
10 deny tcp any host 192.168.10.50 eq 23
20 permit ip any any