一、基本配置
pc1配置
[h4c]sysname pc1
[h4c]int g0/0
[pc1-GigabitEthernet0/0]ip add 192.168.2.100 255.255.255.0
[pc1-GigabitEthernet0/0]undosh
[pc1-GigabitEthernet0/0]quit
[pc1]ip route-static 0.0.0.0 0.0.0.0 192.168.2.1
[pc1]displayip routing-table
pc2配置
[h4c]sysname pc2
[pc2]int g0/0
[pc2-GigabitEthernet0/0]ip add 192.168.3.100 255.255.255.0
[pc2-GigabitEthernet0/0]undosh
[pc2-GigabitEthernet0/0]quit
[pc2]ip route-static 0.0.0.0 0.0.0.0 192.168.3.1
[pc2]displayip routing-table
服務(wù)器配置
[h4c]sysname server
[server]int g0/0
[server -GigabitEthernet0/0]ip add 192.168.3.250 255.255.255.0
[server -GigabitEthernet0/0]undosh
[server -GigabitEthernet0/0]quit
[server]ip route-static 0.0.0.0 0.0.0.0 192.168.3.1
[server]display ip routing-table
pc3配置
[h4c]sysname pc3
[pc3]int g0/0
[pc3-GigabitEthernet0/0]ip add 202.1.1.2 55.255.255.0
[pc3-GigabitEthernet0/0]undosh
[pc3-GigabitEthernet0/0]quit
[pc3]ip route-static 0.0.0.0 0.0.0.0 202.1.1.1
[pc3]displayip routing-table
r1配置
[H3C]sysname r1
[r1]int g0/0
[r1-GigabitEthernet0/0]ip add 202.202.202.2 255.255.255.252
[r1-GigabitEthernet0/0]undosh
[r1-GigabitEthernet0/0]int g0/1
[r1-GigabitEthernet0/1]ip add 200.200.200.2 255.255.255.252
[r1-GigabitEthernet0/1]undosh
將g0/2口改為橋接模式
[r1-GigabitEthernet0/1]int g0/2
[r1-GigabitEthernet0/2]port link-mode bridge
[r1-GigabitEthernet0/2]int vlan 1
[r1-Vlan-interface1]ip add 192.168.1.1 255.255.255.0
[r1-Vlan-interface1]undosh
r2配置
System View: return to User View with Ctrl+Z.
[H3C]sysname r2
[r2]int g0/0
[r2-GigabitEthernet0/0]ip add 202.202.202.1 255.255.255.252
[r2-GigabitEthernet0/0]undosh
[r2-GigabitEthernet0/0]int g0/1
[r2-GigabitEthernet0/1]ip add 222.222.222.1 255.255.255.252
[r2-GigabitEthernet0/1]undosh
[r2-GigabitEthernet0/1]int loopback 0
[r2-LoopBack0]ip add 202.202.0.1 255.255.255.255
[r2-LoopBack0]
r3配置
[H3C]sysname r3
[r3]int g0/1
[r3-GigabitEthernet0/1]ip add 200.200.200.1 255.255.255.252
[r3-GigabitEthernet0/1]undosh
[r3-GigabitEthernet0/1]int g0/0
[r3-GigabitEthernet0/0]ip add 222.222.222.2 255.255.255.252
[r3-GigabitEthernet0/0]undosh
[r3-GigabitEthernet0/0]
[r3-GigabitEthernet0/0]int g0/2
[r3-GigabitEthernet0/2] ip add 202.1.1.1 255.255.255.0
[r3-GigabitEthernet0/2]undosh
sw1配置
[H3C]sysname sw1
[sw1]int vlan 1
[sw1-Vlan-interface1]ip add 192.168.1.2 255.255.255.0
[sw1-Vlan-interface1]undosh
[sw1]vlan 2
[sw1-vlan2]vlan 3
[sw1-vlan3]int vlan 2
[sw1-Vlan-interface2]ip add 192.168.2.1 255.255.255.0
[sw1-Vlan-interface2]undosh
[sw1-Vlan-interface2]int vlan 3
[sw1-Vlan-interface3]ip add 192.168.3.1 255.255.255.0
[sw1-Vlan-interface3]undosh
[sw1]int g1/0/6
[sw1-GigabitEthernet1/0/6]port access vlan 2
[sw1-GigabitEthernet1/0/6]int g1/0/7
[sw1-GigabitEthernet1/0/7]port access vlan 3
[sw1-GigabitEthernet1/0/7]int g1/0/8
[sw1-GigabitEthernet1/0/8]port access vlan 3
二、路由配置
1.sw1配置默認(rèn)路由
[sw1-GigabitEthernet1/0/8]ip route-static 0.0.0.0 0.0.0.0 192.168.1.1
2.r1上配置靜態(tài)路由和ospf
[r1]ip route-static 192.168.2.0 255.255.255.0 192.168.1.2
[r1]ip route-static 192.168.3.0 255.255.255.0 192.168.1.2
[r1]ospf 1
[r1-ospf-1]area 0
[r2-ospf-1-area-0.0.0.0]net 0.0.0.0 255.255.255.255
3.r2上配置ospf
[r2]ospf 1
[r2-ospf-1]area 0
[r2-ospf-1-area-0.0.0.0]net 0.0.0.0 255.255.255.255
4.r3上配置ospf
[r3]ospf 1
[r3-ospf-1]area 0
[r3-ospf-1-area-0.0.0.0]net 0.0.0.0 255.255.255.255
說(shuō)明:
三、nat配置
[r1]acl basic 2001
[r1-acl-ipv4-basic-2001]rule 0 permit source 192.168.2.0 0.0.0.255
[r1-acl-ipv4-basic-2001]rule 5 permit source 192.168.3.0 0.0.0.255
[r1-acl-ipv4-basic-2001]rule 10 deny
[r1-acl-ipv4-basic-2001]int g0/0
[r1-GigabitEthernet0/0]port link-mode route
[r1-GigabitEthernet0/0]descriptionlink_to_tel
[r1-GigabitEthernet0/0]nat outbound 2001
[r1-GigabitEthernet0/0]int g0/1
[r1-GigabitEthernet0/1]port link-mode route
[r1-GigabitEthernet0/1]desclink_to_end
[r1-GigabitEthernet0/1]nat outbound 2001
[r1-GigabitEthernet0/1]nat server protocol tcp global 200.200.200.2 23 inside 19
2.168.3.250 23
[r1-GigabitEthernet0/1]
驗(yàn)證:從pc1 ping 202.202.0.1
display nat session
四、策略路由配置
[r1]acl advanced 3001
[r1-acl-ipv4-adv-3001]rule 0 permit ip source 192.168.3.0 0.0.0.255
[r1-acl-ipv4-adv-3001]quit
[r1]policy-based-route a1 permit node 10
[r1-pbr-a1-10]if-match acl 3001
[r1-pbr-a1-10]apply next-hop 200.200.200.1
[r1-pbr-a1-10]quit
[r1]policy-based-route a1 permit node 20 //空節(jié)點(diǎn),即不匹配acl3001的流量都放行,正常查路由表
[r1-pbr-a1-20]quit
在接口vlan上應(yīng)用策略路由(此處使用的是基于接口的策略路由)
[r1]int Vlan-interface 1
[r1-Vlan-interface1]ip policy-based-route a1
[r1-Vlan-interface1]
五、驗(yàn)證
1.驗(yàn)證nat,在server上開啟telnet
[server]telnet server enable //默認(rèn)開啟
[server]local-user admin //創(chuàng)建用戶admin
[server-luser-manage-admin]password simple benet //配置密碼
[server-luser-manage-admin]service-type telnet //指定服務(wù)類型為telnet
[server-luser-manage-admin]authorization-attribute user-role level-3 //指定命令級(jí)別為3級(jí)
[server-luser-manage-admin]quit
[server]user-interface vty 0 //進(jìn)入vty線路
[server-line-vty0]authentication-mode scheme //配置用戶的認(rèn)證方式
[server-line-vty0]protocol inbound telnet //支持telnet
[server-line-vty0]quit
在pc3上telnet服務(wù)器
login: admin
Password:
另外有需要云服務(wù)器可以了解下創(chuàng)新互聯(lián)cdcxhl.cn,海內(nèi)外云服務(wù)器15元起步,三天無(wú)理由+7*72小時(shí)售后在線,公司持有idc許可證,提供“云服務(wù)器、裸金屬服務(wù)器、高防服務(wù)器、香港服務(wù)器、美國(guó)服務(wù)器、虛擬主機(jī)、免備案服務(wù)器”等云主機(jī)租用服務(wù)以及企業(yè)上云的綜合解決方案,具有“安全穩(wěn)定、簡(jiǎn)單易用、服務(wù)可用性高、性價(jià)比高”等特點(diǎn)與優(yōu)勢(shì),專為企業(yè)上云打造定制,能夠滿足用戶豐富、多元化的應(yīng)用場(chǎng)景需求。