電腦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地址,分別是兩個網段的網關)
(路由器端口0配置雙IP地址,分別是兩個網段的網關)
router(config)#ip routing
(開啓路由器路由功能)
(開啓路由器路由功能)
router(config)#exit
經測試:192.168.2.2能ping通192.168.7.2