Dydaktyka:
FeedbackUżywany do zajęć router (Cisco c921-4P) ma w środku mały wbudowany mostek (tzn. switch).
┌────────────────────────────────────────┐ │ Cisco c921-4P Vlan 1┌──────────┐ │ │ ┌╶╶╶╶╶╶╶╶╶╶╶╶┤ CPU │ │ │ ┌──────────║─────────┐ └─┬──────┬─┘ │ │ │ Wbudowany mostek │ ┆Gi4 ┆Gi5 │ │ │ ┆ ┆ ┆ ┆ │ ┆ ┆ │ └──┴──║────║────║────║──┴────║──────║────┘ Gi0 Gi1 Gi2 Gi3 Gi4 Gi5
Konfigurując porty Gi0
÷Gi3
trzeba pamiętać, że cały mostek jest połączony
z procesorem routera jedną szyną, zachowującą się jak port trunk.
Dlatego na portach Gi0
÷Gi3
nie można bezpośrednio nadać adresów IP – adresy
należy nadać na odpowiednim interfejsie Vlan N
. Domyślnie wszystkie
te porty są w VLANie 1, czyli żeby nadać routerowi adres IP (który będzie dostępny
z każdego z tych portów) należy do nadać na interfejsie Vlan 1
.
Interfejsy Gi4
i Gi5
są bezpośrednio połączone do procesora, więc można je
normalnie konfigurować.
no …
– odwraca działanie komendy
Tryb użytkownika - prompt >
ping <ip>
traceroute <ip> [numeric]
show …
- pozwala na pokazanie (w tym trybie tylko części) stanu i ustawień enable
- przechodzi do trybu uprzywilejowanego
Tryb uprzywilejowany - prompt #
show …
- pozwala na pokazanie stanu i ustawień show interfaces
- (długa) informacja o interface'ach sieciowychshow interface description
- (skrótowa) informacja o interface'ach sieciowychshow interface status
- informacja o interfejsach wbudowanego sprzętowego mostkashow vlan-switch
- wyświetla konfigurację VLANów wbudowanego sprzętowego mostkashow interfaces trunk
- wyświetla konfigurację interfejsów trunk wbudowanego sprzętowego mostkashow ip interface brief
- podsumowanie interface'ów sieciowych (wspierających protokół IP)show ip route
- informacje o routingu (tablica tras)show ip route <ip>
- pokazanie trasy jaka jest wybierana do <ip>configure terminal
przechodzi do trybu konfiguracji
Tryb konfiguracji - prompt (config) #
hostname <nazwa>
- ustawienia nazwy routerarouter …
- ustawienia protokołów routinguip route <adres> <maska> <ip następnego skoku>
- dodanie trasy statycznej, np: ip route 172.16.0.0 255.255.0.0 192.168.0.254
0.0.0.0
z maską 0.0.0.0
interface <nazwa interface'u>
- wejście w tryb ustawień podanego interface'u - prompt (config-if) #
, np: interface Gi 4
– GigaEthernet (ethernet 1Gbit) interface Vlan 10
– konfiguracja VLANu ze znacznikiem 10 ip address <adres> <maska>
- ustawienie adresu, np: ip address 192.168.0.1 255.255.255.0
no shutdown
- włączenie interface'u switchport access vlan <numer>
- ustawia VLAN do którego należy port wbudowany sprzętowy mostekswitchport mode trunk
- ustawia port wbudowanego sprzętowego mostka jako przesyłający (znakowane) dane z wielu VLANówinterface range …
- konfiguruje kilka interfejsów naraz, działa jak dla omawianych wcześniej switchyinterface <nazwa_interfejsu>.<numer_podinterfejsu>
– konfiguracja podinterfejsu, potrzebna jeśli na interfejsie przychodzą ramki z wielu vlanów (z odpowiednimi znacznikami) np. interface GigaEthernet 5.2
(skracając: interface Gi5.2
) (config-subif)#
:encapsulation dot1Q <numer_vlana>
– przypisanie interfejsu do sieci vlan, np: encapsulation dot1Q 2
ip address <adres> <maska>
Dodatkowo:
ctrl+r
odświeża bieżącą linięctrl+shift+6
/ ctrl+shift+6, x
/ ctrl+alt+6
przerywa hostname lookup / ping etc.undebug all
wyłącza debug all
--- System Configuration Dialog --- Would you like to enter the initial configuration dialog? [yes/no]: noLista i stan interfejsów:
Router#show ip interface brief Interface IP-Address OK? Method Status Protocol GigabitEthernet0 unassigned YES unset up up GigabitEthernet1 unassigned YES unset up up GigabitEthernet2 unassigned YES unset down down GigabitEthernet3 unassigned YES unset down down GigabitEthernet4 unassigned YES unset administratively down down GigabitEthernet5 unassigned YES unset up up Vlan1 unassigned YES unset up up Router#show interfaces description Interface Status Protocol Description Gi0 up up Gi1 up up Gi2 down down Gi3 down down Gi4 admin down down Gi5 up up Vl1 up upLista i stan interfejsów wbudowanego switcha:
Router#show interface status Port Name Status Vlan Duplex Speed Type Gi0 connected 1 a-full a-1000 10/100BaseTX Gi1 connected 1 a-full a-1000 10/100BaseTX Gi2 notconnect 1 auto auto 10/100BaseTX Gi3 notconnect 1 auto auto 10/100BaseTX Router#show vlan-switch VLAN Name Status Ports ---- -------------------------------- --------- ------------------------------- 1 default active Gi0, Gi1, Gi2, Gi3Konfiguracja wbudowanego switcha, po której będą trzy grupy portów: [Gi0] → Vlan 3, [Gi1,Gi2] → Vlan 2, [Gi3] → połączenie trunk:
Router(config)#int gigabitEthernet 0 Router(config-if)#switchport access vlan 3 % Access VLAN does not exist. Creating vlan 3 Router(config-if)#exit Router(config)#interface range gigabitEthernet 1-2 Router(config-if-range)#switchport access vlan 2 % Access VLAN does not exist. Creating vlan 2 Router(config-if-range)#exit Router(config)#int gigabitEthernet 3 Router(config-if)#switchport mode trunk Router(config-if)#end Router#show interfaces status Port Name Status Vlan Duplex Speed Type Gi0 connected 3 a-full a-1000 10/100BaseTX Gi1 connected 2 a-full a-1000 10/100BaseTX Gi2 notconnect 2 auto auto 10/100BaseTX Gi3 connected trunk a-full a-1000 10/100BaseTX Router#show vlan-switch VLAN Name Status Ports ---- -------------------------------- --------- ------------------------------- 1 default active 2 VLAN0002 active Gi1, Gi2 3 VLAN0003 active Gi0 Router#show interfaces trunk Port Mode Encapsulation Status Native vlan Gi3 on 802.1q trunking 1 Port Vlans allowed on trunk Gi3 1-4094 Port Vlans allowed and active in management domain Gi3 1-3 Port Vlans in spanning tree forwarding state and not pruned Gi3 1-3Konfiguracja adresów IP na portach:
Router(config)#int GigabitEthernet 4 Router(config-if)#ip addr 10.0.1.1 255.255.255.0 Router(config-if)#no shutdown Router(config-if)#exit Router(config)#int GigabitEthernet5 Router(config-if)#ip address 192.168.5.5 255.255.255.0 Router(config-if)#exit Router(config)#interface Vlan 2 Router(config-if)#ip address 192.168.2.5 255.255.255.0 Router(config-if)#exit Router(config)#interface Vlan 3 Router(config-if)#ip address 192.168.3.5 255.255.255.0 Router#show ip interface brief Interface IP-Address OK? Method Status Protocol GigabitEthernet0 unassigned YES unset up up GigabitEthernet1 unassigned YES unset up up GigabitEthernet2 unassigned YES unset down down GigabitEthernet3 unassigned YES unset up up GigabitEthernet4 10.0.1.1 YES manual down down GigabitEthernet5 192.168.5.5 YES manual up up Vlan1 unassigned YES unset up up Vlan2 192.168.2.5 YES manual up up Vlan3 192.168.3.5 YES manual up upWyświetlenie i konfiguracja trasowania:
Router#show ip route Codes: L - local, C - connected, S - static, 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 i - IS-IS, su - IS-IS summary, 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, H - NHRP, l - LISP a - application route + - replicated route, % - next hop override, p - overrides from PfR Gateway of last resort is not set 192.168.2.0/24 is variably subnetted, 2 subnets, 2 masks C 192.168.2.0/24 is directly connected, Vlan2 L 192.168.2.5/32 is directly connected, Vlan2 192.168.3.0/24 is variably subnetted, 2 subnets, 2 masks C 192.168.3.0/24 is directly connected, Vlan3 L 192.168.3.5/32 is directly connected, Vlan3 192.168.5.0/24 is variably subnetted, 2 subnets, 2 masks C 192.168.5.0/24 is directly connected, GigabitEthernet5 L 192.168.5.5/32 is directly connected, GigabitEthernet5 Router(config)#ip route 172.23.0.0 255.255.0.0 192.168.3.1 Router(config)#ip route 172.31.3.0 255.255.255.0 192.168.3.1 Router(config)#ip route 172.22.0.0 255.255.0.0 192.168.2.1 Router(config)#ip route 0.0.0.0 0.0.0.0 192.168.5.254 Router#sh ip route Codes: L - local, C - connected, S - static, 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 i - IS-IS, su - IS-IS summary, 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, H - NHRP, l - LISP a - application route + - replicated route, % - next hop override, p - overrides from PfR Gateway of last resort is 192.168.5.254 to network 0.0.0.0 S* 0.0.0.0/0 [1/0] via 192.168.5.254 S 172.22.0.0/16 [1/0] via 192.168.2.1 S 172.23.0.0/16 [1/0] via 192.168.3.1 172.31.0.0/24 is subnetted, 1 subnets S 172.31.3.0 [1/0] via 192.168.3.1 192.168.2.0/24 is variably subnetted, 2 subnets, 2 masks C 192.168.2.0/24 is directly connected, Vlan2 L 192.168.2.5/32 is directly connected, Vlan2 192.168.3.0/24 is variably subnetted, 2 subnets, 2 masks C 192.168.3.0/24 is directly connected, Vlan3 L 192.168.3.5/32 is directly connected, Vlan3 192.168.5.0/24 is variably subnetted, 2 subnets, 2 masks C 192.168.5.0/24 is directly connected, GigabitEthernet5 L 192.168.5.5/32 is directly connected, GigabitEthernet5Testowanie łączności:
Router#ping 172.31.3.9 Type escape sequence to abort. Sending 5, 100-byte ICMP Echos to 172.31.3.9, timeout is 2 seconds: .!!!! Success rate is 80 percent (4/5), round-trip min/avg/max = 1/1/2 ms Router#traceroute 172.31.3.9 numeric Type escape sequence to abort. Tracing the route to 172.31.3.9 VRF info: (vrf in name/id, vrf out name/id) 1 192.168.3.1 60 msec 12 msec 20 msec 2 10.56.22.100 40 msec 52 msec 28 msec 3 10.153.97.3 32 msec 40 msec 40 msec 4 172.31.3.9 84 msec 68 msec 72 msecUżycie CDP do diagnostyki:
Router#show cdp neighbors Capability Codes: R - Router, T - Trans Bridge, B - Source Route Bridge S - Switch, H - Host, I - IGMP, r - Repeater, P - Phone, D - Remote, C - CVTA, M - Two-port Mac Relay Device ID Local Intrfce Holdtme Capability Platform Port ID MojRouter Gig 3 125 R B S C921-4P Gig 0 II_pietro Gig 1 144 R B S C921-4P Gig 0 TenZielony Gig 5 174 R B S C921-4P Gig 3 Total cdp entries displayed : 3
Popularny emulator korzystający z rzeczywistych obrazów systemu operacyjnego – GNS3 – umie wirtualizować wiele routerów CISCO.
Symulator sprzętu CISCO: https://www.netacad.com/courses/packet-tracer