1.先配ip
[Huawei]sysname R1
[R1]interface GigabitEthernet 0/0/1
[R1-GigabitEthernet0/0/1]ip add 192.168.1.1 24
[R1-GigabitEthernet0/0/1]int s 4/0/0
[R1-Serial4/0/0]ip add 12.1.1.1 24
其他同理
2.写三条缺省指向R2来使网络通
[R1]ip route-static 0.0.0.0 0 12.1.1.2
[R3]ip route-static 0.0.0.0 0 23.1.1.2
[R4]ip route-static 0.0.0.0 0 24.1.1.2
3.R1-R2之间为HDLC封装
[R1]int s 4/0/0
[R1-Serial4/0/0]link-protocol hdlc
Warning: The encapsulation protocol of the link will be changed. Continue? [Y/N]
:y
[R2]int s 4/0/0
[R2-Serial4/0/0]link-protocol hdlc
4.R2-R3之间为ppp封装,pap认证,R2为主认证方
配置PAP认证
[R2]aaa
[R2-aaa]local-user gzw privilege level 15 password cipher 123456
Info: Add a new user.
接口调用:
[R2-aaa]int s 4/0/1
[R2-Serial4/0/1]ppp authentication-mode pap
[R3]int s 4/0/0
[R3-Serial4/0/0]ppp pap local-user gzw password cipher 123456
5.R2-R4之间为PPP封装,chap认证,R2为主认证方
[R2]aaa
[R2-aaa]local-user gzw1 privilege level 15 password cipher 654321
Info: Add a new user.
[R2-aaa]local-user gzw service-type ppp
[R2-aaa]int s 3/0/0
[R2-Serial3/0/0]ppp authentication-mode chap
[R4]interface Serial 4/0/0
[R4-Serial4/0/0]ppp chap user gzw1
[R4-Serial4/0/0]ppp chap password cipher 654321
6.R1、R2、R3构建MGRE环境,仅R1P地址固定
[R1]int t 0/0/0
[R1-Tunnel0/0/0]ip add 10.1.1.1 24
[R1-Tunnel0/0/0]tunnel-protocol gre p2mp
出口地址:
[R1-Tunnel0/0/0]source 12.1.1.1
成为NHRP中心,同时可以进行伪广播
[R1-Tunnel0/0/0]nhrp entry multicast dynamic
[R1-Tunnel0/0/0]nhrp network-id 100
[R3]int t 0/0/0
[R3-Tunnel0/0/0]ip add 10.1.1.2 24
[R3-Tunnel0/0/0]tunnel-protocol gre p2mp
[R3-Tunnel0/0/0]source Serial 4/0/0
[R3-Tunnel0/0/0]nhrp network-id 100
[R3-Tunnel0/0/0]nhrp entry 10.1.1.1 12.1.1.1 register
[R4]interface t 0/0/0
[R4-Tunnel0/0/0]ip add 10.1.1.3 24
[R4-Tunnel0/0/0]tunnel-protocol gre p2mp
[R4-Tunnel0/0/0]source s 4/0/0
[R4-Tunnel0/0/0]nhrp network-id 100
[R4-Tunnel0/0/0]nhrp entry 10.1.1.1 12.1.1.1 register
7.内网使用RTP获取路中,所有pc可以互相访问,并日可访问B2的环回
[R1]rip 1
[R1-rip-1]version 2
[R1-rip-1]network 192.168.1.0
[R1-rip-1]network 10.0.0.0
[R1]acl 2000
[R1-acl-basic-2000]rule permit source 192.168.1.0 0.0.0.255
[R1-acl-basic-2000]q
[R1]int s 4/0/0
[R1-Serial4/0/0]nat outbound 2000
[R3]rip
[R3-rip-1]version 2
[R3-rip-1]network 192.168.2.0
[R3-rip-1]network 10.0.0.0
[R3-rip-1]q
[R3]acl 2000
[R3-acl-basic-2000]rule permit source 192.168.2.0 0.0.0.255
[R3-acl-basic-2000]q
[R3]int s 4/0/0
[R3-Serial4/0/0]nat outbound 2000
[R4]rip
[R4-rip-1]version 2
[R4-rip-1]network 192.168.3.0
[R4-rip-1]network 10.0.0.0
[R4-rip-1]q
[R4]acl 2000
[R4-acl-basic-2000]rule permit source 192.168.3.0 0.0.0.255
[R4-acl-basic-2000]q
[R4]int s 4/0/0
[R4-Serial4/0/0]nat outbound 2000