Narzędzia użytkownika

Narzędzia witryny


bio-sk:cisco-routing-statyczny

Różnice

Różnice między wybraną wersją a wersją aktualną.

Odnośnik do tego porównania

Both sides previous revision Poprzednia wersja
Nowa wersja
Poprzednia wersja
bio-sk:cisco-routing-statyczny [2024/11/21 16:44]
jkonczak [Układ portów na routerze używanym do zajęć]
bio-sk:cisco-routing-statyczny [2024/11/24 17:35] (aktualna)
jkonczak [Konfiguracja routerów CISCO z linii poleceń IOS]
Linia 7: Linia 7:
 <​html><​pre style="​line-height:​1em;​font-family:​DejaVu Sans Mono">​ <​html><​pre style="​line-height:​1em;​font-family:​DejaVu Sans Mono">​
 ┌────────────────────────────────────────┐ ┌────────────────────────────────────────┐
-│ Cisco c921-4P ​           ┌──────────┐ ​ │+│ Cisco c921-4P ​     Vlan 1┌──────────┐ ​ │
 │             ​┌╶╶╶╶╶╶╶╶╶╶╶╶┤ ​  ​CPU ​   │  │ │             ​┌╶╶╶╶╶╶╶╶╶╶╶╶┤ ​  ​CPU ​   │  │
 │  ┌──────────║─────────┐ ​ └─┬──────┬─┘ ​ │ │  ┌──────────║─────────┐ ​ └─┬──────┬─┘ ​ │
-│  │  Wbudowany mostek ​ │    ┆      ┆    +│  │  Wbudowany mostek ​ │    ┆Gi4   Gi5 
 │  │  ┆    ┆    ┆    ┆  │    ┆      ┆    │ │  │  ┆    ┆    ┆    ┆  │    ┆      ┆    │
 └──┴──║────║────║────║──┴────║──────║────┘ └──┴──║────║────║────║──┴────║──────║────┘
