# 拓扑
![](https://box.kancloud.cn/0d6d550e362d9463835873b3a12b5c3c_958x479.png)
## R1
~~~
Router>enable
Router#configure terminal
Router(config)#hostname R1
R1(config)#interface GigabitEthernet0/0
R1(config-if)#no shutdown
R1(config)#interface GigabitEthernet0/0.10
R1(config-if)#encapsulation dot1Q 10
R1(config-if)#ip address 192.168.10.254 255.255.255.0
R1(config)#interface GigabitEthernet0/0.20
R1(config-if)#encapsulation dot1Q 20
R1(config-if)#ip address 192.168.20.254 255.255.255.0
R1(config)#interface GigabitEthernet0/1
R1(config-if)#ip address 12.1.1.1 255.255.255.0
R1(config-if)#no shutdown
R1(config)#router rip
R1(config-router)#version 2
R1(config-router)#no auto-summary
R1(config-router)#network 12.1.1.0
R1(config-router)#network 192.168.10.0
R1(config-router)#network 192.168.20.0
~~~
## R2
~~~
Router>enable
Router#configure terminal
Router(config)#hostname R2
R2(config)#interface GigabitEthernet0/1
R2(config-if)#ip address 12.1.1.2 255.255.255.0
R2(config-if)#no shutdown
R2(config)#interface GigabitEthernet0/0
R2(config-if)#ip address 23.1.1.2 255.255.255.0
R2(config-if)#no shutdown
R2(config)#router rip
R2(config-router)#version 2
R2(config-router)#no auto-summary
R2(config-router)#network 12.1.1.0
R2(config-router)#network 23.1.1.0
~~~
## R3
~~~
Router>enable
Router#configure terminal
Router(config)#hostname R3
R3(config)#interface GigabitEthernet0/0
R3(config-if)#ip address 23.1.1.3 255.255.255.0
R3(config-if)#no shutdown
R3(config)#interface GigabitEthernet0/1
R3(config-if)#ip address 34.1.1.3 255.255.255.0
R3(config-if)#no shutdown
R3(config)#router rip
R3(config-router)#version 2
R3(config-router)#no auto-summary
R3(config-router)#network 23.1.1.3
R3(config-router)#network 34.1.1.3
~~~
## MS1
~~~
Switch>enable
Switch#configure terminal
Switch(config)#hostname MS1
MS1(config)#ip routing
MS1(config)#interface FastEthernet0/1
MS1(config-if)#no switchport
MS1(config-if)#ip address 34.1.1.4 255.255.255.0
MS1(config)#vlan 30
MS1(config-vlan)#interface Vlan30
MS1(config-if)#ip address 192.168.30.254 255.255.255.0
MS1(config)#vlan 40
MS1(config-vlan)#interface Vlan40
MS1(config-if)#ip address 192.168.40.254 255.255.255.0
MS1(config)#router rip
MS1(config-router)#version 2
MS1(config-router)#no auto-summary
MS1(config-router)#network 34.0.0.0
MS1(config-router)#network 192.168.30.0
MS1(config-router)#network 192.168.40.0
~~~