PDA

View Full Version : Kiểm tra giúp cấu hình VLAN, routing, NAT, PAT



qtnhan
31-05-2006, 07:28 AM
Hi,

Tôi cần chia VLAN cho hệ thống mạng của cty nhưng không thể làm trực tiếp trên hệ thống khi chưa thể ktra cấu hình trước được vì hế thống đang chạy. Nhờ anh (chị) giúp tôi ktra cấu hình NAT, PAT, routing, VLAN của tôi đúng chưa.
Cấu hình của tôi như sau: (sơ đồ mạng trong file đính kèm)

Gateway Router
Unauthorized access prohibited !

User Access Verification

Router#show run
Building configuration...

Current configuration : 5533 bytes
!
version 12.1
no service single-slot-reload-enable
service timestamps debug uptime
service timestamps log datetime localtime
service password-encryption
!
hostname Router
!
enable secret 5 $1$EJGJ$NGFuGYYFzTK3ubh8SQRG70
!
!
!
ip subnet-zero
no ip domain-lookup
ip audit notify log
ip audit po max-events 100
!
!
!
interface FastEthernet0/0
description Connect to FastEthernet 0/10 switch 3550
ip address 192.168.0.254 255.255.255.0
ip nat inside
duplex auto
speed auto
!
interface Serial0/0
description Connect to ISP
ip address 203.162.100.106 255.255.255.252
no ip proxy-arp
ip nat outside
no cdp enable
!
ip nat inside source list 1 interface Serial0/0 overload
ip nat inside source static 192.168.10.230 203.162.101.230
ip nat inside source static 192.168.10.231 203.162.101.231
ip nat inside source static 192.168.10.232 203.162.101.232
ip nat inside source static 192.168.10.233 203.162.101.233
ip nat inside source static 192.168.10.234 203.162.101.234
ip nat inside source static 192.168.10.235 203.162.101.235
ip nat inside source static 192.168.10.236 203.162.101.236
ip nat inside source static 192.168.10.237 203.162.101.237
ip nat inside source static 192.168.10.238 203.162.101.238
ip nat inside source static 192.168.10.239 203.162.101.239
ip nat inside source static 192.168.10.240 203.162.101.240
ip nat inside source static 192.168.10.241 203.162.101.241
ip nat inside source static 192.168.10.242 203.162.101.242
ip nat inside source static 192.168.10.243 203.162.101.243
ip nat inside source static 192.168.10.244 203.162.101.244
ip classless
ip route 0.0.0.0 0.0.0.0 Serial0/0
no ip http server
!
!
access-list 1 deny 192.168.10.224 0.0.0.31
access-list 1 permit 192.168.0.0 0.0.255.255
snmp-server community public RO
banner motd ^CUnauthorized access prohibited !^C
!
line con 0
line aux 0
line vty 0 4
login local
!
end

Router#


