交换路由实现全网互通1.配置各个交换机及路由器:【开头介绍一下命令的意思,以下同理】
Sw1:
[Huawei]sysname sw1 并创建vlan20和vlan40
[sw1]in g 0/0/1
[sw1-GigabitEthernet0/0/1]port link-type acc
[sw1-GigabitEthernet0/0/1]port def vlan 20//加入vlan20
[sw1]in g 0/0/2
[sw1-GigabitEthernet0/0/2]port link-type acc
[sw1-GigabitEthernet0/0/2]port def vlan 40
[sw1-GigabitEthernet0/0/2]q
[sw1]info-center
[sw1]interface vlan 40//进入vlan40
[sw1-Vlanif40]undo sh
Info: Interface Vlanif40 is not shutdown.
[sw1-Vlanif40]
[sw1-Vlanif40]
[sw1-Vlanif40]ip add 192.168.40.1 255.255.255.0//配置网关地址
[sw1-Vlanif40]q
[sw1-Vlanif20]ip add 192.168.20.254 255.255.255.0//配置网关地址
[sw1]rip //配置RIP
[sw1-rip-1]version 2//选择版本2
[sw1-rip-1]undo su
[sw1-rip-1]undo summary //关闭自动汇总
[sw1-rip-1]network 192.168.20.0//设置网段
[sw1-rip-1]network 192.168.40.0
[sw1-rip-1]q
Sw2:
[Huawei]sysname sw2
[sw2]vlan 30
[sw2-vlan30]vlan 60
[sw2-vlan60]q
[sw2]in g 0/0/1
[sw2-GigabitEthernet0/0/1]undo sh
Info: Interface GigabitEthernet0/0/1 is not shutdown.
[sw2-GigabitEthernet0/0/1]port link-type acc
[sw2-GigabitEthernet0/0/1]q
[sw2]in g 0/0/1
[sw2]in g 0/0/2
[sw2-GigabitEthernet0/0/2]und sh
Info: Interface GigabitEthernet0/0/2 is not shutdown.
[sw2-GigabitEthernet0/0/2]port link-type acc
[sw2-GigabitEthernet0/0/2]port def vlan 60
[sw2-GigabitEthernet0/0/2]q
[sw2]in vla 30
[sw2-Vlanif30]undo sh
Info: Interface Vlanif30 is not shutdown.
[sw2-Vlanif30]ip add 192.168.30.254 255.255.255.0
[sw2-Vlanif30]q
[sw2]in vlan 60
[sw2-Vlanif60]undo sh
Info: Interface Vlanif60 is not shutdown.
[sw2-Vlanif60]ip add 192.168.60.1 255.255.255.0
[sw2-Vlanif60]q
[sw2]rip
[sw2-rip-1]version 2
[sw2-rip-1]undo
[sw2-rip-1]undo su
[sw2-rip-1]network
[sw2-rip-1]network 192.168.30.0
[sw2-rip-1]network 192.168.60.0
[sw2-rip-1]q
Sw3:
[sw3]in g 0/0/1
[sw3-GigabitEthernet0/0/1]port def vlan 10
[sw3-GigabitEthernet0/0/1]q
[sw3]
[sw3]
[sw3]
[sw3]in g 0/0/2
[sw3-GigabitEthernet0/0/2]undo sh
Info: Interface GigabitEthernet0/0/2 is not shutdown.
[sw3-GigabitEthernet0/0/2]port link-type acc
[sw3-GigabitEthernet0/0/2]port def vlan 10
[sw3-GigabitEthernet0/0/2]q
[sw3]in g 0/0/3
[sw3-GigabitEthernet0/0/3]port link-typ acc
[sw3-GigabitEthernet0/0/3]q
[sw3]in g 0/0/4
[sw3-GigabitEthernet0/0/4]undo s
[sw3-GigabitEthernet0/0/4]port link-type acc
[sw3-GigabitEthernet0/0/4]port def vlan 50
[sw3-GigabitEthernet0/0/4]q
[sw3]in vlan 10
[sw3-Vlanif10]undo sh
Info: Interface Vlanif10 is not shutdown.
[sw3-Vlanif10]ip add 192.168.10.254 255.255.255.0
[sw3-Vlanif10]q
[sw3]in vlan 50
[sw3-Vlanif50]undo sh
Info: Interface Vlanif50 is not shutdown.
[sw3-Vlanif50]ip add 192.168.50.1 255.255.255.0
[sw3-Vlanif50]q
[sw3]rip
[sw3-rip-1]version 2
[sw3-rip-1]undo summary
[sw3-rip-1]network 192.168.10.0
[sw3-rip-1]network 192.168.50.0
[sw3-rip-1]q
R1:
[R1]in g 0/0/0
[R1-GigabitEthernet0/0/0]undo sh
Info: Interface GigabitEthernet0/0/0 is not shutdown.
[R1-GigabitEthernet0/0/0]ip add 192.168.40.254 255.255.255.0
[R1-GigabitEthernet0/0/0]q
[R1]in g 0/0/1
[R1-GigabitEthernet0/0/1]undo sh
Info: Interface GigabitEthernet0/0/1 is not shutdown.
[R1-GigabitEthernet0/0/1]ip add 10.10.1.1 255.255.255.0
[R1-GigabitEthernet0/0/1]q
[R1]rip
[R1-rip-1]version 2
[R1-rip-1]undo su
[R1-rip-1]undo summary
[R1-rip-1]network 192.168.20.0
[R1-rip-1]network 10.0.0.0
[R1-rip-1]network 192.168.40.0
[R1-rip-1]q
R2:
[R2]in g 0/0/0
[R2-GigabitEthernet0/0/0]undo sh
Info: Interface GigabitEthernet0/0/0 is not shutdown.
[R2-GigabitEthernet0/0/0]ip add 192.168.50.254 255.255.255.0
[R2-GigabitEthernet0/0/0]q
[R2]in g 0/0/1
[R2-GigabitEthernet0/0/1]undo sh
Info: Interface GigabitEthernet0/0/1 is not shutdown.
[R2-GigabitEthernet0/0/1]ip add 10.10.1.2 255.255.255.0
[R2-GigabitEthernet0/0/1]q
[R2]in g 0/0/2
[R2-GigabitEthernet0/0/2]undo sh
Info: Interface GigabitEthernet0/0/2 is not shutdown.
[R2-GigabitEthernet0/0/2]ip add 10.10.2.1 255.255.255.0
[R2-GigabitEthernet0/0/2]q
[R2]rip
[R2-rip-1]version 2
[R2-rip-1]undo su
[R2-rip-1]undo summary
[R2-rip-1]network 192.168.50.0
[R2-rip-1]network 192.168.10.0
[R2-rip-1]network 10.0.0.0
[R2-rip-1]q
R3:
[R3]in g 0/0/0
[R3-GigabitEthernet0/0/0]undo sh
Info: Interface GigabitEthernet0/0/0 is not shutdown.
[R3-GigabitEthernet0/0/0]ip add 192.168.60.254 255.255.255.0
Jan 16 2018 19:49:11-08:00 R3 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP
on the interface GigabitEthernet0/0/0 has entered the UP state.
[R3-GigabitEthernet0/0/0]q
[R3]in g 0/0/2
[R3-GigabitEthernet0/0/2]undo sh
Info: Interface GigabitEthernet0/0/2 is not shutdown.
[R3-GigabitEthernet0/0/2]ip add 10.10.2.2 255.255.255.0
Jan 16 2018 19:49:35-08:00 R3 %%01IFNET/4/LINK_STATE(l)[1]:The line protocol IP
on the interface GigabitEthernet0/0/2 has entered the UP state.
[R3-GigabitEthernet0/0/2]q
[R3]rip
[R3-rip-1]version 2
[R3-rip-1]undo su
[R3-rip-1]undo summary
[R3-rip-1]network 192.168.30.0
[R3-rip-1]network 192.168.60.0
[R3-rip-1]network 10.0.0.0
[R3-rip-1]q
2.验证、测试、保存
PC【终端】互ping