ตัวอย่างการคอนฟิกเราเตอร์ Cisco ใช้กับ Frame Relay (LAN เป็น IP ปลอม)


ตัวอย่างนี้ LAN ใช้ Private IP มีการทำ NAT, DHCP และทำ Sub Interface 

LAN IP : 202.129.49.192/29
WAN IP : 192.168.1.0/24

กำหนดให้ค่าต่าง ๆ เป็นดังนี้ :
   - FastEthernet0 เป็น
192.168.1.1  255.255.255.0
   - Serial0
          - bandwidth  Speed เป็น
128 Kbit
          - encapsulation : 
frame-relay (ถ้าเป็นการติดต่อระหว่างเราเตอร์ cisco กับ cisco ใช้เป็น frame-relay เฉย ๆ ก็ ok แล้ว  แต่ถ้าเป็นการติดต่อระหว่างเราเตอร์ต่างยี่ห้อกันให้ใช้เป็น frame-relay IETF)
          - logging event
subif-link-status
          - logging event
dlci-status-change  
          - frame-relay lmi-type :
ansi ถ้าไม่กำหนดจะเป็นค่า default คือ cisco (ค่านี้ต้องตรงกับค่าบนตัว Frame relay Switch ครับ ฉะนั้นควรถามผู้ดูแล Frame relay switch ก่อนจะดีกว่านะครับ)
  

   - Serial0.1 (Sub interface ของ Serial0)
          - IP เป็น
202.129.50.242  255.255.255.252
          - frame-relay interface-dlci :
200

การคอนฟิกมีขั้นตอนทั้งหมดดังนี้ :
Router>ena
Router#conf t
Enter configuration commands, one per line. End with CNTL/Z.

ตั้งชื่อของเราเตอร์ชื่อว่า
"itwizard"

Router(config)#hostname itwizard

ตั้ง
Password สำหรับความปลอดภัย (enable) เป็น cisco (Assign the privileged level secret)
itwizard(config)#enable secret 0 cisco

กำหนดให้การเชื่อมต่อสาย
console มีการถาม username และ password โดยให้ใช้ user แบบ local (username ที่เพิ่มโดยใช้คำสั่ง username)
itwizard(config)#line console 0
itwizard(config-line)#
login local
itwizard(config-line)#
exit

เปิด
Port telnet โดยเมื่อมีการ telnet กำหนดให้ใช้ username แบบ local  (username ที่เพิ่มโดยใช้คำสั่ง username)
itwizard(config)#line vty 0 4
itwizard(config-line)#login local
itwizard(config-line)#exit


เพิ่ม
username ชื่อว่า "itwizard" โดยมี password เป็น "cisco"
itwizard(config)#username itwizard password cisco

เพิ่ม
username ชื่อว่า "adisorn" โดยมี password เป็น "SouthEngineer"
itwizard(config)#username ksorn privilege 0 secret 0 SouthEngineer

กำหนด
name-server เป็น 2 ตัว

itwizard(config)#ip name-server 202.129.16.69 202.129.27.134

คอนฟิกค่าของ
Serial0
(มีการทำ sub interface)
itwizard(config)#int s0
itwizard(config-if)#description itwizard  # กำหนด description ให้กับ Serial0 เป็น "itwizard"
itwizard(config-if)#bandwidth 128
itwizard(config-if)#encapsulation frame-relay
itwizard(config-if)#logging event subif-link-status
itwizard(config-if)#logging event dlci-status-change
itwizard(config-if)#frame-relay lmi-type ansi
itwizard(config-if)no shut

คอนฟิกค่าของ Serial0.1 (sub interface)
itwizard(config-if)#interface serial0.1 point-to-point
itwizard(config-subif)#description link to cental-office # กำหนด description เป็น "link to central-office" ให้กับ s0.1
itwizard(config-subif)#ip address 202.129.50.242 255.255.255.252
itwizard(config-subif)#frame-relay interface-dlci 200
itwizard(config-fr-dlci)#exit
itwizard(config-subif)#exit
itwizard(config)#

คอนฟิกค่าของ
FastEthernet0

itwizard(config)#int f0
itwizard(config-if)#ip address 192.168.1.1 255.255.255.0
itwizard(config-if)#no shut
itwizard(config-if)#exit

กำหนด
default route โดยชี้ไปยัง WAN IP ฝั่งตรงข้าม

itwizard(config)#ip route 0.0.0.0 0.0.0.0 202.129.50.241

คอนฟิกการจ่าย
IP อัตโนมัติ (DHCP)

itwizard(config)#ip dhcp excluded-address 192.168.1.2 192.168.1.10  #ห้ามจ่าย ip 192.168.1.2 - 10 ให้กับ client
itwizard(config)#ip dhcp pool network1
itwizard(dhcp-config)#network 192.168.1.0 255.255.255.0
itwizard(dhcp-config)#domain ipwizard
itwizard(dhcp-config)#dns-server 202.129.16.69 202.129.27.134
itwizard(dhcp-config)#default-router 192.168.1.1
itwizard(dhcp-config)#lease 30
itwizard(dhcp-config)#exit

การทำ
NAT
itwizard(config)#int f0
itwizard(config-if)#ip nat inside
itwizard(config-if)#exit
itwizard(config)#int s0.1
itwizard(config-subif)#ip nat outside
itwizard(config-if)#exit
itwizard(config)#ip nat inside source list 7 interface serial0 overload
itwizard(config)#access-list 7 permit 192.168.1.0 0.0.0.255
itwizard(config)#exit

บันทึกข้อมูล

itwizard#wr mem

เมื่อใช้คำสั่ง
sh run จะได้คอนฟิกทั้งหมดดังนี้ :

itwizard#sh run
Building configuration...

Current configuration : 1272 bytes
!
version 12.2
service timestamps debug datetime msec
service timestamps log datetime msec
no service password-encryption
!
hostname itwizard
!
enable secret 5 $1$rTGl$gVxIfRBCF2cvRHCPS2nYw1
!
username itwizard password 0 cisco
username ksorn privilege 0 secret 5 $1$n/92$V8sKjZvBDUavjcJLwhOxf1
ip subnet-zero
!
!
ip name-server 202.129.16.69
ip name-server 202.129.27.134
ip dhcp excluded-address 192.168.1.2 192.168.1.10
!
ip dhcp pool network1
 network 192.168.1.0 255.255.255.0
 domain-name itwizard
 dns-server 202.129.16.69 202.129.27.134
 default-router 192.168.1.1
 lease 30
!
!
!
!
!
interface FastEthernet0
 ip address 192.168.1.1 255.255.255.0
 ip nat inside
 speed auto
!
interface Serial0
 description itwizard
 bandwidth 128
 no ip address
 encapsulation frame-relay
 logging event subif-link-status
 logging event dlci-status-change
 no fair-queue
 frame-relay lmi-type ans
!
interface Serial0.1 point-to-point
 description link to cental-office
 ip address 202.129.50.242 255.255.255.252
 ip nat outside
 frame-relay interface-dlci 200
!
ip nat inside source list 7 interface Serial0.1 overload
ip classless
ip route 0.0.0.0 0.0.0.0 202.129.50.241
no ip http server
!
!
access-list 7 permit 192.168.1.0 0.0.0.255
!
!
line con 0
 login local
line aux 0
line vty 0 4
 login local
!
no scheduler allocate
end