Catalyst 3550-24-FX
Switch>enable
Switch#config terminal
Enter configuration commands, one per line. End with CNTL/Z.
Switch(config)#hostname 3550
3550(config)#enable password cisco
3550(config)#enable secret test
3550(config)#line vty 0 15
3550(config-line)#password cisco
3550(config-line)#login
3550(config-line)#^Z
3550#
00:15:08: %SYS-5-CONFIG_I: Configured from console by console
3550#conf t
3550#(config)ip subnet-zero
3550#(config)ip routing
3550#vlan database
3550(vlan)#vtp domain SONY
Changing VTP domain name from NULL to SONY
3550(vlan)#vtp mode server
Device mode already VTP SERVER.
3550(vlan)#vlan 10 name SERVER
VLAN 10 added:
Name: SERVER
3550(vlan)#vlan 20 name YP_VN1
VLAN 20 added:
Name: YP_VN1
3550(vlan)#vlan 30 name YP_VN2
VLAN 30 added:
Name: YP_VN2
3550(vlan)#vlan 40 name YP_KR
VLAN 40 added:
Name: YP_KR
3550(vlan)#vlan 50 name MOVINA1
VLAN 50 added:
Name: MOVINA_1
3550(vlan)#vlan 60 name MOVINA2
VLAN 60 added:
Name: MOVINA2
3550(vlan)#apply
APPLY completed.
3550(vlan)#exit
APPLY completed.
Exiting....
3550#config terminal
Enter configuration commands, one per line. End with CNTL/Z.
3550(config)#interface vlan 1
3550(config-if)#ip address 192.168.1.1 255.255.255.0
3550(config-if)#no shutdown
3550(config-if)#exit
00:17:26: %LINK-3-UPDOWN: Interface Vlan1, changed state to up
3550(config)#interface vlan 10
3550(config-if)#ip address 192.168.10.1 255.255.255.0
3550(config-if)#no shutdown
00:18:20: %LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan10, changed state to down
3550(config-if)#exit
3550(config)#interface vlan 20
3550(config-if)#ip address 192.168.20.1 255.255.255.0
3550(config-if)#no shutdown
3550(config-if)#
00:19:06: %LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan20, changed state to down
3550(config-if)#exit
3550(config)#interface vlan 30
3550(config-if)#ip address 192.168.30.1 255.255.255.0
3550(config-if)#no shutdown
3550(config-if)#
00:19:06: %LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan30, changed state to down
3550(config-if)#exit
3550(config)#interface vlan 40
3550(config-if)#ip address 192.168.40.1 255.255.255.0
3550(config-if)#no shutdown
3550(config-if)#
00:19:06: %LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan40, changed state to down
3550(config-if)#exit
3550(config)#interface vlan 50
3550(config-if)#ip address 192.168.50.1 255.255.255.0
3550(config-if)#no shutdown
3550(config-if)#
00:19:06: %LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan50, changed state to down
3550(config-if)#exit
3550(config)#interface vlan 60
3550(config-if)#ip address 192.168.60.1 255.255.255.0
3550(config-if)#no shutdown
3550(config-if)#
00:19:06: %LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan60, changed state to down
3550(config-if)#exit
3550#conf t
3550(config)#interface FastEthernet 0/1
3550(config-if)#switchport trunk encapsulation dot1q
3550(config-if)#switchport mode trunk
3550(config-if)#^Z
3550#conf t
3550(config)#interface FastEthernet 0/2
3550(config-if)#switchport trunk encapsulation dot1q
3550(config-if)#switchport mode trunk
3550(config-if)#^Z
3550#conf t
3550(config)#interface FastEthernet 0/3
3550(config-if)#switchport trunk encapsulation dot1q
3550(config-if)#switchport mode trunk
3550(config-if)#^Z
3550#conf t
3550(config)#interface FastEthernet 0/4
3550(config-if)#switchport trunk encapsulation dot1q
3550(config-if)#switchport mode trunk
3550(config-if)#^Z
3550#conf t
3550(config)#interface FastEthernet 0/5
3550(config-if)#switchport trunk encapsulation dot1q
3550(config-if)#switchport mode trunk
3550(config-if)#^Z
3550#conf t
3550(config)#interface FastEthernet 0/6
3550(config-if)#switchport trunk encapsulation dot1q
3550(config-if)#switchport mode trunk
3550(config-if)#^Z
3550#
00:20:11: %SYS-5-CONFIG_I: Configured from console by console

3550(config)#interface FastEthernet 0/10
Description Connect to Gateway Router
3550(config-if)#no switchport
3550(config-if)#ip address 192.168.0.1 255.255.255.0
3550(config-if)#no shutdown
00:14:35: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/10, changed state to downxit
3550(config)#exit
00:14:43: %SYS-5-CONFIG_I: Configured from console by console
3550#conf t
3550#(config)ip route 0.0.0.0 0.0.0.0 192.168.0.254
3550#(config)exit
3550#

Catalyst 2950C 1

SW01#vlan database
SW01(vlan)#vtp domain SONY
Changing VTP domain name from NULL to SONY
SW01(vlan)#vtp mode client
Setting device to VTP CLIENT mode.
SW01(vlan)#exit
In CLIENT state, no apply attempted.
Exiting....
SW01#config terminal
Enter configuration commands, one per line. End with CNTL/Z.
SW01(config)#interface FastEthernet 0/25
SW01(config-if)#switchport trunk encapsulation dot1q
SW01(config-if)#switchport mode trunk
SW01(config-if)#end
SW01#

