假设 IP地址规划如下:
pc1 --- 192.168.1.0/24 ---- router1 ---192.168.2.0/24 --- router2 --- 192.168.3.0/24 --- pc2
PC1上设置网关为: 192.168.1.1
router1配置
interface f0/0
ip address 192.168.1.1 255.255.255.0
no shut
interface f0/1
ip address 192.168.2.1 255.255.255.0
no sht
ip route 192.168.3.0 255.255.255.0 192.168.2.2
router2配置
interface f0/0
ip address 192.168.2.2 255.255.255.0
no shut
interface f0/1
ip address 192.168.3.1 255.255.255.0
no sht
ip route 192.168.1.0 255.255.255.0 192.168.2.1
PC2 网关设置为192.168.3.1