2018-7-16
连接路由器
配置两台PC机的IP地址 处于不同网段
配置路由器
Router>en
Router#
Router#conf t
Router(config)#int fa0/0 //定义0/0接口
Router(config-if)#ip add 192.168.1.254 255.255.255.0
Router(config-if)#no sh
Router(config-if)#int fa0/1 //定义0/1接口
Router(config-if)#ip add 192.168.2.254 255.255.255.0
Router(config-if)#no sh //激活接口
Router(config-if)#do wr
Router(config-if)#do show ip rou //显示所有IP路由
Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP
i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area
* - candidate default, U - per-user static route, o - ODR
P - periodic downloaded static route
Gateway of last resort is not set
C 192.168.1.0/24 is directly connected, FastEthernet0/0 //路由表
C 192.168.2.0/24 is directly connected, FastEthernet0/1
配置路由器R1 ip:192.168.1.1/24
R1#conf t
R1(config)#int g0/0
R1(config-if)#ip address 192.168.1.1 255.255.255.0
R1(config-if)#no sh
R1(config-if)#do wr
Building configuration...
[OK]
配置路由器R2 IP:192.168.1.2/24
Router>en
Router#conf t
Router(config)#no ip domain lookup
Router(config)#line console 0
Router(config-line)#no exec-timeout
Router(config-line)#logg synchronous
Router(config-line)#exit
Router(config)#do wr
Building configuration...
[OK]
Router(config)#int g0/0
Router(config-if)#ip address 192.168.1.2 255.255.255.0
Router(config-if)#no sh
Router(config-if)#do wr
配置交换机
Switch>en
Switch#conf t
Switch(config)#ho Sw1
Sw1(config)#no ip domain lookup
Sw1(config)#line c 0
Sw1(config-line)#no exec-timeout
Sw1(config-line)#logg s
Sw1(config-line)#exit
Sw1(config)#do wr
在R1路由器pingR2路由器
R1#ping 192.168.1.2
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.1.2, timeout is 2 seconds:
.!!!!
Success rate is 80 percent (4/5), round-trip min/avg/max = 0/0/0 ms
R1显示ARP报文
R1#show arp
Protocol Address Age (min) Hardware Addr Type Interface
Internet 192.168.1.1 - 00D0.BCCA.5601 ARPA GigabitEthernet0/0
Internet 192.168.1.2 0 0090.2B30.6C01 ARPA GigabitEthernet0/0
- 源IP地址:192.168.1.1
- 源MAC地址:00D0.BCCA.56501
- 目的IP地址:192.168.1.2
- 目的MAC地址:0090.2B30.6C01
R2显示ARP报文
Router#SHOW ARp
Protocol Address Age (min) Hardware Addr Type Interface
Internet 192.168.1.1 4 00D0.BCCA.5601 ARPA GigabitEthernet0/0
Internet 192.168.1.2 - 0090.2B30.6C01 ARPA GigabitEthernet0/0
交换机中显示ARP报文
Sw1#show mac-address-table
Mac Address Table
-------------------------------------------
Vlan Mac Address Type Ports
---- ----------- -------- -----
1 0090.2b30.6c01 DYNAMIC Fa0/2
1 00d0.bcca.5601 DYNAMIC Fa0/1
*如果是PC,查看ARP表项: arp -a
C:\Users\Grind>arp -a
接口: 192.168.42.51 --- 0x2
Internet 地址 物理地址 类型
192.168.42.129 9e-b0-36-97-f4-71 动态
192.168.42.255 ff-ff-ff-ff-ff-ff 静态
224.0.0.22 01-00-5e-00-00-16 静态
224.0.0.252 01-00-5e-00-00-fc 静态
255.255.255.255 ff-ff-ff-ff-ff-ff 静态
搭建三PC连接统一交换机
Switch#conf t
Enter configuration comma