Router>enable
Router#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#int g0/0
Router(config-if)#ip address 192.168.1.1 255.255.255.0
Router(config-if)#no shutdown
Router(config-if)#
%LINK-5-CHANGED: Interface GigabitEthernet0/0, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface GigabitEthernet0/0, changed state to up
Router(config-if)#exit
Router(config)#int Ser0/3/0
Router(config-if)#ip address 192.168.3.1 255.255.255.0
Router(config-if)#clock rate 72000
Router(config-if)#no shutdown
Router(config-if)#exit
Router(config)#route rip
Router(config-router)#version 2
Router(config-router)#network 192.168.1.0
Router(config-router)#network 192.168.3.0
配置路由器1
Router>enable
Router#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#int Ser0/3/0
Router(config-if)#ip address 192.168.3.2 255.255.255.0
Router(config-if)#no shutdown
Router(config-if)#exit
Router(config)#int g0/0
Router(config-if)#ip address 192.168.2.1 255.255.255.0
Router(config-if)#no shutdown
Router(config-if)#exit
Router(config)#route rip
Router(config-router)#version 2
Router(config-router)#network 192.168.3.0
Router(config-router)#network 192.168.2.0
Router(config-router)#end
这里使用主机PC0ping主机PC1
C:\>ping 192.168.2.11
Pinging 192.168.2.11 with 32 bytes of data:
Reply from 192.168.2.11: bytes=32 time=3ms TTL=126
Reply from 192.168.2.11: bytes=32 time=1ms TTL=126
Reply from 192.168.2.11: bytes=32 time=3ms TTL=126
Reply from 192.168.2.11: bytes=32 time=2ms TTL=126
Ping statistics for 192.168.2.11:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip timesin milli-seconds:
Minimum = 1ms, Maximum = 3ms, Average = 2ms
C:\>
这里是可以直接连通的,因为默认封装了HDLC协议
Router#show int s0/3/0
Serial0/3/0 is up, line protocol is up (connected)
Hardware is HD64570
Internet address is 192.168.3.1/24
MTU 1500 bytes, BW 1544 Kbit, DLY 20000 usec,
reliability 255/255, txload 1/255, rxload 1/255
Encapsulation HDLC, loopback not set, keepalive set(10 sec)
但是HDLC协议兼容性不好
4.设置PPP协议
封装带pap认证的PPP协议 路由器0
Router#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#int s0/3/0
Router(config-if)#encapsulation ppp
Router(config-if)#
%LINEPROTO-5-UPDOWN: Line protocol on Interface Serial0/3/0, changed state to down
Router(config-if)#ppp pap sent-username route001 password 123456
Router(config-if)#exit
Router(config)#username route002 password 123456
路由器1
Router>enable
Router#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#int s0/3/0
Router(config-if)#encapsulation ppp
Router(config-if)#
%LINEPROTO-5-UPDOWN: Line protocol on Interface Serial0/3/0, changed state to up
Router(config-if)#ppp pap sent-username route002 password 123456
Router(config-if)#exit
Router(config)#username route001 password 12345
查看一下协议,看出已经是封装了PPP协议
Router#show int s0/3/0
Serial0/3/0 is up, line protocol is up (connected)
Hardware is HD64570
Internet address is 192.168.3.1/24
MTU 1500 bytes, BW 1544 Kbit, DLY 20000 usec,
reliability 255/255, txload 1/255, rxload 1/255
Encapsulation PPP, loopback not set, keepalive set(10 sec)
封装带chap认证的PPP协议 路由器0
Router#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#enable secret 123456
Router(config)#username route002 password 123456
Router(config)#int s0/3/0
Router(config-if)#encapsulation ppp
Router(config-if)#ppp authentication chap
路由器1
Router>enable
Router#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#enable secret 123456
Router(config)#username route001 password 123456
Router(config)#int s0/3/0
Router(config-if)#encapsulation ppp
Router(config-if)#ppp authentication chap
Router(config-if)#
5.验证主机连通
C:\>ping 192.168.2.11
Pinging 192.168.2.11 with 32 bytes of data:
Reply from 192.168.2.11: bytes=32 time=1ms TTL=126
Reply from 192.168.2.11: bytes=32 time=4ms TTL=126
Reply from 192.168.2.11: bytes=32 time=1ms TTL=126
Reply from 192.168.2.11: bytes=32 time=1ms TTL=126
Ping statistics for 192.168.2.11:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip timesin milli-seconds:
Minimum = 1ms, Maximum = 4ms, Average = 1ms
C:\