Catalyst 2950C 2

SW02#vlan database
SW02(vlan)#vtp domain SONY
Changing VTP domain name from NULL to SONY
SW02(vlan)#vtp mode client
Setting device to VTP CLIENT mode.
SW02(vlan)#exit
In CLIENT state, no apply attempted.
Exiting....
SW02#config terminal
Enter configuration commands, one per line. End with CNTL/Z.
SW02(config)#interface FastEthernet 0/25
SW02(config-if)#switchport trunk encapsulation dot1q
SW02(config-if)#switchport mode trunk
SW02(config-if)#end
SW02#

Catalyst 2950C 3
SW03#vlan database
SW03(vlan)#vtp domain SONY
Changing VTP domain name from NULL to SONY
SW03(vlan)#vtp mode client
Setting device to VTP CLIENT mode.
SW03(vlan)#exit
In CLIENT state, no apply attempted.
Exiting....
SW03#config terminal
Enter configuration commands, one per line. End with CNTL/Z.
SW03(config)#interface FastEthernet 0/25
SW03(config-if)#switchport trunk encapsulation dot1q
SW03(config-if)#switchport mode trunk
SW03(config-if)#end
SW03#


Catalyst 2950C 4
SW04#vlan database
SW04(vlan)#vtp domain SONY
Changing VTP domain name from NULL to SONY
SW04(vlan)#vtp mode client
Setting device to VTP CLIENT mode.
SW04(vlan)#exit
In CLIENT state, no apply attempted.
Exiting....
SW04#config terminal
Enter configuration commands, one per line. End with CNTL/Z.
SW04(config)#interface FastEthernet 0/25
SW04(config-if)#switchport trunk encapsulation dot1q
SW04(config-if)#switchport mode trunk
SW04(config-if)#end
SW04#

Catalyst 2950C 5
SW05#vlan database
SW05(vlan)#vtp domain SONY
Changing VTP domain name from NULL to SONY
SW05(vlan)#vtp mode client
Setting device to VTP CLIENT mode.
SW05(vlan)#exit
In CLIENT state, no apply attempted.
Exiting....
SW05#config terminal
Enter configuration commands, one per line. End with CNTL/Z.
SW05(config)#interface FastEthernet 0/25
SW05(config-if)#switchport trunk encapsulation dot1q
SW05(config-if)#switchport mode trunk
SW05(config-if)#end
SW05#

Catalyst 2950C 6
SW06#vlan database
SW06(vlan)#vtp domain SONY
Changing VTP domain name from NULL to SONY
SW06(vlan)#vtp mode client
Setting device to VTP CLIENT mode.
SW06(vlan)#exit
In CLIENT state, no apply attempted.
Exiting....
SW06#config terminal
Enter configuration commands, one per line. End with CNTL/Z.
SW06(config)#interface FastEthernet 0/25
SW06(config-if)#description Connect to 3550
SW06(config-if)#switchport trunk encapsulation dot1q
SW06(config-if)#switchport mode trunk
SW06(config-if)#exit
SW06(config)#interface FastEthernet 0/1
SW06(config-if)#description FTP SERVER
SW06(config-if)#switchport mode access
SW06(config-if)#switchport acess vlan 10
SW06(config-if)#exit
SW06(config)#interface FastEthernet 0/2
SW06(config-if)#description Voice Gateway
SW06(config-if)#switchport mode access
SW06(config-if)#switchport acess vlan 10
SW06(config-if)#exit
SW06(config)#interface FastEthernet 0/3
SW06(config-if)#description Mail Server
SW06(config-if)#switchport mode access
SW06(config-if)#switchport acess vlan 10
SW06(config-if)#exit
SW06(config)#interface FastEthernet 0/4
SW06(config-if)#description Web Server
SW06(config-if)#switchport mode access
SW06(config-if)#switchport acess vlan 10
SW06(config-if)#end
SW06#

wlansecu
31-05-2006, 08:09 AM
Hi,

