1.配置pc(ip 网关)
192.168.1.1 192.168.1.254
192.168.3.1 192.168.3.254
2.配置路由器
(1)设置端口ip
Router(config-if)#inter f 0/0 Router(config-if)#ip add 192.168.1.254 255.255.255.0 Router(config-if)#inter f 1/0 Router(config-if)#ip add 192.168.2.1 255.255.255.0
Router(config-if)#inter f 0/0 Router(config-if)#ip add 192.168.2.2 255.255.255.0 Router(config-if)#inter f 1/0 Router(config-if)#ip add 192.168.3.254 255.255.255.0
(2)设置路由表
ip route 192.168.3.0 255.255.255.0 192.168.2.2
ip route 192.168.1.0 255.255.255.0 192.168.2.1
(3)查看路由表
Router#sh ip route C 192.168.1.0/24 is directly connected, FastEthernet0/0 C 192.168.2.0/24 is directly connected, FastEthernet1/0 S 192.168.3.0/24 [1/0] via 192.168.2.2
Router#sh ip route S 192.168.1.0/24 [1/0] via 192.168.2.1 C 192.168.2.0/24 is directly connected, FastEthernet0/0 C 192.168.3.0/24 is directly connected, FastEthernet1/0