Linia 21: Linia 21:
 Dlatego na portach ''​Gi0''​÷''​Gi3''​ nie można bezpośrednio nadać adresów IP – adresy 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 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 +te porty są w VLANie 1, czyli żeby nadać routerowi adres IP (który będzie dostępny 
-wszystkich ​tych portów należy do nadać na interfejsie ''​Vlan 1''​.+każdego z tych portównależy do nadać na interfejsie ''​Vlan 1''​.
  
 Interfejsy ''​Gi4''​ i ''​Gi5''​ są bezpośrednio połączone do procesora, więc można je Interfejsy ''​Gi4''​ i ''​Gi5''​ są bezpośrednio połączone do procesora, więc można je
Linia 50: Linia 50:
   * ''​hostname <​nazwa>''​ - ustawienia nazwy routera   * ''​hostname <​nazwa>''​ - ustawienia nazwy routera
   * ''​router …''​ - ustawienia protokołów routingu   * ''​router …''​ - ustawienia protokołów routingu
-  * ''​ip 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''​+  * ''​ip 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''​ \\ trasę domyślną można dodać jako trasę do sieci ''​0.0.0.0''​ z maską ''​0.0.0.0'' ​
   * <​html><​div style="​display:​inline-block;​height:​16pt"></​div></​html>''​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 \\ Polecenia w trybie konfiguracji interface'​u:​   * <​html><​div style="​display:​inline-block;​height:​16pt"></​div></​html>''​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 \\ Polecenia w trybie konfiguracji interface'​u:​
     * ''​ip address <​adres>​ <​maska>''​ - ustawienie adresu, np: \\ ''​ip address 192.168.0.1 255.255.255.0''​     * ''​ip address <​adres>​ <​maska>''​ - ustawienie adresu, np: \\ ''​ip address 192.168.0.1 255.255.255.0''​
Linia 65: Linia 65:
   * ''​ctrl+shift+6''​ / ''​ctrl+shift+6,​ x''​ /  ''​ctrl+alt+6''​ przerywa hostname lookup / ping etc.   * ''​ctrl+shift+6''​ / ''​ctrl+shift+6,​ x''​ /  ''​ctrl+alt+6''​ przerywa hostname lookup / ping etc.
   * ''​undebug all''​ wyłącza ''​debug all''​   * ''​undebug all''​ wyłącza ''​debug all''​
 +
 +++++ Przykładowe wyniki poleceń |
 +<​html>​
 +<div style="​line-height:​100%;​ margin:0; padding:​0">​
 +Komunikat powitalny routera bez startowej konfiguracji – zawsze należy odpowiedzieć "​nie":​
 +<pre>
 +         --- System Configuration Dialog ---
 +
 +Would you like to enter the initial configuration dialog? [yes/no]: <​b>​no</​b>​
 +</​pre>​
 +
 +Lista i stan interfejsów:​
 +<pre>
 +Router#<​b>​show ip interface brief</​b>​
 +Interface ​                 IP-Address ​     OK? Method Status ​               Protocol
 +GigabitEthernet0 ​          ​unassigned ​     YES unset  <span style="​background-color:#​f001"​ title="​Włączony interfejs który nawiązał połączenie na warstie L1 i L2">​up</​span> ​                   up      ​
 +GigabitEthernet1 ​          ​unassigned ​     YES unset  up                    up      ​
 +GigabitEthernet2 ​          ​unassigned ​     YES unset  <span style="​background-color:#​f001"​ title="​Włączony interfejs który nie wykrył znalazł po drugiej stronie kabla włączonego urządzenia">​down</​span> ​                 down    ​
 +GigabitEthernet3 ​          ​unassigned ​     YES unset  down                  down    ​
 +GigabitEthernet4 ​          ​unassigned ​     YES unset  <span style="​background-color:#​f001"​ title="​Wyłączony interfejs">​administratively down</​span>​ down    ​
 +GigabitEthernet5 ​          ​unassigned ​     YES unset  up                    up      ​
 +<span style="​background-color:#​f001"​ title="​Interfejs na którym można ustawiać adresy IP tym portom Gi0÷Gi3, które należą do VLANu nr 1">​Vlan1</​span> ​                     unassigned ​     YES unset  up                    up     
 +
 +Router#<​b>​show interfaces description</​b> ​
 +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             ​up ​      
 +</​pre>​
 +
 +Lista i stan interfejsów wbudowanego switcha:
 +<pre>
 +Router#<​b>​show interface status</​b>​
 +
 +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#<​b>​show vlan-switch</​b> ​
 +
 +VLAN Name                             ​Status ​   Ports
 +---- -------------------------------- --------- -------------------------------
 +1    default ​                         active ​   Gi0, Gi1, Gi2, Gi3
 +</​pre>​
 +
 +Konfiguracja wbudowanego switcha, po której będą trzy grupy portów: [Gi0] → Vlan 3,
 +[Gi1,Gi2] → Vlan 2, [Gi3] → połączenie trunk:
 +<pre>
 +Router(config)#<​b>​int gigabitEthernet 0</b>
 +Router(config-if)#<​b>​switchport access vlan 3</b>
 +% Access VLAN does not exist. Creating vlan 3
 +Router(config-if)#<​b>​exit</​b>​
 +Router(config)#<​b>​interface range gigabitEthernet 1-2</​b>  ​
 +Router(config-if-range)#<​b>​switchport access vlan 2</​b> ​
 +% Access VLAN does not exist. Creating vlan 2
 +Router(config-if-range)#<​b>​exit</​b>​
 +Router(config)#<​b>​int gigabitEthernet 3</b>
 +Router(config-if)#<​b>​switchport mode trunk</​b>​
 +Router(config-if)#<​b>​end</​b>​
 +Router#<​b>​show interfaces status</​b> ​
 +
 +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#<​b>​show vlan-switch</​b>​
 +
 +VLAN Name                             ​Status ​   Ports
 +---- -------------------------------- --------- -------------------------------
 +1    default ​                         active ​   ​
 +2    VLAN0002 ​                        ​active ​   Gi1, Gi2
 +3    VLAN0003 ​                        ​active ​   Gi0
 +
 +Router#<​b>​show interfaces trunk</​b> ​
 +
 +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-3
 +</​pre>​
 +
 +Konfiguracja adresów IP na portach:
 +<pre>
 +Router(config)#<​b>​int GigabitEthernet 4</b>
 +Router(config-if)#<​b>​ip addr 10.0.1.1 255.255.255.0</​b>​
 +Router(config-if)#<​b>​no shutdown</​b>​
 +Router(config-if)#<​b>​exit</​b>​
 +Router(config)#<​b>​int GigabitEthernet5</​b>​
 +Router(config-if)#<​b>​ip address 192.168.5.5 255.255.255.0</​b>​
 +Router(config-if)#<​b>​exit</​b>​
 +Router(config)#<​b>​interface Vlan 2</b>
 +Router(config-if)#<​b>​ip address 192.168.2.5 255.255.255.0</​b> ​
 +Router(config-if)#<​b>​exit</​b>​
 +Router(config)#​i<​b>​nterface Vlan 3</b>
 +Router(config-if)#<​b>​ip address 192.168.3.5 255.255.255.0</​b>​
 +
 +Router#<​b>​show ip interface brief</​b> ​
 +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                    up    ​
 +</​pre>​
 +
 +
 +Wyświetlenie i konfiguracja trasowania:
 +<pre>
 +Router#<​b>​show ip route</​b> ​
 +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)#<​b>​ip route 172.23.0.0 255.255.0.0 192.168.3.1</​b>​
 +Router(config)#<​b>​ip route 172.31.3.0 255.255.255.0 192.168.3.1</​b>​
 +Router(config)#<​b>​ip route 172.22.0.0 255.255.0.0 192.168.2.1</​b> ​
 +Router(config)#<​b>​ip route 0.0.0.0 0.0.0.0 192.168.5.254</​b>​
 +
 +Router#<​b>​sh ip route</​b>​
 +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, GigabitEthernet5
 +</​pre>​
 +
 +Testowanie łączności:​
 +<pre>
 +Router#<​b>​ping 172.31.3.9</​b>​
 +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#<​b>​traceroute 172.31.3.9 numeric</​b>​
 +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 msec
 +</​pre>​
 +
 +Użycie CDP do diagnostyki:​
 +<pre>
 +Router#<​b>​show cdp  neighbors</​b>​
 +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
 +</​pre>​
 +</​div>​
 +</​html>​
 +++++
 +
  
 ==== [Ekstra] Symulacja routerów CISCO ==== ==== [Ekstra] Symulacja routerów CISCO ====
bio-sk/cisco-routing-statyczny.1732203894.txt.gz · ostatnio zmienione: 2024/11/21 16:44 przez jkonczak