频道栏目
首页 > 资讯 > 路由器 > 正文

交换机路由器配置教程

18-04-18        来源:[db:作者]  
收藏   我要投稿

交换机路由器配置,通过配置实现两边路由器到pc连通,同时,通过配置静态路由实现左边与右边区域互相通信。网络拓扑图如下:

pc0、pc2属于vlan1,pc1、pc3属于vlan2,首先通过基础配置,实现同一vlan间相互通信,再在三层交换机配置ip routing,实现vlan1和vlan2通信,再在三层交换机和路由器上配置路由表(ospf、rip、静态路由其中一种),实现pc到路由器的通信,右边区域同理,最后在R0和R1上配置静态路由,实现两个区域的通信。

代码:

##基础配置

#ms0

en
conf t
vlan 10
vlan 20
int vlan 10
ip add 192.168.10.1 255.255.255.0
int vlan 20
ip add 192.168.20.1 255.255.255.0
exit
vtp mode server
vtp domain abin
vtp password 123
int f0/1
switchport trunk encapsulation dot1q
swi mo tr
int f0/2
switchport trunk encapsulation dot1q
swi mo tr
exit
ip routing
int f0/3
no switchport
ip add 172.168.10.1 255.255.255.0
no shut
exit
router ospf 1
network 192.168.10.0 0.0.0.255 area 1
network 192.168.20.0 0.0.0.255 area 1
network 172.168.10.0 0.0.0.255 area 1
exit
ip route 0.0.0.0 0.0.0.0 172.168.10.2

#s0

en
conf t
vtp mode client
vtp domain abin
vtp password 123
int f0/1
sw mo ac
sw ac v 10
int f0/2
sw mo ac
sw ac v 20
int f0/3
sw mo tr

#s1

en
conf t
vtp mode client
vtp domain abin
vtp password 123
int f0/1
sw mo ac
sw ac v 10
int f0/2
sw mo ac
sw ac v 20
int f0/3
sw mo tr

#r0

en
conf t
int f0/0
ip add 172.168.10.2 255.255.255.0
no shut
int s0/0/0
ip add 10.1.1.1 255.255.255.0
no shut
exit
router ospf 1
network 172.168.10.0 0.0.0.255 area 1
exit
ip route 0.0.0.0 0.0.0.0 10.1.1.2

#ms1

en
conf t
vlan 30
vlan 40
int vlan 30
ip add 192.168.30.1 255.255.255.0
int vlan 40
ip add 192.168.40.1 255.255.255.0
exit
vtp mode server
vtp domain abin
vtp password 123
int f0/1
switchport trunk encapsulation dot1q
swi mo tr
int f0/2
switchport trunk encapsulation dot1q
swi mo tr
exit
ip routing
int f0/3
no switchport
ip add 172.168.20.1 255.255.255.0
no shut
exit
router ospf 1
network 192.168.30.0 0.0.0.255 area 1
network 192.168.40.0 0.0.0.255 area 1
network 172.168.20.0 0.0.0.255 area 1
exit
ip route 0.0.0.0 0.0.0.0 172.168.20.2

#s2

en
conf t
vtp mode client
vtp domain abin
vtp password 123
int f0/1
sw mo ac
sw ac v 30
int f0/2
sw mo ac
sw ac v 40
int f0/3
sw mo tr

#s3

en
conf t
vtp mode client
vtp domain abin
vtp password 123
int f0/1
sw mo ac
sw ac v 30
int f0/2
sw mo ac
sw ac v 40
int f0/3
sw mo tr

#r1

en
conf t
int f0/0
ip add 172.168.20.2 255.255.255.0
no shut
int s0/0/0
ip add 10.1.1.2 255.255.255.0
no shut
exit
router ospf 1
network 172.168.20.0 0.0.0.255 area 1
exit
ip route 0.0.0.0 0.0.0.0 10.1.1.1

结果检测:

使用ping命令通过pc0向pc6发送icmp数据包:

相关TAG标签
上一篇:Traits 编程技法+模板偏特化+template参数推导+内嵌型别编程技巧
下一篇:PHP如何获取数组指定值得位置?
相关文章
图文推荐

关于我们 | 联系我们 | 广告服务 | 投资合作 | 版权申明 | 在线帮助 | 网站地图 | 作品发布 | Vip技术培训 | 举报中心

版权所有: 红黑联盟--致力于做实用的IT技术学习网站