2.1:思科CDP发现协议。
2.2:公有LLDP发现协议。
2.3:保存配置命令及其他命令。
2.4:设备配置IP地址及静态路由配置。
R1(config)#cdp run //全局配置cdp
R1(config)#interface ethernet 0/0 //进入接口
R1(config-if)#no shutdown //开启接口
R1(config-if)#cdp run //接口下开启cdp
R1(config)#interface ethernet 0/0 //进入接口
R1(config-if)#ip address 12.1.1.1 255.255.255.0 //配置IP地址
R1(config-if)#no shutdown //开启接口
R2(config)#interface ethernet 0/0 //进入接口
R2(config-if)#ip address 12.1.1.2 255.255.255.0 //配置IP地址
R2(config-if)#no shutdown //开启接口
R1(config)#do ping 12.1.1.2 //测试R1和R2的通信
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 12.1.1.2, timeout is 2 seconds:
.!!!!
Success rate is 80 percent (4/5), round-trip min/avg/max = 2/4/5 ms
R1#show cdp neighbors //查看CDP邻居
Capability Codes: R - Router, T - Trans Bridge, B - Source Route Bridge
S - Switch, H - Host, I - IGMP, r - Repeater, P - Phone,
D - Remote, C - CVTA, M - Two-port Mac Relay
Device ID Local Intrfce Holdtme Capability Platform Port ID
R2 Eth 0/0 167 R B Linux Uni Eth 0/0
Total cdp entries displayed : 1
R1(config)#no cdp run //关闭cdp
R1(config)#do show cdp neighbors //查看CDP邻居
% CDP is not enabled //cdp未开启
R1(config)#lldp run //运行公有LLDP
R2(config)#lldp run //运行公有LLDP
R1(config)#do show lldp neighbors //查看lldp邻居
Capability codes:
(R) Router, (B) Bridge, (T) Telephone, (C) DOCSIS Cable Device
(W) WLAN Access Point, (P) Repeater, (S) Station, (O) Other
Device ID Local Intf Hold-time Capability Port ID
R2 Et0/0 120 R Et0/0
Total entries displayed: 1
R1#copy running-config startup-config //保存配置文件
Destination filename [startup-config]?
Building configuration...
[OK]
R2#write //保存配置文件
Building configuration...
[OK]
R1#erase startup-config //清除启动配置
R1#show running-config //清除运行配置
R1#show startup-config //查看启动配置
R1#show ip interface brief //查看接口配置信息
Interface IP-Address OK? Method Status Protocol
Ethernet0/0 12.1.1.1 YES manual up up
R2#show ip interface brief //查看接口配置信息
Interface IP-Address OK? Method Status Protocol
Ethernet0/0 12.1.1.2 YES manual up up
R1(config)#interface loopback 0 //创建环回口0
Oct 4 22:18:10.700: %LINEPROTO-5-UPDOWN: Line protocol on Interface Loopback0, changed state to up
R1(config-if)#ip address 1.1.1.1 255.255.255.0 //创建环回口0的ip地址
R1(config-if)#no shutdown
R2(config)#interface loopback 0 //创建环回口0
Oct 4 22:18:10.700: %LINEPROTO-5-UPDOWN: Line protocol on Interface Loopback0, changed state to up
R2(config-if)#ip address 2.2.2.2 255.255.255.0 //创建环回口0的ip地址
R2(config-if)#no shutdown
R1#ping 2.2.2.2 source 1.1.1.1 //测试R1环回口与R2环回口通信
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 2.2.2.2, timeout is 2 seconds:
Packet sent with a source address of 1.1.1.1
.....
Success rate is 0 percent (0/5)
R1(config)#ip route 2.2.2.2 255.255.255.255 e0/0 12.1.1.2 10 //配置静态路由metric为10
R2(config)#ip route 0.0.0.0 0.0.0.0 12.1.1.1 //配置默认静态路由metric为
R1#ping 2.2.2.2 source 1.1.1.1 //测试R1环回口与R2环回口通信
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 2.2.2.2, timeout is 2 seconds:
Packet sent with a source address of 1.1.1.1
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 3/4/5 ms
R1#traceroute 2.2.2.2 source 1.1.1.1 numeric //路由跟踪
Type escape sequence to abort.
Tracing the route to 2.2.2.2
VRF info: (vrf in name/id, vrf out name/id)
1 12.1.1.2 1 msec * 1 msec