单臂路由实现VLAN间通信

实验要求:利用路由器完成同vlan能通信,不同vlan也能通信

拓扑如下:

涉及内容有:

1.VTP的创建和配置

2.VLAN的创建和划分

3.路由器的单臂路由配置

配置如下:

route1

enable       进入特权模式

configure terminal     进入全局模式

interface f0/0     进入端口

no shutdown           开启端口

interface f0/0.1     进入子端口

encapsulation dot1q 10  封装端口(不封装给不了IP地址)

ip address 192.168.1.254 255.255.255.0  给子端口设置IP地址

interface f0/0.2     进入子端口

encapsulation dot1q 20  封装端口

ip address 192.168.2.254 255.255.255.0  给子端口设置IP地址

interface f0/0.3     进入子端口

encapsulation dot1q 30  封装端口

ip address 192.168.3.254 255.255.255.0  给子端口设置IP地址

interface f0/0.4     进入子端口

encapsulation dot1q 40  封装端口

ip address 192.168.4.254 255.255.255.0  给子端口设置IP地址

end          返回特权模式

copy running-config startup-config  保存

A

enable       进入特权模式

configure terminal  进入全局模式

vtp domain test      创建VTP域

vtp mode server     设置当前交换机在VTP的工作模式

vlan 10         创建vlan 10

vlan 20         创建vlan 20

vlan 30         创建vlan 30

vlan 40                    创建 vlan 40

interface range f0/1-4       进入端口

switchport mode trunk      设置端口为trunk模式

interface range f0/10,f0/20 进入端口

switchport mode access  设置端口为access模式  

switchport access vlan 40  将端口划分到vlan 40

end           返回特权模式

copy running-config startup-config  保存

B

enable        进入特权模式

configure terminal   进入全局模式

vtp mode client     设置当前交换机在VTP中的工作模式

interface f0/1             进入端口

switchport mode access      设置当前端口为access模式

switchport access vlan 10      将端口划分到vlan 10

interface f0/2             进入端口

switchport mode access     设置当前端口为access模式

switchport access vlan 20     将端口划分到vlan 20

interface f0/3            进入端口

switchport mode access    设置当前端口为access模式

switchport access vlan 30    将端口划分到vlan 30

interface f0/4           进入端口

switchport mode trunk    将端口设置为trunk模式

end             返回特权模式

copy running-config startup-config  保存

C

enable        进入特权模式

configure terminal      进入全局模式

vtp mode client     设置当前交换机在VTP中的工作模式

interface f0/1        进入端口

switchport mode access   设置当前端口为access模式

switchport access vlan 10   将端口划分到vlan 10

interface f0/2        进入端口

switchport mode access   设置当前端口为access模式

switchport access vlan 20   将端口划分到vlan 20

interface f0/3        进入端口

switchport mode access   设置当前端口为access模式

switchport access vlan 30  将端口划分到vlan 30

interface f0/4         进入端口

switchport mode trunk     将端口设置为trunk模式

end              返回特权模式

copy running-config startup-config  保存

D

enable        进入特权模式

configure terminal   进入全局模式

vtp mode client     设置当前交换机在VTP中的工作模式

interface f0/1      进入端口

switchport mode access    设置当前端口为access模式

switchport access vlan 10    将端口划分到vlan 10

interface f0/2         进入端口

switchport mode access    设置当前端口为access模式

switchport access vlan 20    将端口划分到vlan 20

interface f0/3         进入端口

switchport mode access    设置当前端口为access模式

switchport access vlan 30    将端口划分到vlan 30

interface f0/4         进入端口

switchport mode trunk     将端口设置为trunk模式

end              返回特权模式

copy running-config startup-config  保存

猜你喜欢

转载自www.cnblogs.com/guoshiyu/p/9178638.html