Tuesday, January 25, 2022

Programming a Cisco Router - The Basics

 

Programming a Cisco Router - The Basics



This is a sample Cisco router configuration, anything after the "!" character on each line is a router comment line and need not be typed in. Comments are displayed in italics to make them easier for you to see. Lines in blue are the actual commands that will need to be entered into the router. To program a new Cisco, exit the automatic configuration script, enter the configuration mode, and type in the lines below, substituting the data as needed.

To enter configuration mode telnet to your router and login. Next enter the password and hit enter. Type enable and enter your enable password. Finally, type conf t and hit enter. You will see a prompt that looks something like "dc(config)#" Where dc will be the name of your router as defined in the hostname statement of your configuration.

When you are done entering programming statements type ^z and type wr. This will exit the configuration terminal and write the changes to your routers flash memory. If you are unsure of the changes do not type WR until you know the changes are working. If you've made a mistake, simply power cycle the router to clear all the changes you have made. Once you type WR you will have to reprogram the router in order to correct any problems.

!
hostname Router ! see below
hostname (name of router)
!
!  Put in a meaningful hostname instead of router. This will also
!  determine how your prompt looks.
!
!
interface Ethernet0
int e0
  ip address xxx.xxx.xxx.1 255.255.255.0
! see below
  
ip address (your class C.1) 255.255.255.0
!
!   Put in your class C address above, ending in .1. This tells the
!   router which IP address to route to your LAN. Each Class C
!   assigned must be added here or packets destined for those IP
!   address will not be forwarded to your LAN.
!
!
interface Serial0
int s0
  ip address 199.190.66.218 255.255.255.0 ! see below
  ip address 199.190.(hub class C).(your DLCI) 255.255.255.0
!

If your hub is:

Use This Address:

DC5a

199.190.74.X

DC5b

199.190.66.X

DC2

199.190.77.X

SC5a

199.190.67.X

SC5b

199.190.69.X

SC3

199.190.72.X

LA1

199.190.71.X

!
!  where "X" above is your DLCI number. You will
!  have to call the NOC to get this number.
!
  ip access-group 101 out
!
!  This keeps your users from IP spoofing. There are a few lines
!  involved in setting this up. See below.
!
  encapsulation frame-relay
  encapsulation frame-relay
!
  frame-relay map ip 199.190.66.1 111 IETF ! see below
  frame-relay map ip (Hub IP) (Hub DLCI) IETF
!

If your hub is:

Use This Address:

Use This DLCI:

DC5a

199.190.74.X

72

DC5b

199.190.66.X

111

DC2

199.190.77.X

various

SC5a

199.190.67.X

100

SC5b

199.190.69.X

101

SC3

199.190.72.X

16

LA1

199.190.71.X

17

!
!
  frame-relay lmi-type ansi
  frame-relay lmi-type ansi
!
interface Serial1 ! Will not be operational in most routers
   no ip address
   shutdown
!
no ip classless
  ip route 0.0.0.0 0.0.0.0 199.190.66.1 ! see below
  ip route 0.0.0.0 0.0.0.0 (router IP number)
!

If your hub is:

Use This Address:

DC5a

199.190.74.1

DC5b

199.190.66.1

DC2

199.190.77.1

SC5a

199.190.67.1

SC5b

199.190.69.1

SC3

199.190.72.1

LA1

199.190.71.1

!
access-list 101 permit ip XXX.XXX.XXX.0 any ! see below
!
!  
ip access-group 101 out
!  
access-list 101 permit ip (your class C.0) 0.0.0.255 any
!
line con 0
line con 0
  password XXXXX
  password (your login password)
  login
  login
!
line vty 0 4
line vty 0 4
  password XXXXX
  password (your enable mode password)
  login
  login
!