在一个交换机上存在两个网段,R2可以配置辅助IP,以实现和两个网段的设备同时通信。
<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

 

R1的配置
Router> en
Router# config  t
Router(config)# host  R1
R1(config)# int  e0/1
R1(config-if )# ip  add  193.1.1.1  255.255.255.0
R1(config-if )# no  shut
R1(config-if )# exit
R1(config)# router  ospf  10
R1(config-router)# net  193.1.1.1  <?xml:namespace prefix = st1 ns = "urn:schemas-microsoft-com:office:smarttags" />0.0.0.0   a  0
R1(config-router)# end
R1#

 

 

R2的配置
Router> en
Router# config  t
Router(config)# host  R2
R2(config)# int  e0/1
R2(config-if )# ip  add  193.1.1.2  255.255.255.0
R2(config-if )# no  shut
R2(config-if )# int  e0/0
R2(config-if )# ip  add  192.168.10.1  255.255.255.0
R2(config-if )# no  shut
R2(config-if )# ip  add  172.19.35.15  255.255.255.0  secondary
R2(config-if )# duplex  full
R2(config-if )# exit

 

R2(config)# router  ospf  10
R2(config-router)# net  193.1.1.2  0.0.0.0  a  0
R2(config-router)# net  192.168.10.1  0.0.0.0  a  0
R2(config-router)# net  172.19.35.15  0.0.0.0  a  0
R2(config-router)# end
R2#

 

 

 

S1的配置

 

Router> en
Router# config  t
Router(config) # host  S1
S1(config)#  int  range  f0/0 – 3
S1(config-if-range)# no  shut
S1(config-if-range)# speed  10
S1(config-if-range)# duplex  full
S1(config-if-range)#end
S1#

 

 

R3的配置

 

Router> en
Router# config  t
Router(config)# host  R3
R3(config)# no  ip  routing      è关闭路由功能
R3(config)# ip  default-gateway   192.168.10.1    è指定默认网关
R3(config)# int  e0/0
R3(config-if )# ip  add  192.168.10.2  255.255.255.0
R3(config-if )# no  shut
R3(config-if )# duplex   full
R3(config-if )#end
R3#

 

 

R4的配置

 

Router> en
Router# config  t
Router(config)# host  R4
R4(config)# no  ip  routing      è关闭路由功能
R4(config)# ip  default-gateway   172.19.35.1    è指定默认网关
R4(config)# int  e0/0
R4(config-if )# ip  add  172.19.35.2  255.255.255.0
R4(config-if )# no  shut
R4(config-if )# duplex   full
R3(config-if )#end
R3#

 

 

 

R5的配置
Router> en
Router# config  t
Router(config)# host  R5
R5(config)# int  e0/0
R5(config-if)#  ip  add  172.19.35.1  255.255.255.0
R5(config-if)#  no  shut
R5(config-if)#  duplex  full
R5(config-if)# exit
R5(config)# ip  route  0.0.0.0  0.0.0.0  172.19.35.15
R5(config)#end
R5#

 

 

验证:在R1ping 192.168.10.2ping  172.19.35.2ping  172.19.35.1都能ping通即成功