Access control list standard

Router>en

Router#Configure terminal

Router(config)#ip access-list standard navnpådinliste

Router(config-std-nacl)#permit 10.3.2.25 255.255.255.0

Router(config-std-nacl)#access-list navnpådinliste deny any

Router(config-std-nacl)#exit

Router(config)#interface fastethernet 0/1

Router(config-if)#ip access-group navnpådinliste in

Router(config-if)#exit

 

Router>en

Router#show access-list navnpådinliste

Router#Configure terminal

Router(config)#interface fastethernet 0/1

Router(config-if)#ip access-group navnpådinliste in

Router(config-if)#exit

*Som standard når du implementerer en Access control list er alt trafik blokeret, så enten skal du permit og deny any, eller deny og permit any any

Access control list extended

Router>en

Router#Configure terminal

Router(config)#ip access-list extended navnpådinliste

Router(config-ext-nacl)#deny 10.3.2.25 0.0.0.3 192.168.2.4 0.0.0.255

Router(config-ext-nacl)#deny 10.3.2.33 0.0.0.3 192.168.5.2 0.0.0.255

Router(config-ext-nacl)#permit any any

Router(config-ext-nacl)#exit

Router(config)#interface fastethernet 0/1

Router(config-if)#ip access-group navnpådinliste in

Router(config-if)#exit

[/su_tab]

Alias

Router>en

Router#Configure terminal

Router(config)#alias exec C configure terminal

Router(config)#alias exec S show ip interface brief

Router(config)#alias exec S show ip interface brief

Router(config)#alias exec SR show running-config

Router(config)#exit

 
Banner/Messeage of the day

Router>en

Router>#Configure terminal

Router(config)#banner motd $ din besked $

Router(config)#exit

Et eksempel kunne være

SW1(config)# banner motd $

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

UNAUTHORIZED ACCESS IS PROHIBITED

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

$

Clock/time-date

Router>clock set ?

Router>en

Router#clock set [11:29:00] 7 januar 2016

Router>#exit

Console port password

Router>en

Router>#Configure terminal

Router(config)#Line console 0

Router(config-line)#password kodeord123

Router(config-line)#login

Router(config)#exit

Bypass security

  1. Restart
  2. Ved boot press break
  3. skriv confreg 0x2142
  4. skriv reset
  5. press ctrl + C

*På Lenovo T530 er break (FN + B) og ved brug af putty eller teraterm kan man vælge at køre break kommandoen fra menuen.

 
Default gateway

Router>en

Router>#Configure terminal

Router(config)#ip default-gateway 172.16.1.1

Router(config)#exit

 
Disable layer 3 routing

Router>en

Router#Configure terminal

Router(config)#interface fastethernet 0/1

Router(config)#no ip routing

Router(config)#exit

Domain lookup

Router>en

Router>#Configure terminal

Router(config)#ip domain-lookup

Router(config)#ip name-server 192.168.8.3 255.255.255.0

Router(config)#ip domain-list navnpåliste

Router(config)#ip domain-name mitdomæne.dk

Router(config)#exit

Router>en

Router>#Configure terminal

Router(config)#no ip domain-lookup

Router(config)#exit

*IP domain lookup er enabled som default, det er derfor vigtigt at slå fra hvis det ikke skal bruges.

*øverst er hvordan du sætte det op, nederst er hvordan du slår det fra.

 
Erase config

Router>en

Router#Configure terminal

Router(config)#erase startup-config

Router(config)#reload

Flash

Router>en

Router#show flash

Router#delete flash:“navnetfrashowflashkommandoen”

Router#exit

 
Generate crypto key

Router>en

Router>#Configure terminal

Router(config)#crypto key generate rsa

How many bits in the modules [512]: 1024

Router(config)#exit

 
Hostname

Router>en

Router>#Configure terminal

Router(config)#hostname herskrivesnavn

Router(config)#exit

 
Interface description

Router>en

Router#Configure terminal

Router(config)#interface fastethernet 0/1

Router(config-if)#description administrationsnetværket

Router(config)#exit

 
Interface IPv6 address

Router>en

Router#Configure terminal

Router(config)#interface fastethernet 0/1

Router(config-if)#ipv6 address FE80:0000:0000:0000:0202:B3FF:FE1E:8329

Router(config-if)#ipv6 address FE80::1 link-local

Router(config)#no shutdown

Router(config)#exit

 
Line history

Router>en

Router>#Configure terminal

Router(config)#line vty 0 4

Router(config-line)#history size 35

Router(config)#exit

Router>en

Router>#Configure terminal

Router(config)#line vty 0 4

Router(config-line)#no history

Router(config)#exit

*Øverst sætter hvor lang din history buffer size skal være og den nederste slår history fra. Default history size er 10.

 
Line timeout

Router>en

Router>#Configure terminal

Router(config)#line vty 0 4

Router(config-line)#history size 35

Router(config)#exit

 
OSPF – Open shortest path first

Router>en

Router#Configure terminal

