乾頤堂軍哥HCNA綜合-PPPoE-NAT和IPSEC ***在企業網實戰應用

VIP:
乾頤堂軍哥HCNA綜合-PPPoE-NAT和IPSEC ***在企業網實戰應用
本文檔包含3大部分:PPPoE、NAT和IPSEC ×××實施,是企業網接入互聯網以及廣域網互聯重要的技術,本文檔實現了綜合運用
1.PPPoE
PPP over ethernet(以太網上的PPP協議)
PPP即點到點協議,是一種2層封裝協議,工做串行鏈路(默認狀況不能工做在以太安全

網上)
以太網的優點:以太網很是流行,速率很高,同時成本小
PPP的優點:公有協議的封裝,支持認證(擴展到流量統計以及計費)
二者結合引出了PPPoE
PPPoE的3個階段:1)發現階段 2)會話創建 3)會話結束
PPPOE的服務器:
aaa
local-user qyt password cipher %$%$T;;MX@,(.6yB!SBS[MN(rZIB%$%$
local-user qyt service-type ppp //建立用於客戶端認證的用戶名和密碼
ip pool PPPoE1
network 202.100.1.0 mask 255.255.255.252 //給客戶端下發的網絡地址段,華服務器

爲從較高地址開始下發
excluded-ip-address 202.100.1.2 //拍錯202.100.1.2的地址
dns-list 114.114.114.114
[R2-ip-pool-PPPoE1]dns-list 114.114.114.114
[R2]int Virtual-Template 1 //建立虛擬模版接口
[R2-Virtual-Template1]remote address pool PPPoE1 //客戶端地址從地址池網絡

PPPoE1中得到
[R2-Virtual-Template1]ip address 202.100.1.1 30
[R2-Virtual-Template1]ppp authentication-mode chap //開啓認證
[R2-Virtual-Template1]int g0/0/0
[R2-GigabitEthernet0/0/0]pppoe-server bind virtual-template 1 //把虛擬session

模版接口和物理接口一塊兒結合使用,把物理接口綁定到PPPoE中去
[R2-GigabitEthernet0/0/0]tcp

客戶端:
dialer-rule
dialer-rule 1 ip permit
interface Dialer1
link-protocol ppp
ppp chap user qyt
ppp chap password cipher %$%$#\/D5=%dXNcA,zAF)}M7,'<Z%$%$
ip address ppp-negotiate
dialer user QYT
dialer bundle 10
dialer-group 1
interface GigabitEthernet0/0/0
pppoe-client dial-bundle-number 10ide

Dec 13 2017 20:20:59.935.1-08:00 R1 PPPOE-oop

CLIENT/7/debugging:GigabitEthernet0/0/0: PPPoE Client OUT Discovery 測試

data (PADI), Len = 30ui

[R1-GigabitEthernet0/0/0]
Dec 13 2017 20:20:59.975.1-08:00 R1 PPPOE-加密

CLIENT/7/debugging:GigabitEthernet0/0/0: PPPoE Client IN Discovery data

(PADO), Len = 60

[R1-GigabitEthernet0/0/0]
Dec 13 2017 20:20:59.975.2-08:00 R1 PPPOE-

CLIENT/7/debugging:GigabitEthernet0/0/0: PPPoE Client OUT Discovery

data (PADR), Len = 48

[R1-GigabitEthernet0/0/0]
Dec 13 2017 20:21:00.55.1-08:00 R1 PPPOE-

CLIENT/7/debugging:GigabitEthernet0/0/0: PPPoE Client IN Discovery data

(PADS), Len = 60, Session ID = 1

[R1]display pppoe-client session summary
PPPoE Client Session:
ID Bundle Dialer Intf Client-MAC Server-MAC State

1 10 1 GE0/0/0 00e0fc840ba5 00e0fc8f08d4 UP
<R2>display pppoe-server session all //驗證PPPoE會話是否創建
SID Intf State OIntf RemMAC

LocMAC
1 Virtual-Template1:0 UP GE0/0/0 00e0.fc84.0ba5

00e0.fc8f.08d4
[R1]dis ip routing-table protocol direct
Route Flags: R - relay, D - download to fib


Public routing table : Direct
Destinations : 6 Routes : 6

Direct routing table status : <Active>
Destinations : 6 Routes : 6

Destination/Mask Proto Pre Cost Flags NextHop

Interface

202.100.1.1/32  Direct  0    0           D   127.0.0.1

Dialer1
202.100.1.2/32 Direct 0 0 D 202.100.1.2

Dialer1
如今client得到了202.100.1.254的地址,202.100.1.254<---> 202.100.1.2直

連通訊?
0 不能
1 能

2.NAT轉換
常常有同窗說:華爲的NAT作不成功,這是徹底錯誤的觀點!!
2種最經常使用的NAT
2.1 NAT server
把內網的一臺設備的服務應用(端口)映射到公網的一個端口(能夠和內部服務器

的端口相同或者不一樣),使得外部網絡的設備能夠經過訪問公網的端口,其實就可

以訪問內網的應用(端口)
[R1-Dialer1]nat server protocol tcp global 202.100.1.1 2323 inside

10.1.10.15 23
Error: The address conflicts with interface or ARP IP //不能直接使用

公網地址
[R1-Dialer1]nat server protocol tcp global current-interface 2323

inside 10.1.10.15 23 //請使用當前接口參數,而後把公網地址的2323端口應用

轉發爲內網地址10.1.10.15的23端口
[R1]dis nat server
Nat Server Information:
Interface : Dialer1
Global IP/Port : current-interface/2323 (Real IP : 202.100.1.1)
Inside IP/Port : 10.1.10.15/23(telnet)
Protocol : 6(tcp)
××× instance-name : ----
Acl number : ----
Description : ----

Total : 1
測試:
<R2>telnet 202.100.1.1 2323 //從外網測試成功,由於NAT服務器就是爲外網提

供服務的
Press CTRL_] to quit telnet mode
Trying 202.100.1.1 ...
Connected to 202.100.1.1 ...

Login authentication

Password:
Info: The max number of VTY users is 5, and the number
of current VTY users on line is 1.
The current login time is 2017-12-13 21:16:51.
<SW1>

<R1>display nat session protocol tcp //查看NAT轉換的會話。也能夠經過抓取

報文來驗證華爲的NAT
NAT Session Table Information:

Protocol          : TCP(6)
 SrcAddr  Port *** : 202.100.1.2     65473                          

 DestAddr Port *** : 202.100.1.1     4873                           

 NAT-Info
   New SrcAddr     : ----
   New SrcPort     : ----
   New DestAddr    : 10.1.10.15     
   New DestPort    : 5888 

 Protocol          : TCP(6)
 SrcAddr  Port *** : 202.100.1.2     23233                          

 DestAddr Port *** : 202.100.1.1     4873                           

 NAT-Info
   New SrcAddr     : ----
   New SrcPort     : ----
   New DestAddr    : 10.1.10.15     
   New DestPort    : 5888

2.2 EASY IP(PAT)
能夠和NAT服務器一塊兒使用!能夠把指定的內部網絡的不一樣應用轉化爲一個公網地址

的對應的應用(地址和端口一塊兒轉換,即複用!)
acl name NAT 3999
rule 5 permit ip source 10.1.10.0 0.0.0.31 //定義的網絡經過NAT轉化去訪

問互聯網,意味着其餘網絡不作NAT轉化
[R1-acl-adv-NAT]int dial 1
[R1-Dialer1]nat outbound 3999 //實施easy IP
[R1]dis nat outbound //驗證easy IP(華爲這個驗證明在不靠譜)
NAT Outbound Information:



Interface Acl Address-group/IP/Interface

Type



Dialer1 3999 202.100.1.1

easyip



Total : 1
測試:
PC>ping 202.100.1.2 //注意此時R2(模擬internet設備)並無除了直連路由之

外的路由條目,可是依舊能夠實現通訊,由於作了NAT轉換,是202.100.1.1和1.2

在通訊

Ping 202.100.1.2: 32 data bytes, Press Ctrl_C to break
From 202.100.1.2: bytes=32 seq=1 ttl=254 time=63 ms
From 202.100.1.2: bytes=32 seq=2 ttl=254 time=47 ms
From 202.100.1.2: bytes=32 seq=3 ttl=254 time=47 ms
From 202.100.1.2: bytes=32 seq=4 ttl=254 time=47 ms
From 202.100.1.2: bytes=32 seq=5 ttl=254 time=46 ms

--- 202.100.1.2 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 46/50/63 ms
[R1]dis acl all //華爲的ENSP上,在實施EASY IP的時候不能看到報文的匹配!

驗證easy IP請抓包
Total quantity of nonempty ACL number is 1

Advanced ACL NAT 3999, 1 rule
Acl's step is 5
rule 5 permit ip source 10.1.10.0 0.0.0.31
<R2>dis ip routing-table
Route Flags: R - relay, D - download to fib


Routing Tables: Public
Destinations : 8 Routes : 8

Destination/Mask Proto Pre Cost Flags NextHop

Interface

202.100.1.0/30  Direct  0    0           D   202.100.1.2

Virtual-Template1
202.100.1.1/32 Direct 0 0 D 202.100.1.1

Virtual-Template1
202.100.1.2/32 Direct 0 0 D 127.0.0.1

Virtual-Template1
202.100.1.3/32 Direct 0 0 D 127.0.0.1

Virtual-Template1
255.255.255.255/32 Direct 0 0 D 127.0.0.1

InLoopBack0
從內網到外網先路由而後NAT轉換,反之先轉換再NAT!
3.站點到站點的IPSEC ×××
SPD:ACL(即定義哪些流量進行IPSEC ×××處理)
IPSEC的組成:ESP(封裝安全負載)、AH(認證頭部)、ISAKMP(IKE,互聯網祕
鑰交換)
2種SA(安全關聯):IKE SA;IPSEC SA
在路由的基礎上加一層「安全外殼」
加解密點的路由(最少的3條路由):
1)須要有到本地通訊設備的路由
2)須要有到遠端加密點的路由
3)須要有到遠端通訊點的路由
SPD:
acl name ×××
rule 5 permit ip source 10.1.10.0 0.0.0.31 destination 10.1.20.0