!
ip nat inside source list 1 interface Serial0/0 overload
ip nat inside source static 192.168.10.230 203.162.101.230
ip nat inside source static 192.168.10.231 203.162.101.231
ip nat inside source static 192.168.10.232 203.162.101.232
ip nat inside source static 192.168.10.233 203.162.101.233
ip nat inside source static 192.168.10.234 203.162.101.234
ip nat inside source static 192.168.10.235 203.162.101.235
ip nat inside source static 192.168.10.236 203.162.101.236
ip nat inside source static 192.168.10.237 203.162.101.237
ip nat inside source static 192.168.10.238 203.162.101.238
ip nat inside source static 192.168.10.239 203.162.101.239
ip nat inside source static 192.168.10.240 203.162.101.240
ip nat inside source static 192.168.10.241 203.162.101.241
ip nat inside source static 192.168.10.242 203.162.101.242
ip nat inside source static 192.168.10.243 203.162.101.243
ip nat inside source static 192.168.10.244 203.162.101.244
ip classless
ip route 0.0.0.0 0.0.0.0 Serial0/0
no ip http server
!
!
access-list 1 deny 192.168.10.224 0.0.0.31
access-list 1 permit 192.168.0.0 0.0.255.255


Nhận xét phần này nhé,
1. Bác NAT 1-1 cơ ah, xem lại có thể khác o nhé, thế này tốn địa chỉ quá
2. Permit em nghĩ nên là any any, hoặc 0.0.0.0 0.0.0.0
vì nó còn liên quan đến các dịch vụ khác nữa từ ngoài vào, chứ o nên chỉ 192.168.0.0 0.0.255.255
Các cái khác em đang coi

qtnhan
31-05-2006, 10:33 AM
hi wlansecu,

Cảm ơn bác wlansecu đã trả lơi.

1. mỗi Server phải dùng 1 địa chỉ IP chứ làm thế để khỏi phí IP hả bác ?
2. tôi chỉ muốn những ip thuộc 192.166.0.0 0.0.255.255 được Nat mà thôi.

- tôi không biết chắc là các IP đã static Nat trên Router có hoạt động đúng không với cấu hình đã chia VLAN trên Switch 3550
- và routing trên 3550 đã đúng chưa hay còn thiếu gì nữa.

Xin cảm ơn
Thân chào

f1gali
04-06-2006, 07:05 PM
Theo mình thì:

- không nên để địa chỉ với subnetzero 192.168.0.0/24
- bạn không cần đặt ip default-gateway cho vlan 10, chỉ cần đặt đỉa chỉ các vlan là đủ.
- Bạn cấu hình NAT như vậy nếu bạn muốn telnet từ ngoài mạng vào các server, nếu không có nhu cầu đó, bạn nên cấu hình dynamic NAT hoặc PAT.

vài ý kiến nhỏ..

westcoast
06-06-2006, 07:52 AM
Tôi đồng quan điểm với bạn F1GALI , KHÔNG NÊN chạy ip subnet-zero
Với lại bạn không nên mất nhiều thời gian để ngồi gõ những c6au lệnh NAT static như thế. Tại sao bạn không dùng NAT Pool? Bạn có thể dùng Nat pool kèm theo ACL để cho phép những server được ra Internet và ngược lại .
Trong cấu hình bạn gởi kèm ,tôi thấy những địa chỉ thuộc VLAN 10 nhưng không thấy gán cho một server nào lại được NAT.
Trên router GATEWAY của bạn còn thiếu một câu lệnh static route để chỉ vào mạng bên trong, nghĩa là chỉ vào những VLAN nhưng ở đây bạn đã dùng NAT nên destination network của bạn phải là địa chỉ dùng để NAT

qtnhan
06-06-2006, 11:28 AM
hi all,
cảm ơn các bác đã góp ý

f1gali
06-06-2006, 07:50 PM
Bạn không cần UP tất cả các VLAN lên (thực ra dù bạn UP bằng câu lệnh nhưng router chỉ UP vlan cuoi cung ma ban up lên thôi), bạn hãy chọn UP 1 vlan nào hợp lý nhất.