Cisco IOS & Commands - caitlinmallen/TechWiki GitHub Wiki

Cisco IOS & Commands

Configuring Different Settings
About Cisco

About Cisco

What is Cisco IOS?

  • Cisco Internetworking Operating System
  • Now used on most Cisco switches and routers
    • Some Cisco security appliances use a Linux-derived OS instead of Ciscso IOS

Cisco IOS Config File
Cisco IOS configurations are thought of as one big file

  • When entering a configuration command, you are essentially editing the file by adding, removing, or editing lines
  • Essentially two versions of the configuration file
    • Starup-config
      • Last version of what was saved. If the router/switch is restarted, these configurations would still load.
    • Running-config
      • Stored in memory and is not saved after power down.
      • To save running-config permanently there are two options:
        • copy running-config startup-config
        • copy run start\

CIOS Command Modes There are different "levels" of command and configuration options

  • User EXEC Mode
    • Basic monitoring and status commands
    • Would see 'Router>' displayed
  • Privileged EXEC Mode
    • Admin/root access
    • Would see 'Router>#' displayed
  • Global Config Mode
    • Device-wide configuration settings
    • Would see 'Router(config)#' displayed
  • Interface Config Mode
    • Configure interface settings
    • Would see 'Router(config-if)#' displayed\

Cisco IOS Helpful Tips

  • Up arrow displays last entered commands
  • Type '?' in current mode to see all options you can type or complete an existing command
  • TAB autocompletes

Configuring Different Settings

Configuring Switchports

  • Access Ports
  • configure - terminal
    • (configure-if)#interface [port_name-number]
    • (configure-if)#switchport mode access
    • (configure-if)#switchport access vlan [vlan-id#]
  • Trunk Ports
    • configure - terminal
    • (configure-if)#interface [port_name-number]
    • (configure-if)#switchport mode trunk
    • (configure-if)#switchport trunk allowed vlan [vlan-range]

DHCP

  • ip helper-address is important to remember
  • When assigning the IP helper address, use the eth0 interface IP of the DHCP server, that is the server address *(config)# interface vlan [vlan_id#] *(config-if)# ip helper-address [DHCPServer_Address]

NAT

  • Multi Step Process
  • Routing needs to be configured before NAT can be configured
    • enable
    • configure terminal
    • hostname [Hostname]
    • interface [interface being chosen, ex. fastEthernet 0/0]
    • ip adress [interface gateway address, ex. 30.0.0.1] [netmask, ex. 255.0.0.0]
    • no shutdown
    • exit
  1. Define the inside and outside interfaces
  • Inside is the interface connected to the private address, outside connected to the public address
  • interface fastEthernet 0/0
  • ip nat inside
  • exit
  • #interface serial 0/0/0
  • (config-if)# ip nat outside
  • exit
  1. Set NAT Rules
  • Static Mappings
  • ip nat inside source static [private ip] [public ip]
  • interfaces [inside interface]
  • exit
  • interface [outside interface]
  • ip nat outside
  • exit
  • exit
  1. For PAT
  • ip nat pool [pool name] [pool address] [pool address] netmask [netmask]
  • access-list [ACL ID] permit [source address] [netmask]
  • ip nat inside source list [ACL ID] pool [pool name] overload
  • exit
  • show ip nat translations

OSPF

  1. Configure network (if applicable)
    1. Check subnets
    2. Assign IPs
    3. Assign proper gateways to routers, if multiple, increase last octet by 1 to make sure packets can flow between routers and to machines
      1. Check machines to make sure they have proper gateways
    4. Enable interfaces on routers
    5. Get wildcard masks of subnets
      1. Google it or check Wiki for how to do that if Adam says no Google :/
  2. Configure OSPF on routers
    1. Enter the Cisco IOS command line
    2. enable > router ospf [instance_number] (Just put 1 for ease)
    3. Network [network_address] [wildcard_mask] area 0
  3. Do this on all routers for each subnet they are on
  4. Make sure machines can ping
  5. Enter back into routers to define a keychain
  6. enable > configure terminal
  7. key chain [name]
  8. key [key-id]
  9. key-string [name]
  10. cryptographic-algorithm [algorithm]
  11. send-lifetime [start-time] { infinite | end-time | duration seconds}
  12. Now we need to define authentication
  13. interface [type] [number]
  14. ip ospf authentication key-chain [name]

BGP

  1. Define router instance
    1. router bgp AS_Number_for_Router
    2. router bgp 1010
  2. Identify peers
    1. (config-router) neighbor ip_of_peer remote-as as-number_of_peer
    2. (config-router) neighbor 192.168.1.2remote-as 2352
  3. Advertise Networks
    1. (config-router) network 10.10.52.0mask 255.255.255.0
  4. If configuring redistribution of OSPF on border router
    1. To advertise networks shared through OSPF, the following command needs to be included in the BGP configuration
    2. redistribution ospf instance_number

Standard ACL

  1. R2(config)#ip access-list standard STND-1
  2. R2(config-std-nacl)#deny 192.168.11.0 0.0.0.255
  3. R2(config-std-nacl)#permit any
  4. R2(config-std-nacl)#interface Serial0/0/0
  5. R2(config-if)#ip access-group STND-1 in