电脑A:192.168.2.2 netmask 255.255.255.0 gw 192.168.2.1
电脑B:192.168.7.2 netmask 255.255.255.0 gw 192.168.7.1

交换机A无配置
路由器A配置如下:
router>enable
router#config t
router(config)#int f0/0
router(config-if)#ip address 192.168.2.1 255.255.255.0
router(config-if)#ip address 192.168.7.1 255.255.255.0 secondary
router(config-if)#no shutdown
router(config-if)#exit
(路由器端口0配置双IP地址,分别是两个网段的网关)
router(config)#ip routing
(开启路由器路由功能)
router(config)#exit

经测试:192.168.2.2能ping通192.168.7.2