交换机路由器配置

之前一直打算写博客,总是没有开好头,最近总算有了一个方向,于是决定把以前有的资料整理一下,一是形成习惯,二是做个备份。此次更新是第一次更新,内容包括计算机网络管理的基础内容。

交换机路由器配置,通过配置实现两边路由器到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数据包:

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

abin在路上

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值