===== [Ekstra] Katalog /dev/ ===== Podstawowa struktura katalogów w Linuksie: * [[https://pl.wikipedia.org/wiki/Filesystem_Hierarchy_Standard]] * ''man hier'' Katalog ''/dev/'' jest przeznaczony do plików reprezentujących **urządzenia**. Dla przykładu: * ''/dev/sda'' – pierwszy dysk twardy, * ''/dev/snd/hw*'' – karty dźwiękowe, * ''/dev/null'' – czarna dziura (data sink), * ''/dev/mem'' – pamięć RAM, * ''/dev/input/mice'' – myszy. Pliki **''/dev/tty*''** to pliki reprezentujące urządzenie **terminala**.\\ Pliki **''/dev/ttyS*''** to pliki reprezentujące urządzenie **terminala szeregowego**. ===== RS-232 (Przypomienie z innych przedmiotów) ===== [[http://pl.wikipedia.org/wiki/RS-232|RS-232]] - standard szeregowej transmisji danych. Kiedyś bardzo rozpowszechniony w informatyce. Dawniej łączono terminal z komputerem po RS-232, potem używano go do łączenia PC i podłączania urządzeń zewnętrznych do PC. Został zastąpiony przez standard USB, jednak w tej chwili wciąż wiele urządzeń wciąż korzysta / wspiera ten protokół. Na jego bazie powstało wiele nowych i powiązanych protokołów. Cisco używa części standardu RS-232 dotyczącej komunikacji do łączenia swoich produktów przez port zwany konsolą (console) z komputerami. Nie używa jednak standardowych gniazd, port konsoli jest gniazdem 8P8C. \\ Dla zainteresowanych: [[http://www.cisco.com/en/US/products/hw/routers/ps332/products_tech_note09186a0080094ce6.shtml|niestandardowe kable i złącza CISCO]] W niektórych komputerach i w laptopach nie montuje się portów COM, w razie potrzeby należy skorzystać z konwerterów usb-serial. Obsługa portu COM (nazwa portu szeregowego obsługującego standard RS-232 w komputerach) możliwa jest przy pomocy następujących narzędzi: * Linux: * ''minicom [-s]'' * ''picocom [-b9600] ///dev/ttyS0//'' (wyjście z picocom: ''ctrl+a ctrl+q'') * Windows: * ''hyperterminal'' (tylko do Windows XP) * ''putty'' Parametry: ilość bitów danych, stopu i parzystość (8N1), prędkość (9600, 115200), sterowanie przepływem… ===== CISCO IOS ===== Większość urządzeń CISCO pracuje pod kontrolą systemu [[http://en.wikipedia.org/wiki/Cisco_IOS|IOS]]. **[[http://www.cs.put.poznan.pl/mlibuda/routing_stat_Cisco.pdf|Slajdy]]** Poruszanie się w konsoli CISCO - http://www.cisco.com/c/en/us/td/docs/ios/12_2/configfun/configuration/guide/ffun_c/fcf001.html ''no …'' – odwraca działanie komendy\\ Tryb użytkownika - [[http://pl.wikipedia.org/wiki/Znak_zach%C4%99ty|prompt]] **''>''** * ''ping '' * ''traceroute [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 sieciowych * ''show ip interface brief'' - podsumowanie interface'ów sieciowych * ''show ip route'' - informacje o routingu (tablica tras) * ''show ip route '' - pokazanie trasy jaka jest wybierana do * ''configure terminal'' przechodzi do trybu konfiguracji Tryb konfiguracji - prompt **''(config) #''** * ''hostname '' - ustawienia nazwy routera * ''router …'' - ustawienia protokołów routingu * ''interface '' - wejście w tryb ustawień podanego interface'u - prompt **''(config-if) #''**, np: \\ ''interface Fa 0/0'' – FastEthernet (ethernet 100Mbit) \\ ''interface Gi 0/0'' – GigaEthernet (ethernet 1Gbit) \\ ''interface Se 0/0'' – Serial (szeregowegy) \\ Oznaczenie ''0/0'' wskazuje gdzie na routerze znajduje się port interfejsu – który moduł, która karta rozszerzeń, który port etc. [[https://learningnetwork.cisco.com/thread/78355|[1]]] [[http://www.cisco.com/image/gif/paws/62611/c2800_62611.pdf|[2]]] \\ Polecenia w trybie konfiguracji interface'u: * ''ip address '' - ustawienie adresu, np: \\ ''ip address 192.168.0.1 255.255.255.0'' * ''no shutdown'' - włączenie interface'u * ''clock rate '' - (dla połączenia __szeregowego__) ustawienie zegara, np. \\ ''clock rate 128000'' * ''ip route '' - dodanie trasy statycznej, np: \\ ''ip route 172.16.0.0 255.255.0.0 192.168.0.254'' Dodatkowo: * ''show running-config'' - konfiguracja (dostępna w trybie uprzywilejowanym) * ''show cdp neighbors'' - pokazuje sąsiednie urządzenia CISCO używając [[https://pl.wikipedia.org/wiki/Cisco_Discovery_Protocol|Cisco Discovery Protocol]] * ''exit'' wychodzi o jeden tryb w górę, działa do trybu uprzywilejowanego * ''disable'' wychodzi z trybu uprzywilejowanego (porównaj: ''enable'') * ''end'' / ''ctrl+z'' cofa się do trybu uprzywilejowanego * ''do '' pozwala wykonać komendę z wcześniejszego poziomu - np. komendę ''show ip route'' w trybie konfiguracji * ''ctrl+r'' odświeża bieżącą linię * ''?'' podpowiada możliwe komendy i ich składnie * ''tab'' autouzupełnia komendy * komendy można skracać (póki są jednoznaczne), np. zamiast ''configure terminal'' wystarczy ''conf t'' * ''ctrl+shift+6'' / ''ctrl+shift+6, x'' / ''ctrl+alt+6'' przerywa hostname lookup / ping etc. * ''undebug all'' wyłącza ''debug all'' ++++ Przykładowe wyniki poleceń |
R1>enable
R1#show ip interface brief
Interface                  IP-Address      OK? Method Status                Protocol
FastEthernet0/0            192.168.0.1     YES manual up                    up      
FastEthernet0/1            10.0.5.67       YES manual up                    up      
Serial1/0                  10.0.2.82       YES manual up                    up      
Serial1/1                  unassigned      YES unset  administratively down down    
Serial1/2                  unassigned      YES unset  administratively down down    
Serial1/3                  unassigned      YES unset  administratively down down    
R1#show protocols
Global values:
  Internet Protocol routing is enabled
FastEthernet0/0 is up, line protocol is up
  Internet address is 192.168.0.1/24
FastEthernet0/1 is up, line protocol is up
  Internet address is 10.0.5.67/22
Serial1/0 is up, line protocol is up
  Internet address is 10.0.2.82/30
Serial1/1 is administratively down, line protocol is down
Serial1/2 is administratively down, line protocol is down
Serial1/3 is administratively down, line protocol is down
R1#show interfaces FastEthernet0/1
FastEthernet0/1 is up, line protocol is up 
  Hardware is i82543 (Livengood), address is ca01.26a9.0006 (bia ca01.26a9.0006)
  Internet address is 10.0.5.67/22
  MTU 1500 bytes, BW 100000 Kbit/sec, DLY 100 usec, 
     reliability 255/255, txload 1/255, rxload 1/255
  Encapsulation ARPA, loopback not set
  Keepalive set (10 sec)
  Full-duplex, 100Mb/s, 100BaseTX/FX
  ARP type: ARPA, ARP Timeout 04:00:00
  Last input 00:00:08, output 00:00:08, output hang never
  Last clearing of "show interface" counters never
  Input queue: 0/75/0/0 (size/max/drops/flushes); Total output drops: 0
  Queueing strategy: fifo
  Output queue: 0/40 (size/max)
  5 minute input rate 0 bits/sec, 0 packets/sec
  5 minute output rate 0 bits/sec, 0 packets/sec
     306 packets input, 31299 bytes
     Received 35 broadcasts (0 IP multicasts)
     0 runts, 0 giants, 0 throttles 
     0 input errors, 0 CRC, 0 frame, 0 overrun, 0 ignored
     0 watchdog
     0 input packets with dribble condition detected
     354 packets output, 36082 bytes, 0 underruns
     0 output errors, 0 collisions, 1 interface resets
     0 unknown protocol drops
     0 babbles, 0 late collision, 0 deferred
     0 lost carrier, 0 no carrier
     0 output buffer failures, 0 output buffers swapped out
R1#show interfaces Serial1/0
Serial1/0 is up, line protocol is up 
  Hardware is M4T
  Internet address is 10.0.2.82/30
  MTU 1500 bytes, BW 1544 Kbit/sec, DLY 20000 usec, 
     reliability 255/255, txload 1/255, rxload 1/255
  Encapsulation HDLC, crc 16, loopback not set
  Keepalive set (10 sec)
  Restart-Delay is 0 secs
  Last input 00:00:07, output 00:00:08, output hang never
  Last clearing of "show interface" counters never
  Input queue: 0/75/0/0 (size/max/drops/flushes); Total output drops: 0
  Queueing strategy: fifo
  Output queue: 0/40 (size/max)
  5 minute input rate 0 bits/sec, 0 packets/sec
  5 minute output rate 0 bits/sec, 0 packets/sec
     182 packets input, 13698 bytes, 0 no buffer
     Received 182 broadcasts (0 IP multicasts)
     0 runts, 0 giants, 0 throttles 
     0 input errors, 0 CRC, 0 frame, 0 overrun, 0 ignored, 0 abort
     209 packets output, 14889 bytes, 0 underruns
     0 output errors, 0 collisions, 3 interface resets
     0 unknown protocol drops
     0 output buffer failures, 0 output buffers swapped out
     4 carrier transitions     DCD=up  DSR=up  DTR=up  RTS=up  CTS=up

R1#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
       + - replicated route, % - next hop override

Gateway of last resort is 10.0.4.42 to network 0.0.0.0

S*    0.0.0.0/0 [1/0] via 10.0.4.42
      10.0.0.0/8 is variably subnetted, 4 subnets, 3 masks
C        10.0.2.80/30 is directly connected, Serial1/0
L        10.0.2.82/32 is directly connected, Serial1/0
C        10.0.4.0/22 is directly connected, FastEthernet0/1
L        10.0.5.67/32 is directly connected, FastEthernet0/1
S     192.168.0.0/16 [1/0] via 192.168.0.254
      192.168.0.0/24 is variably subnetted, 2 subnets, 2 masks
C        192.168.0.0/24 is directly connected, FastEthernet0/0
L        192.168.0.1/32 is directly connected, FastEthernet0/0
R1#show ip route 192.168.12.34 
Routing entry for 192.168.0.0/16, supernet
  Known via "static", distance 1, metric 0
  Routing Descriptor Blocks:
  * 192.168.0.254
      Route metric is 0, traffic share count is 1
R1#show ip route 10.0.2.81  
Routing entry for 10.0.2.80/30
  Known via "connected", distance 0, metric 0 (connected, via interface)
  Routing Descriptor Blocks:
  * directly connected, via Serial1/0
      Route metric is 0, traffic share count is 1
R1#show ip route 150.254.32.130
% Network not in table
R1#enable                         
R1#configure terminal
Enter configuration commands, one per line.  End with CNTL/Z.
R1(config)#ip route 10.0.0.0 255.255.255.0 10.0.4.42 
R1(config)#ip route 10.0.1.0 255.255.255.0 10.0.4.42
R1(config)#end
R1#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
       + - replicated route, % - next hop override

Gateway of last resort is 10.0.4.42 to network 0.0.0.0

S*    0.0.0.0/0 [1/0] via 10.0.4.42
      10.0.0.0/8 is variably subnetted, 6 subnets, 4 masks
S        10.0.0.0/24 [1/0] via 10.0.4.42
S        10.0.1.0/24 [1/0] via 10.0.4.42
C        10.0.2.80/30 is directly connected, Serial1/0
L        10.0.2.82/32 is directly connected, Serial1/0
C        10.0.4.0/22 is directly connected, FastEthernet0/1
L        10.0.5.67/32 is directly connected, FastEthernet0/1
S     192.168.0.0/16 [1/0] via 192.168.0.254
      192.168.0.0/24 is variably subnetted, 2 subnets, 2 masks
C        192.168.0.0/24 is directly connected, FastEthernet0/0
L        192.168.0.1/32 is directly connected, FastEthernet0/0
R1#show ip route 10.0.0.1      
Routing entry for 10.0.0.0/24
  Known via "static", distance 1, metric 0
  Routing Descriptor Blocks:
  * 10.0.4.42
      Route metric is 0, traffic share count is 1
R1#ping 10.0.0.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 10.0.0.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 20/34/48 ms
R1#traceroute 10.0.0.1
Type escape sequence to abort.
Tracing the route to 10.0.0.1
VRF info: (vrf in name/id, vrf out name/id)
  1 10.0.4.42 32 msec 20 msec 16 msec
  2 10.0.1.1 20 msec 20 msec 20 msec
  3 10.0.0.1 32 msec 16 msec 24 msec
R1#traceroute www.gov.pl
Type escape sequence to abort.
Tracing the route to www.gov.pl (194.181.237.34)
VRF info: (vrf in name/id, vrf out name/id)
  1 10.0.4.42 20 msec 16 msec 20 msec
  2 10.0.1.2 16 msec 28 msec 32 msec
  3 poz-bng4.tpnet.pl (80.50.18.54) 28 msec 28 msec 32 msec
  4 poz-r3.tpnet.pl (80.50.122.53) 28 msec 28 msec 28 msec
  5 war-ar8.tpnet.pl (195.117.0.10) 32 msec 32 msec 40 msec
  6 nask-tpnet.tpnet.pl (80.50.115.62) 40 msec 24 msec 28 msec
  7 195.187.255.139 32 msec 36 msec 36 msec
  8 www.gov.pl (194.181.237.34) 32 msec 28 msec 28 msec
R1#traceroute www.gov.pl numeric
Type escape sequence to abort.
Tracing the route to 194.181.237.34
VRF info: (vrf in name/id, vrf out name/id)
  1 10.0.4.42 24 msec 20 msec 8 msec
  2 10.0.1.2 20 msec 20 msec 16 msec
  3 80.50.18.54 16 msec 20 msec 40 msec
  4 80.50.122.53 16 msec 16 msec 24 msec
  5 195.117.0.10 28 msec 28 msec 28 msec
  6 80.50.115.62 28 msec 24 msec 28 msec
  7 195.187.255.139 28 msec 28 msec 20 msec
  8 194.181.237.34 16 msec 20 msec 28 msec
R1#configure terminal 
Enter configuration commands, one per line.  End with CNTL/Z.
R1(config)#hostname Router_1
Router_1(config)#interface Serial ?
  <1-1>  Serial interface number

Router_1(config)#interface Serial 1/?
  <0-3>  Serial interface number

Router_1(config)#interface Serial 1/3 
Router_1(config-if)#clock rate ?
  With the exception of the following standard values not subject to rounding,

          1200 2400 4800 9600 14400 19200 28800 38400 
          56000 64000 128000 2015232 

  accepted clockrates will be bestfitted (rounded) to the nearest value
  supportable by the hardware.

  <246-8064000>    DCE clock rate (bits per second)

Router_1(config-if)#clock rate 128000
Router_1(config-if)#ip address 172.16.0.1 255.255.255.252
Router_1(config-if)#do show ip interface brief
Interface                  IP-Address      OK? Method Status                Protocol
FastEthernet0/0            192.168.0.1     YES manual up                    up      
FastEthernet0/1            10.0.5.67       YES manual up                    up      
Serial1/0                  10.0.2.82       YES manual up                    up      
Serial1/1                  unassigned      YES unset  administratively down down    
Serial1/2                  unassigned      YES unset  administratively down down    
Serial1/3                  172.16.0.1      YES manual administratively down down    
Router_1(config-if)#do show protocols         
Global values:
  Internet Protocol routing is enabled
FastEthernet0/0 is up, line protocol is up
  Internet address is 192.168.0.1/24
FastEthernet0/1 is up, line protocol is up
  Internet address is 10.0.5.67/22
Serial1/0 is up, line protocol is up
  Internet address is 10.0.2.82/30
Serial1/1 is administratively down, line protocol is down
Serial1/2 is administratively down, line protocol is down
Serial1/3 is administratively down, line protocol is down
  Internet address is 172.16.0.1/30
Router_1(config-if)#no shutdown 
*Apr 23 20:11:08.079: %LINK-3-UPDOWN: Interface Serial1/3, changed state to up
*Apr 23 20:11:09.087: %LINEPROTO-5-UPDOWN: Line protocol on Interface Serial1/3, changed state to up
*Apr 23 20:11:34.619: %LINEPROTO-5-UPDOWN: Line protocol on Interface Serial1/3, changed state to down
Router_1(config-if)#do show ip interface brief
Interface                  IP-Address      OK? Method Status                Protocol
FastEthernet0/0            192.168.0.1     YES manual up                    up      
FastEthernet0/1            10.0.5.67       YES manual up                    up      
Serial1/0                  10.0.2.82       YES manual up                    up      
Serial1/1                  unassigned      YES unset  administratively down down    
Serial1/2                  unassigned      YES unset  administratively down down    
Serial1/3                  172.16.0.1      YES manual up                    down    
Router_1(config-if)#do show protocols         
Global values:
  Internet Protocol routing is enabled
FastEthernet0/0 is up, line protocol is up
  Internet address is 192.168.0.1/24
FastEthernet0/1 is up, line protocol is up
  Internet address is 10.0.5.67/22
Serial1/0 is up, line protocol is up
  Internet address is 10.0.2.82/30
Serial1/1 is administratively down, line protocol is down
Serial1/2 is administratively down, line protocol is down
Serial1/3 is up, line protocol is down
  Internet address is 172.16.0.1/30
Router_1(config-if)#end      
Router_1#
*Apr 23 20:13:56.307: %SYS-5-CONFIG_I: Configured from console by console
Router_1#show running-config 
Building configuration...

Current configuration : 1601 bytes
!
! Last configuration change at 20:13:56 UTC Tue Apr 23 2019
upgrade fpd auto
version 15.2
service timestamps debug datetime msec
service timestamps log datetime msec
no service password-encryption
!
hostname Router_1
!
boot-start-marker
boot-end-marker
!
!
!
no aaa new-model
no ip icmp rate-limit unreachable
!
!
!
!
!         
!
ip name-server 10.0.1.206
ip cef
no ipv6 cef
!
multilink bundle-name authenticated
!
!
!
!
!
!
!
!
!
!
redundancy
!
!
ip tcp synwait-time 5
! 
!
!         
!
!
!
!
!
!
!
interface FastEthernet0/0
 ip address 192.168.0.1 255.255.255.0
 duplex auto
 speed auto
!
interface FastEthernet0/1
 ip address 10.0.5.67 255.255.252.0
 duplex auto
 speed auto
!
interface Serial1/0
 ip address 10.0.2.82 255.255.255.252
 serial restart-delay 0
 clock rate 8064000
!
interface Serial1/1
 no ip address
 shutdown
 serial restart-delay 0
!
interface Serial1/2
 no ip address
 shutdown
 serial restart-delay 0
!
interface Serial1/3
 ip address 172.16.0.1 255.255.255.252
 serial restart-delay 0
 clock rate 128000
!
ip default-gateway 10.0.4.42
ip forward-protocol nd
no ip http server
no ip http secure-server
!
!
ip route 0.0.0.0 0.0.0.0 10.0.4.42
ip route 10.0.0.0 255.255.255.0 10.0.4.42
ip route 10.0.1.0 255.255.255.0 10.0.4.42
ip route 192.168.0.0 255.255.0.0 192.168.0.254
!
no cdp log mismatch duplex
!
!
!
control-plane
!
!
!
mgcp profile default
!
!
!
gatekeeper
 shutdown
!
!
line con 0
 exec-timeout 0 0
 privilege level 15
 logging synchronous
 stopbits 1
line aux 0
 exec-timeout 0 0
 privilege level 15
 logging synchronous
 stopbits 1
line vty 0 4
 login
 transport input all
!
!
end

Router_1#
++++ ==== Łączenie routerów CISCO po połączeniu szeregowym ==== Używane połączenia szeregowe jest synchroniczne, tzn. potrzebuje zegara. Urządzenia nie są równorzędne, tylko jedna strona może nadawać zegar - nadaje go [[http://pl.wikipedia.org/wiki/Data_Communications_Equipment|DCE]], podczas gdy [[http://pl.wikipedia.org/wiki/Data_Terminal_Equipment|DTE]] dostosowuje się do niego. Przykładowa konfiguracja połączenia szeregowego jest na slajdach. ==== [Ekstra] sprzęt CISCO ==== WIC / HWIC / EHWIC to nazwy standardów kart rozszerzeń do sprzętu CISCO. [[http://pl.wikipedia.org/wiki/Gigabit_Interface_Converter|GBIC]], [[http://en.wikipedia.org/wiki/Small_form-factor_pluggable_transceiver|SFP i SFP+]] to standardy transceiverów; duża część sprzętu sieciowego wyższej klasy posiada złącza tego typu by umożliwić użycie dowolnego medium [transceiver = połączenie nadajnika i odbiornika] ==== [Ekstra] Symulacja routerów CISCO ==== Popularny emulator korzystający z rzeczywistych obrazów systemu operacyjnego: http://www.gns3.com/
przykładowy link gdzie da się znaleźć jakieś obrazy systemów: ftp://213.141.145.240/torrent/downloaded/ios/
Symulator sprzętu CISCO: https://www.netacad.com/courses/packet-tracer