วันพฤหัสบดีที่ 12 กันยายน พ.ศ. 2556

การใช้งาน Secondary IP Address

Secondary Address (Basic)
ปกติ แล้ว IP Address ที่เราใส่ลงบน Interface จะมีเพียงหมายเลขเดียว แต่จริงๆแล้วบน Interface นึงมันสามารถรองรับ IP Address ได้มากกว่า 1 IP โดยการใช้ IP Secondary แล้วเราจะใช้ในกรณ๊ไหนล่ะ ? ใช้ในกรณีที่ Interface ของ Router ที่เชื่อมต่ออยู่ด้วยมีหลาย Subnet และเครื่อง Cleint เหล่านั้นก็ต้องชี้ Gateway มาที่ Router เหมือนกัน แต่มันอยู่คนละ Subnet Address หรือ เมื่อเราเช่า Public IP มากจาก ISP 8 IP เพื่อให้กับ Server ต่างๆ ซึ่งอาจไม่เพียงพอต่อการใช้งาน เครื่อง Client อื่นๆก็ต้องใช้เป็น Private IP แต่เราต้องการให้ Client สามารถใช้งาน Internet ได้ด้วย
ดูจากตัวอย่างเบื้องต้น



เรา ก็เซ็ตขาฝั่ง LAN ของ Router ให้มี IP เป็น 2 ค่า ก็จะทำให้มี Gateway 2 ตัว บน Interface เดียวกันและก็ทำให้ 2 วงนี้สามารถใช้งาน Internet ได้เหมือนกันอีกด้วย (ถ้าเป็นกรณีนี้ใช้ Private IP ก็ทำ NAT ด้วย)
ตัวอย่างการ Config เบื้องต้น

ขาฝั่ง LAN

NetworkZone(config)#int fa0/0
NetworkZone(config-if)#ip address 218.111.24.1 255.255.255.248
NetworkZone(config-if)#ip address 192.168.1.254 255.255.255.0 secondary
NetworkZone(config-if)#no shut
NetworkZone(config-if)#exit

กำหนด Default Route ด้วย

NetworkZone(config)#ip route 0.0.0.0 0.0.0.0 218.111.25.1

ทำ NAT สำหรับ Private IP

NetworkZone(config)#access-list 1 permit 192.168.1.0 0.0.0.255
NetworkZone(config)#ip nat inside source list 1 interface serial0/0 overload
NetworkZone(config)#int fa0/0
NetworkZone(config-if)#ip nat inside
NetworkZone(config)#int s0/0
NetworkZone(config-if)#ip nat outside
*******************************************************************************
ลองทดสอบ Ping

Ping จาก Server ไป Gateway
Server1#ping 218.111.24.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 218.111.24.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 2/4/6 ms

Ping จาก Server ไป Internet
Server1#ping 218.111.25.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 218.111.25.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 5/7/14 ms

Ping จาก PC ไป Gateway
PC1#ping 192.168.1.254
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.1.254, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 2/2/3 ms

Ping จาก PC ไป Internet
PC1#ping 218.111.25.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 218.111.25.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 5/8/17 ms

ลอง Show run

A#sh run int fa0/0
Building configuration...
Current configuration : 83 bytes
!
interface FastEthernet0/0
ip address 192.168.1.254 255.255.255.0 secondary
ip address 218.111.24.1 255.255.255.248
duplex auto
speed auto
end

*******************************************************************************

เมื่อลองเอา IP Secondary ของ PC ออกดู

NetworkZone(config-if)#no ip address 192.168.1.254 255.255.255.0 secondary
แล้วลอง Ping จาก PC ไป Gateway
PC1#ping 192.168.1.254
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.1.254, timeout is 2 seconds:
.....
Success rate is 0 percent (0/5)

ทั้ง หมดก็เป็นตัวอย่างการทดสอบการใช้งาน IP Secondary เบื้องต้นนะครับ ซึ่งในความเป็นจริงแล้ว ยังสามารถใช้งานได้หลายแบบมากมายที่ต้องติดตามและศึกษากันต่อไปครับ

Credit : ReFeel

ไม่มีความคิดเห็น:

แสดงความคิดเห็น