0.0.0.15

[R2-acl-adv-×××]rule 5 permit ip source 10.1.20.0 0.0.0.15 destination

10.1.10.0 0.0.0.31

ipsec proposal QYT
esp authentication-algorithm sha1

ipsec policy QYT 10 manual
security acl 3998
proposal QYT
tunnel local 202.100.1.1
tunnel remote 202.100.1.2
sa spi inbound esp 12345
sa string-key inbound esp simple huawei
sa spi outbound esp 54321
sa string-key outbound esp simple huawei

ipsec policy QYT 10 manual
security acl 3999
proposal QYT
tunnel local 202.100.1.2
tunnel remote 202.100.1.1
sa spi inbound esp 54321
sa string-key inbound esp simple huawei
sa spi outbound esp 12345
sa string-key outbound esp simple huawei
在一個NAT的環境下實施IPSEC ×××必須在NAT的ACL中拿掉×××流量
acl name NAT 3999
rule 5 deny ip source 10.1.10.0 0.0.0.31 destination 10.1.20.0

0.0.0.15 //用×××處理的流量不作NAT,不能去訪問互聯網
rule 10 permit ip source 10.1.10.0 0.0.0.31 //訪問互聯網的流量
[R2-ospf-1]default-route-advertise always
[R2]dis ipsec statistics esp
Inpacket count : 15
Inpacket auth count : 0
Inpacket decap count : 0
Outpacket count : 4
Outpacket auth count : 0
Outpacket encap count : 0
Inpacket drop count : 0
Outpacket drop count : 0
BadAuthLen count : 0
AuthFail count : 0
InSAAclCheckFail count : 0
PktDuplicateDrop count : 0
PktSeqNoTooSmallDrop count: 0
PktInSAMissDrop count : 0
[R2]display ipsec sa brief

Number of SAs:2
Src address Dst address SPI ××× Protocol

Algorithm


202.100.1.1     202.100.1.2      54321      0    ESP   E:DES

A:SHA1-96
202.100.1.2 202.100.1.1 12345 0 ESP E:DES

A:SHA1-96

相關文章
相關標籤/搜索