Router(config)#router OSPF 1

Router(config)#network 10.0.0.0. 0.255.255.255 area 0

Router(config)#exit

 
Password

Router>en

Router>#Configure terminal

Router(config)#Enable secret kodeord123

Router(config)#exit

Router>en

Router>#Configure terminal

Router(config)#Enable password kodeord123

Router(config)#exit

Router>en

Router>#Configure terminal

Router(config)#security password min-length 25

Router(config)#exit

*Enable Secret krypterer dit password og kan ikke ses i clear text i en running-config log (krypteres ofte i type 5 med en MD5 random hash)

*Enable Password er ikke krypteret og kan ses i clear text og kan ses i en running-config log

 
Password encryption

Router>en

Router>#Configure terminal

Router(config)#service password-encryption

Router(config)#exit

 
Port security

Switch>en

Switch>#Configure terminal

Switch(config)#interface fastethernet0/1

Switch(config-if)#switchport mode access

Switch(config-if)#switchport port-security

Switch(config-if)#switchport port-security maximum 1

Switch(config-if)#switchport port-security violation shutdown

Switch(config-if)#switchport port-security mac-address 68b5.9965.1195

Switch(config)#exit

*Du kan også sætte din ip addresse til DHCP

*Violation reglen kan være enten: shutdown, protect, restrict.

*Du kan sætte “sticky” i stedet for en MAC addresse hvis interfacet dynamisk skal lære og konfigurere MAC addressen på en host, hver gang der tilkobler sig en på porten.

Forklaring

  1. Gør switchens interface til en access port
 SW1(config-if)# switchport mode access 

 

  1. Slå port security til på interfacet
 SW1(config-if)# switchport port-security 

 

  1. Sæt det maximale antal tilladte MAC addresser
 SW1(config-if)# switchport port-security maximum 1 
  1. Definer en handling hvis reglen brydes
 SW1(config-if)# switchport port-security violation shutdown 
  1. Specificer den tilladte MAC addresse
 switchport port-security mac-address 68b5.9965.1195 
Router modes

Router>                    User mode  (begrænset adagang)

Router#                    Privileged mode (Giver adgang til basis kommandoer)

 

Router(config)#            Global configuration mode (du kan ændre I indstillinger)

 

Router(config-if)#         Interface mode (du ændrer indstillinger på et interface)

 

Router(config-subif)#      Subinterface mode (du ændrer indstillinger på et subinterface/vlan)

 

Router(config-line)#       Line mode (console, vty, aux..)

 

Router(config-router)#     Router configuration mode

 

Router(config-line)#       Line interface mode (du ændre indstillingerne for console port)

 
Save configuration

Router>en

Router>#copy running-config startup-config

Router>en

Router>#write memory

*Disse kommandoer skriver dine ændringer til NVRAM

Et eksempel kunne være

 

 

SW1# copy running-config startup-config

Destination filename [startup-config]? ! Press enter to confirm file name.

Building configuration…

[OK]

 

Eller

SW1# wr

Building configuration…

[OK]
 
Set IP address

Router>en

Router>#Configure terminal

Router(config)#interface vlan 1

Router(config-if)#ip address 172.16.1.11 255.255.255.0

Router(config-if)#no shutdown

Router(config)#exit

*Du kan også sætte din ip addresse til DHCP

 
Show commands

Router>en

Router#show version

(viser information om switch og interfaces, ram, nvram,

flashm ios, osv..)

Router#show interface vlan 1

(viser specificeret information om status, protokol, duplex,

speed, encapsulation og de sidste 5 minutters trafik)

 

Router#show interfaces description

(Viser information om alle interfaces)

Router#show interfaces status

(viser status på alle interfaces som connected, duplex,

trunk, vlan)

Router#show crypto key mypubkey rsa

(viser public encryption key der bruges til SSH)

Router#shpw DHCP lease

(viser information om din DHCP lease)

Speed & duplex

Router>en

Router#Configure terminal

Router(config)#interface fastethernet 0/1

Router(config-if)#speed 100

Router(config-if)#duplex full

Router(config)#exit

*Speed kan også 10 – 100 – auto

*duplex kan være half – full – auto

Et eksempel kunne være

SW1(config)# interface fastEthernet 0/1

SW1(config-if)# description LINK TO INTERNET ROUTER

SW1(config-if)# speed 100 ! Options: 10, 100, auto

 

eller hvis man vil sætte for en hel range

 

SW1(config)# interface range fastEthernet 0/5 – 10

SW1(config-if-range)# duplex full (options: half, full, auto)

SSH configuration

Router>en

Router>#Configure terminal

Router(config)#ip domain-name mitdomæne.dk

Router(config)#username Mathias password kodeord123

Router(config)#crypto key generate rsa

How many bits in the modules [512]: 1024

Router(config)#ip ssh version 2

Router(config)#line vty 0 4

Router(config-line)#login local

Router(config-line)#transport input telnet ssh

Router(config)#exit

