|
本帖最後由 wst2080 於 2011-2-5 10:18 AM 編輯
呵呵~~~ 終於從百忙當中抽空來幫忙某位鄉民的需求!!!
PS: 又剛好正逢感冒頭暈暈的時候~~~ 回答得亂七八糟的就是了~~~
聲明: 以下文章均需要有相當程度的觀念! 並且熟悉以下列表才看得懂我在寫的部分
一、熟悉與融會貫通TCP/IP
二、需具有CCNA的相關能力(paper除外!)
三、需具有CCNA Security的相關能力(paper除外!)
四、需具有CCNP SWITCH 或 BCMSN 的相關能力與觀念(paper除外)
五、需具有良好的邏輯觀念以及相關經驗與技術等~
這次委託的需求如下:
硬體架構:Cisco PIX 515 + Cisco Catalyst 4510
需求:僅使用PIX 515 管控 Server Farm的流量
PS: 至於需求為何這麼特殊~~~ 原因為何~ 呵呵 看官就自己去猜測吧!!!
這次我個人的LAB實體硬體:
http://farm6.static.flickr.com/5094/5417412044_988b991765_z.jpg
PS: Cisco Catalyst 3560 + Cisco Catalyst 3500XL + Cisco ASA5505-10
緣由:原有的外部連線進來的是透過Fiber的方式連線到該鄉民的網路機房中~
而該鄉民的主管想要藉由閒置的PIX 515來管控ServerFarm端~~ 但原先的PIX 515又沒有Fiber介面~
所以想要藉由 C4510的設備來結合! (PS:哈~詭異的想法~其實會用的,就使用VLAN ACL搭配RACL即可!)
以前我實作的方式則直接透過真實的設備來進行橋接~ 而當初他來信問我的時候,我還以為他使用的只是單純的L2 Switch~ 後來我就覺得很莫名其妙~ 因為他根據我之前稍微指點的作法照做就發生了問題~ 爾後我才問他所使用的SWITCH的型號後,我才知道他使用的是L3 Switch~~~
一般的做法若是外部進來是Fiber的介面~ 若要實作橋接防火牆的時候~ 則就是透過一台擁有GBIC的L2 SWITCH 然後串一台防火牆 之後再連到 Core Switch 當中~ 或者比較克難的做法~ 就是弄台光電轉換器來跑也OK~ 因為當初該鄉民所說的環境,當初我還以為是蠻克難的環境就是了~~~ 呵呵!!! 這就是溝通上的誤解吧~~~ 無所謂~~~ 這段只是題外話而已~~~ 現在我也稍微模擬一下那位鄉民的環境!!! 也是用Fiber從外部連線進來~~~ 之後Firewall橋接一個L3 Switch....
OK 開始回歸正題~~~
透通式(橋接)就對外部來說好像是隱形的一樣!!! 對於L3來說是看不到的~ 因為透通則是透過L2的方式運作!簡單來說 透通(橋接) 可以想像成一台SWITCH 所以防火牆在設定在透通(橋接)模式的時候,並且同時兩個連接埠連到同一個VLAN當中時候 就會產生網路迴圈(Loop) 的現象~ 這時候~ 若是擁有網管型的SWITCH就會自動地透過STP機制來進行端口阻塞來杜絕網路迴圈所帶來的廣播風暴等等~~~
http://farm6.static.flickr.com/5257/5416801063_25d27aae5d_z.jpg
http://farm6.static.flickr.com/5297/5416805209_51846e451c.jpg
http://farm6.static.flickr.com/5057/5417416316_31a6ab5be4_z.jpg
http://farm6.static.flickr.com/5257/5416801063_25d27aae5d_z.jpg
可以注意到STP的資訊 以及SWITCH上頭 Fa0/3 上頭的燈號以證明防火牆在透通(transparent)模式
透通模式的運作對於網路傳輸就好像是SWITCH般~ 所以接上相同的VLAN或者同個L2的環境就會發生環路的狀況~ 除非是接上不同的VLAN 或者 不同的L2環境,就可以不會發生網路迴圈的問題!!!
http://farm6.static.flickr.com/5051/5417412274_1275ccd11d_z.jpg
接下來會提供L3 SWITCH的組態設定 而由於在於SWITCH當中的 fa0/2跟 fa0/4均設定不同的VLAN環境當中,所以不會產生網路迴圈!
這次的實體架構圖
http://farm6.static.flickr.com/5257/5417412396_59fc6cdaac_z.jpg
http://farm6.static.flickr.com/5260/5416801209_dddbc56270_z.jpg
遠方路由端的設定 (把路由指向LAB端)
http://farm6.static.flickr.com/5251/5416801617_7d827bf618_z.jpg
這次在遠方端的路由是透過pfsense軟路由來指定~~~
http://farm6.static.flickr.com/5212/5416801271_7794868b01_z.jpg
研究發現~ 若設定靜態路由而靜態路由的流量不要受到pfsense的干擾~ 請在這個選項打勾後,重新啟動pfsense...
3560上頭的設定 (紅色為"需要注意的重點")
Switch#show run
Building configuration...
Current configuration : 2394 bytes
!
version 12.2
no service pad
service timestamps debug uptime
service timestamps log uptime
no service password-encryption
!
hostname Switch
!
!
no aaa new-model
system mtu routing 1500
ip subnet-zero
ip routing
!
ip dhcp pool vlan100
network 192.168.100.0 255.255.255.0
default-router 192.168.100.254
!
ip dhcp pool vlan150
network 192.168.150.0 255.255.255.0
default-router 192.168.150.254
!
ip dhcp pool vlan200
network 192.168.200.0 255.255.255.0
default-router 192.168.200.254
!
!
no file verify auto
!
spanning-tree mode rapid-pvst
spanning-tree extend system-id
!
vlan internal allocation policy ascending
!
!
interface FastEthernet0/1
switchport mode access
!
interface FastEthernet0/2
switchport access vlan 100
switchport mode access
!
interface FastEthernet0/3
switchport mode access
!
interface FastEthernet0/4
switchport access vlan 20
switchport mode access
!
interface FastEthernet0/5
!
interface FastEthernet0/6
!
interface FastEthernet0/7
switchport access vlan 150
switchport mode access
spanning-tree portfast
spanning-tree bpdufilter enable
!
interface FastEthernet0/8
!
interface FastEthernet0/9
!
interface FastEthernet0/10
switchport access vlan 20
switchport mode access
spanning-tree portfast
spanning-tree bpdufilter enable
!
interface FastEthernet0/11
!
interface FastEthernet0/12
!
interface FastEthernet0/13
!
interface FastEthernet0/14
!
interface FastEthernet0/15
!
interface FastEthernet0/16
!
interface FastEthernet0/17
!
interface FastEthernet0/18
!
interface FastEthernet0/19
!
interface FastEthernet0/20
switchport access vlan 150
switchport mode access
spanning-tree portfast
spanning-tree bpdufilter enable
!
interface FastEthernet0/21
!
interface FastEthernet0/22
!
interface FastEthernet0/23
!
interface FastEthernet0/24
!
interface GigabitEthernet0/1
no switchport
ip address 10.0.100.200 255.255.255.0
!
interface GigabitEthernet0/2
!
interface Vlan1
no ip address
!
interface Vlan20
no ip address
!
interface Vlan100
ip address 192.168.100.254 255.255.255.0
!
interface Vlan150
ip address 192.168.150.254 255.255.255.0
!
interface Vlan200
ip address 192.168.200.254 255.255.255.0
!
ip default-gateway 10.0.100.254
ip classless
ip http server
ip http secure-server
!
!
no cdp run
!
control-plane
!
!
line con 0
exec-timeout 0 0
logging synchronous
line vty 0 4
login
line vty 5 15
login
!
end
Cisco ASA 設定 (紅色為重點部分)
ciscoasa# sh run
: Saved
:
ASA Version 7.2(4)
!
firewall transparent
hostname ciscoasa
domain-name default.domain.invalid
enable password XXXXXXXXXXXXXXXX encrypted
passwd XXXXXXXXXXXXX encrypted
names
!
interface Vlan1
nameif inside
security-level 100
!
interface Vlan2
nameif outside
security-level 0
!
interface Ethernet0/0
switchport access vlan 2
!
interface Ethernet0/1
shutdown
!
interface Ethernet0/2
shutdown
!
interface Ethernet0/3
shutdown
!
interface Ethernet0/4
shutdown
!
interface Ethernet0/5
!
interface Ethernet0/6
shutdown
!
interface Ethernet0/7
!
ftp mode passive
dns server-group DefaultDNS
domain-name default.domain.invalid
access-list inside_access_in extended permit ip any any
access-list outside_access_in extended permit ip any any
access-list outside-in extended permit icmp any any
access-list outside_access_in_1 extended permit ip host 192.168.100.254 any inactive
access-list outside_access_in_1 extended permit ip host 10.0.100.101 any
access-list outside_access_in_1 extended permit tcp host 10.0.100.100 eq ftp any
access-list outside_access_in_1 extended permit tcp host 10.0.100.100 eq ftp-data any
pager lines 24
mtu inside 1500
mtu outside 1500
ip address 192.168.150.100 255.255.255.0
icmp unreachable rate-limit 1 burst-size 1
no asdm history enable
arp timeout 14400
access-group inside_access_in in interface inside
access-group outside_access_in_1 in interface outside
timeout xlate 3:00:00
timeout conn 1:00:00 half-closed 0:10:00 udp 0:02:00 icmp 0:00:02
timeout sunrpc 0:10:00 h323 0:05:00 h225 1:00:00 mgcp 0:05:00 mgcp-pat 0:05:00
timeout sip 0:30:00 sip_media 0:02:00 sip-invite 0:03:00 sip-disconnect 0:02:00
timeout sip-provisional-media 0:02:00 uauth 0:05:00 absolute
http server enable
http 192.168.150.0 255.255.255.0 inside
no snmp-server location
no snmp-server contact
snmp-server enable traps snmp authentication linkup linkdown coldstart
telnet timeout 5
ssh timeout 5
console timeout 0
!
class-map inspection_default
match default-inspection-traffic
!
!
policy-map type inspect dns preset_dns_map
parameters
message-length maximum 512
policy-map global_policy
class inspection_default
inspect dns preset_dns_map
inspect ftp
inspect h323 h225
inspect h323 ras
inspect rsh
inspect rtsp
inspect esmtp
inspect sqlnet
inspect skinny
inspect sunrpc
inspect xdmcp
inspect sip
inspect netbios
inspect tftp
!
service-policy global_policy global
prompt hostname context
Cryptochecksum:XXXXXXXXXXXXXXXXXXXXXXXXXXX
: end
**請注意!介面E0/0、E0/5與E0/7均下達sw mod acc、no shutdown 指令!
***請注意!介面E0/0下達sw acc vlan 2 指令;E0/5與E0/7下達sw acc vlan 1指令!
於控制端安裝ASDM
http://farm6.static.flickr.com/5174/5417412940_b071187111_z.jpg
http://farm6.static.flickr.com/5252/5417413000_6d670c397e_z.jpg
http://farm6.static.flickr.com/5098/5416801809_f9b8f71dae_z.jpg
http://farm6.static.flickr.com/5300/5416801855_1ef4956b90_z.jpg
http://farm6.static.flickr.com/5172/5417413134_18f0560d6c_z.jpg
http://farm6.static.flickr.com/5211/5416801979_0dbf4972bd_z.jpg
http://farm6.static.flickr.com/5092/5417413254_c7d3df8048_z.jpg
http://farm6.static.flickr.com/5294/5417413300_46b65190cc_z.jpg
http://farm6.static.flickr.com/5018/5417413378_f63df56f6b_z.jpg
http://farm6.static.flickr.com/5020/5416802169_66336a74d7_z.jpg
http://farm6.static.flickr.com/5016/5417413480_1ab383e5ec_z.jpg
安裝JRE
http://farm6.static.flickr.com/5097/5417413746_13a44bf010_z.jpg
http://farm6.static.flickr.com/5100/5416802761_d234d0db99_z.jpg
http://farm6.static.flickr.com/5252/5417414264_642806b52e_z.jpg
http://farm6.static.flickr.com/5019/5417414426_4db23f2d61_z.jpg
http://farm6.static.flickr.com/5260/5416803371_7d1c6994fd_z.jpg
http://farm6.static.flickr.com/5292/5417414806_f80bd8c748_z.jpg
http://farm6.static.flickr.com/5014/5416803761_f5484e8600_z.jpg
執行ASDM
http://farm6.static.flickr.com/5212/5416804033_500ea619e6_z.jpg
http://farm6.static.flickr.com/5098/5416804285_5e0f907e75_z.jpg
http://farm6.static.flickr.com/5133/5417415560_d3b0d034fb_z.jpg
http://farm6.static.flickr.com/5017/5416804343_f15df11ea2_z.jpg
http://farm6.static.flickr.com/5175/5416804377_e7068e5f4f_z.jpg
※
桃紅色: 為防火牆從內部(inside) → 外部(outside)
淺藍色: 為防火牆從外部(outside) → 內部(inside)
其實設定規則的時候 就可以看到底下有個算是蠻人性化的流通圖!!!
防火牆規則邏輯圖
http://farm6.static.flickr.com/5291/5416800077_a22ff043c6_z.jpg
舉例1: 開放 Firewall inside 與 SVI 之間的通信
※ 在這個案例當中~ 由於 inside 介面 (從inside連出outside) 已經設定成 any 到 any 允許~
所以只要針對 outside 介面新增規則即可!!! (從outside連入inside)
http://farm6.static.flickr.com/5253/5416804431_6314d20c69_z.jpg
http://farm6.static.flickr.com/5051/5416804499_9784cf37b3_z.jpg
http://farm6.static.flickr.com/5053/5417415810_5d353fbae0_z.jpg
http://farm6.static.flickr.com/5253/5416804689_6f89de80a2_z.jpg
http://farm6.static.flickr.com/5255/5417415972_3d9e3dd769_z.jpg
設定好規則後! 一定要點選 Apply 來將設定好的規則套用才會生效
http://farm6.static.flickr.com/5054/5416804829_a3d3db33f5_z.jpg
PS: 只要記得一點很關鍵的!!! 就是大部分的傳輸都是有去有回的!!!
假設我從 inside端 下達PING到SVI ;則SVI也會回覆PING封包回來!!!
所以從上面的防火牆規則可以知道~~~ inside 允許所有連出的封包~~~
而outside的部分則是剛剛有新增一條允許SVI連入的封包!!!
http://farm6.static.flickr.com/5180/5416804963_2e519db2c1_z.jpg
ASA跟Cisco不少設備一樣 光是套用組態是不夠的~~~若下次重新啟動防火牆而使用目前設定完畢的組態,記得一定要按下 Save 存檔!!!
http://farm6.static.flickr.com/5216/5416804873_115c99bd7c_z.jpg
舉例2: 從inside端連出outside端的FTP伺服器!!!
http://farm6.static.flickr.com/5056/5417411254_539f17950a_z.jpg
http://farm6.static.flickr.com/5256/5416800035_db625d619c_z.jpg
http://farm6.static.flickr.com/5252/5416805043_54ac87ec3c_z.jpg
http://farm6.static.flickr.com/5293/5417416214_066b44e8fe_z.jpg
http://farm6.static.flickr.com/5211/5417416244_c561de0e10_z.jpg
這裡我就稍微說明~
由於inside對outisde的連線並沒有做限制,所以對方都可以收的到inside端發送的封包;但是由於outside對inside的連線有受到管制,因此外部回應的封包只接受對方服務所回應的連線! 此圖可以很清楚地了解,雖然對方有收到inside端的ICMP要求封包並把ICMP回應封包傳回來;但是被防火牆給丟棄了~ 然而由於有開放對方的FTP服務可連線回inside,所以inside可以存取遠端的FTP伺服器!
以上就是簡單的透通式防火牆建置與設定介紹!!! |
評分
-
3
查看全部評分
-
|