%无法创建子接口

网络工程 路由 错误
2022-03-06 15:21:06

我正在尝试用 1 个路由器连接 4 个网络,我在路由器中创建了 2 个子接口,当我尝试创建第三个子接口时,我得到了这个输出“%Cannot create sub-interface”,这是我的拓扑:https://i.gyazo.com/0d7939a1116e10e3792fe5fd843e35d7.png

这是我路由器的配置:

hostname Router
!
ip cef
ip ipv6 cef
!
spanning-tree mode pvst
!
interface GigabitEthernet0/0/0
no ip address
duplex auto
speed auto
!
interface GigabitEthernet0/0/0.10
encapsulation dot 1Q 10
ip address 10.1.1.254 255.255.255.0
!
interface GigabitEthernet0/0/1
no ip address
duplex auto
speed auto
!
interface GigabitEthernet0/0/1.20
no ip address
!
interface GigabitEthernet0/0/2
no ip address
duplex auto
speed auto
shutdown
!
interface GigabitEthernet0/1/0
swithport mode access
switchport nonegotiate
!
!
interface GigabitEthernet0/1/1
swithport mode access
switchport nonegotiate
!
!
interface GigabitEthernet0/1/2
swithport mode access
switchport nonegotiate
!
!
interface GigabitEthernet0/1/3
swithport mode access
switchport nonegotiate
!
interface Vlan1
no ip address 
!
ip classless
!
ip flow-export version 9
!
line con 0
!
line aux 0
!
line vty 0 4
 login
!
end

我需要创建 4 个网络,每个网络都有一个唯一的 VLAN。并为每个VLAN添加默认网关,使PC相互通信。我知道最好只放置 1 个网络并通过 1 个交换机分隔 VLAN。但我想在路由器中使用比交换机更多的接口。

1个回答

请放松我的配置并尝试

Router(config)#iint gigabit Ethernet 0/0/0 #no ip address #no shutdown

Router(config)# int gigabit Ethernet 0/0/0.10 #ip address xxxx xxxx #encapusation dot1q 10 #no shut`

Router(config)#int gigabit ethernet 0/0/0.20 #encapsulation dot1q 20 #ip address x.x.x.x x.xx.x #no shutdown

Router (config)#int gigabit ethernet 0/0/0.30 #encapsulation dot1q 30 #ip address x.x.x.x x.x.x.x #no shutdown

Router(config)# int gigabit Ethernet 0/0/0.40 #encapsulation dot1q 40 #ip address x.x.x.x x.x.x.x #no shutdown

在二层交换机配置中

在连接到路由器的交换机接口中配置中继端口,以便 vlan 10、Vlan20、Vlan30、Vlan40 流量将从路由器流向交换机从该中继端口

Switch(config)# int 0/1 #switch Port trunk #switch trunk allowed vlan all #no shutdown

根据您的要求创建访问端口,例如下面

Switch (config)#int 0/2 #switchport mode access #switch Port access vlan10 #no shutdown/请将此接口连接到终端设备/

在此交换机中创建 vlan

Switch(config)#vlan 10 #name finances

Switch(config)#vlan 20 #name account

Switch(config)#vlan30 #name operation

Switch(config)# Vlan40 #name hr

试试上面的配置....