设备 | 接口 | IP地址 | 子网掩码 | 网关 |
PC1 | 0/0 | 192.168.1.2 | 255.255.255.0 | 192.168.1.1 |
PC2 | 0/0 | 192.168.1.3 | 255.255.255.0 | 192.168.1.1 |
PC3 | 0/0 | 172.16.0.2 | 255.255.0.0 | 172.16.0.1 |
PC4 | 0/0 | 172.16.0.3 | 255.255.0.0 | 172.16.0.1 |
R1 | 0/0 | 192.168.1.1 | 255.255.255.0 | 无 |
R1 | 0/1 | 10.0.0.1 | 255.255.0.0 | 无 |
R2 | 0/0 | 10.0.0.2 | 255.255.0.0 | 无 |
R2 | 0/1 | 20.0.0.2 | 255.255.0.0 | 无 |
R3 | 0/0 | 172.16.0.1 | 255.255.0.0 | 无 |
R3 | 0/1 | 20.0.0.1 | 255.255.0.0 | 无 |
配置步骤:
- 给4台PC设置IP地址。
- 配置R2路由器:
- 特权模式enable
- 配置模式configure
- 端口模式(0/0):interface fastEthernet 0/0
- 设置IP:ip address 192.168.1.1 255.255.255.0
- 开启端口:no shutdown
- 退出该端口:exit
- 端口模式(0/0):interface fastEthernet 0/1
- 设置IP:ip address 10.0.0.1 255.255.0.0
- 开启端口:no shutdown
- 退出该端口:exit
- 路由配置:ip route 172.16.0.0 255.255.0.0 10.0.0.2
- 配置R1路由器:
- 特权模式enable
- 配置模式configure
- 端口模式(0/0):interface fastEthernet 0/0
- 设置IP:ip address 10.0.0.2 255.255.0.0
- 开启端口:no shutdown
- 退出该端口:exit
- 端口模式(0/0):interface fastEthernet 0/1
- 设置IP:ip address 20.0.0.2 255.255.0.0
- 开启端口:no shutdown
- 退出该端口:exit
- 路由配置:ip route 172.16.0.0 255.255.0.0 20.0.0.1
- 路由配置:ip route 192.168.1.0 255.255.255.0 10.0.0.1
- 配置R3路由器:
- 特权模式enable
- 配置模式configure
- 端口模式(0/0):interface fastEthernet 0/0
- 设置IP:ip address 172.16.0.1 255.255.0.0
- 开启端口:no shutdown
- 退出该端口:exit
- 端口模式(0/0):interface fastEthernet 0/1
- 设置IP:ip address 20.0.0.1 255.255.0.0
- 开启端口:no shutdown
- 退出该端口:exit
- 路由配置:ip route 192.168.1.0 255.255.255.0 20.0.0.2
- 测试PC1能否ping通PC3
练习:在上一个网络拓扑图中,加入一台新的路由器R4,请修改相关IP地址,并增加路由规则,使PC1能够ping通PC3.