*I stedet for at skrive 2 som i telnet & ssh ovenover, kan man også nøjes med bare en type transport input.

 
Username & password

Router>en

Router>#Configure terminal

Router(config)#username Mahtias password kodeord123

Router(config)#exit

*Du kan også vælge secret i stedet for password hvis du gerne vil have det krypteret.

 
Vlan – SVI (Switch Virtual Interface)

Router>en

Router#Configure terminal

Router(config)#interface vlan 20

Router(config-if)#description produktionnetværket

Router(config-if)#ip address 10.0.0.1 255.255.255.0

Router(config)#exit

 
Vty password

Router>en

Router>#Configure terminal

Router(config)#Line vty 0 4

Router(config-line)#password kodeord123

Router(config-line)#login

Router(config)#exit

 
Serial DCE – DTE

Router>en

Router>#Configure terminal

Router(config)#int serial 0/0/0

Router(config-if)#Clock rate 250000

Router(config-if)#Exit

*Du kan finde ud af om din router er DCE (Data Circuit-terminating Equipment) eller DTE (Data Terminal Equipment) ved at bruge kommandoen: Show controller serial 0/0/0

*DCE sætter Clock-raten og DTE læser denne clock-raten.

 
Ip route

Router>en

Router>#Configure terminal

Router(config)#ip route 0.0.0.0 0.0.0.0 192.168.3.1

Router(config-if)#Exit

*En ip route fortæller en enhed router/switch hvor den skal sende trafik hen som den ikke ved hvad den skal gøre med. Dette betyder at hvis enheden ikke kan finde pakkens destination i dynamiske entries, så kan vi lave et statisk “Next hop” til pakkerne som en route. I vores tilfælde har vi fortalt den at alt hvad der kommer ind som den ikke ved hvor skal hen, uanset IP (0.0.0.0) eller subnet (0.0.0.0) skal vi sende til en enhed med IP’en (192.168.3.1).

 
IOS Shortcuts

Shortcut Description Mnemonic
Ctrl+W Delete the word to the left from the cursor W for Word
Ctrl+U Delete the whole line ??
Ctrl+T Swap or transpose the current character with the one before it T for Transpose
Ctrl+K Erase characters from the cursor to end of the line ??
Ctrl+X Erase characters from the cursor to beginning of the line ??
Esc+D Delete from Cursor to end of word
Delete Removes the character to the right of the cursor
Backspace Removes the character to the left of the cursor
Up Arrow Allows you to scroll forward through previous commands
Down Arrow Allows you to scroll backwards through previous commands
Functional Shortcuts
Shortcut Description Mnemonic
Ctrl+L Reprint the line L for Line
Ctrl+R Refresh R for Repeat – starts a new line, with the same command shown (If the system sends a message to the screen while a command is being entered and your are not using line synchonisation
Tab Command autocomplete No Comment
Ctrl+C Exit. Exit from config mode
Ctrl+Z Apply the command line and exit from config mode ie. return to privileged EXEC mode.
Ctrl+Shift+6 (X) CTRL-SHIFT-6 is one action, the X is the second action
Less Common Shortcuts
Shortcut Description Mnemonic
Esc, C Makes the letter at the cursor uppercase. C for Capital
Esc, L Changes the word at the cursor to lowercase L for Lower
Esc, U Makes letters from the cursor to the end of the word uppercase. U for Uppercase
Using the Delete Buffer
Shortcut Description Mnemonic
The buffer stores the last ten items that have been deleted using Ctrl-K, Ctrl-U, or Ctrl-X
Ctrl-Y Paste the most recent entry in the delete buffer Y for “Yank” as in Yank from buffer
Esc-Y Paste the Previous entry in the history buffer Y for “Yank” as in Yank from buffer
 
Vlan database

Router>en

Router>#vlan database

Router(vlan)#vlan 10

Router(vlan)#vlan 10 name testnetværk

Router(vlan)#apply

Router(vlan)#abort

*Hvis appy ikke virker, kan det være nødvendigt at lave en erase flash: først (pas dog på du ikke sletter noget du ikke skulle ha’ gjort).

 
VTP Server / Client

Router>en

Router>#Configure terminal

Router(config)#VTP mode server / client / transparent

Router(config)#VTP domain testdomæne

Router(config)#VTP password cisco123

*VTP server er den der fortæller sine vlans til de andre router/multilayer switche.
VTP client modtager dem

VTP transparent ignorere selv sendte vlans og sender dem videre til læring på andre enheder.

 
Trunk / Access

Switch>en

Switch#conf t

Switch(config)#vlan 10

Switch(config-vlan)#exit

Switch(config-vlan)#int gig0/1

Switch(config-if)#switchport mode trunk

Switch(config-if)#exit

Switch(config)#int range fa0/9 – fa0/14?

Switch(config-if-range)#switchport mode access

Switch(config-if-range)#switchport access vlan 10

Switch(config-if)#exit

*Se evt under Dokumenter -> Mine dokumenter -> Vlan opgave