
1,私網(wǎng)訪問公網(wǎng),流量走向詳解。
2,如圖配置好地址。

SW1配置
#
vlan batch 2
#
interface GigabitEthernet0/0/1
port link-type access
port default vlan 2
#
interface GigabitEthernet0/0/2
port link-type access
port default vlan 2
#
interface GigabitEthernet0/0/3
port link-type trunk
port trunk pvid vlan 2
port trunk allow-pass vlan 2
AR1配置
#
interface GigabitEthernet0/0/0
ip address 10.1.1.1 255.255.255.0//配置局域網(wǎng)網(wǎng)關(guān)
#
acl number 2000 //建立NAT規(guī)則ACL200
rule 5 permit //規(guī)則5允許所有
#
interface Dialer1//建立撥號接口1
ppp chap user admin//輸入撥號用戶名
ppp chap password cipher admin123//輸入撥號密碼
dialer user admin//撥號用戶名為admin
dialer-group 1 //建立撥號組1
dialer bundle 1//綁定撥號組1
dialer number 1 autodial//設(shè)置撥號方式為自動撥號
ip address ppp-negotiate//IP地址獲取方式
nat outbound 2000//NAT(動態(tài)NAPT)調(diào)用規(guī)則2000
#
interface GigabitEthernet0/0/1
pppoe-client dial-bundle-number 1//物理接口下調(diào)用撥號接口
#
dialer-rule//建立撥號規(guī)則
dialer-rule 1 ip permit//允許所有IP
#
ip route-static 0.0.0.0 0.0.0.0 Dialer1//所有流量走向撥號接口1
AR2配置
#
dhcp enable
#
ip pool ISP
gateway-list 200.1.1.1
network 200.1.1.0 mask 255.255.255.0
#
aaa
local-user admin password cipher admin123
local-user admin service-type ppp
#
interface Virtual-Template1
ppp authentication-mode chap
remote address pool ISP
ip address 200.1.1.1 255.255.255.0
#
interface GigabitEthernet0/0/0
pppoe-server bind Virtual-Template 1
#
interface GigabitEthernet0/0/1
ip address 100.1.1.1 255.255.255.0
配置完成驗證撥號接口是否獲取IP

驗證
進(jìn)行抓包局域網(wǎng)接口和公網(wǎng)接口進(jìn)行對比

局域網(wǎng)接口抓包源IP為10.1.1.2目的IP為100.1.1.10

公網(wǎng)接口抓包源IP為200.1.1.254目的IP為100.1.1.10

NAT的作用就是將局域網(wǎng)地址轉(zhuǎn)化為一個公網(wǎng)地址去訪問外網(wǎng),目的地址不變。
================================================
作者:暖巷尋故人

浙公網(wǎng)安備 33010602011771號