Tip IT

Tip Computer

Mobile App

Free Game

Tip IT

Style5[ImagesOnly]

News IT

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


ตัวอย่างนี้ LAN ใช้ Private IP (จึงจำเป็นต้องทำ NAT) และมีการทำ DHCP
LAN IP : 192.168.1.0/24
WAN IP : 202.129.50.240/30

กำหนด FastEthernet0 เป็น 192.168.1.1  255.255.255.0
กำหนด Serial0 เป็น 202.129.50.242  255.255.255.252

Speed : 128 Kbit
Encapsulation : PPP (ถ้าต้องต้องการเป็น hdlc ไม่ต้องกำหนดก็ได้ครับ เพราะเป็นค่า default อยู่แล้ว)

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

ตั้งชื่อของเราเตอร์ชื่อว่า "itwizard"
Router(config)#hostname itwizard

ตั้ง Password สำหรับความปลอดภัย (enable) เป็น cisco
itwizard(config)#enable password 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

กำหนด name-server เป็น 2 ตัว
itwizard(config)#ip name-server 202.129.16.69 202.129.27.134

คอนฟิกค่าของ Serial0
itwizard(config)#int s0
itwizard(config-if)#description itwizard  # กำหนด description ให้กับ Serial0 เป็น "itwizard"
itwizard(config-if)#ip address 202.129.50.242 255.255.255.252
itwizard(config-if)#bandwidth 128
itwizard(config-if)encapsulation ppp
itwizard(config-if)#no shut
itwizard(config-if)#exit

คอนฟิกค่าของ 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
itwizard(config-if)#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 : 1037 bytes
!
version 12.2
service timestamps debug datetime msec
service timestamps log datetime msec
no service password-encryption
!
hostname itwizard
!
enable password cisco
!
username itwizard password 0 cisco
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.info
     dns-server 202.129.16.69 202.129.27.134
     default-router 192.168.1.1
     lease 5
!
!
!
!
!
interface FastEthernet0
 ip address 192.168.1.1 255.255.255.0
 ip nat inside
 speed auto
!
interface Serial0
 bandwidth 128
 ip address 202.129.50.242 255.255.255.252
 ip nat outside
 encapsulation ppp
 no fair-queue
!
ip nat inside source list 7 interface Serial0 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
ลองศึกษาดูนะครับไม่อยากเกินไป และยังใช้ใด้ผลครับ


About Myname Michael

เว็บไซต์ ข่าวไอที อัพเดทข้อมูลข่าวสารเกี่ยวกับ ข่าวไอที ข่าวเทคโนโลยี บทความเรื่องราวทางคอมพิวเตอร์ อินเตอร์เน็ต สาระความรู้เกี่ยวกับ เทคโนโลยีใหม่ๆ
«
Next
Newer Post
»
Previous
Older Post

No comments:

Post a Comment