Cisco_Vlan_route

 

 

 

 

R3#configure terminal
R3(config)#interface fastEthernet 0/0
R3(config-if)#ip address 10.10.10.2 255.255.255.0
R3(config-if)#no shutdown
R3(config-if)#exit
R3(config)#no ip routing


=====================================================
R4#configure terminal
R4(config)#interface fastEthernet 0/0
R4(config-if)#ip address 20.20.20.2 255.255.255.0
R4(config-if)#no shutdown
R4(config-if)#exit
R4(config)#no ip routing


=====================================================
R2#vlan database
R2(vlan)#vlan 2 name VLAN2
R2(vlan)#vlan 3 name VLAN3

R2(vlan)#exit
R2#configure terminal
R2(config)#interface fastEthernet 1/0
R2(config-if)#switchport mode trunk
R2(config-if)#exit

R2(config)#interface fastEthernet 1/1
R2(config-if)#switchport access vlan 2
R2(config-if)#exit

R2(config)#interface fastEthernet 1/2
R2(config-if)#switchport access vlan 3
R2(config-if)#exit

R2(config)#no ip routing



=====================================================
R1#configure terminal
R1(config)#interface fastEthernet 0/0
R1(config-if)#no ip address
R1(config-if)#no shutdown
R1(config-if)#exit

R1(config)#interface fastEthernet 0/0.1
R1(config-subif)#encapsulation dot1Q 2
R1(config-subif)#ip address
R1(config-subif)#ip address 10.10.10.1 255.255.255.0
R1(config-subif)#exit

R1(config)#interface fastEthernet 0/0.2
R1(config-subif)#encapsulation dot1Q 3
R1(config-subif)#ip address 20.20.20.1 255.255.255.0
R1(config-subif)#exit
R1(config)#exit



=====================================================
R3#show interfaces
FastEthernet0/0 is up, line protocol is up
  Hardware is AmdFE, address is cc02.0a0c.0000 (bia cc02.0a0c.0000)
  Internet address is 10.10.10.2/24
  MTU 1500 bytes, BW 100000 Kbit, DLY 100 usec,
     reliability 255/255, txload 1/255, rxload 1/255
  Encapsulation ARPA, loopback not set
  Keepalive set (10 sec)
  Full-duplex, 100Mb/s, 100BaseTX/FX
  ARP type: ARPA, ARP Timeout 04:00:00
  Last input 00:00:01, output 00:00:09, output hang never
  Last clearing of "show interface" counters never
  Input queue: 0/75/0/0 (size/max/drops/flushes); Total output drops: 0
  Queueing strategy: fifo
  Output queue: 0/40 (size/max)
  5 minute input rate 0 bits/sec, 0 packets/sec
  5 minute output rate 0 bits/sec, 0 packets/sec
     541 packets input, 33864 bytes
     Received 521 broadcasts, 0 runts, 0 giants, 0 throttles
     0 input errors, 0 CRC, 0 frame, 0 overrun, 0 ignored
     0 watchdog
     0 input packets with dribble condition detected
     151 packets output, 15384 bytes, 0 underruns
     0 output errors, 0 collisions, 1 interface resets

R3#ping 20.20.20.2

Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 20.20.20.2, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 720/821/860 ms


=====================================================
R4#show interfaces
FastEthernet0/0 is up, line protocol is up
  Hardware is AmdFE, address is cc03.0a0c.0000 (bia cc03.0a0c.0000)
  Internet address is 20.20.20.2/24
  MTU 1500 bytes, BW 100000 Kbit, DLY 100 usec,
     reliability 255/255, txload 1/255, rxload 1/255
  Encapsulation ARPA, loopback not set
  Keepalive set (10 sec)
  Full-duplex, 100Mb/s, 100BaseTX/FX
  ARP type: ARPA, ARP Timeout 04:00:00
  Last input 00:00:00, output 00:00:02, output hang never
  Last clearing of "show interface" counters never
  Input queue: 0/75/0/0 (size/max/drops/flushes); Total output drops: 0
  Queueing strategy: fifo
  Output queue: 0/40 (size/max)
  5 minute input rate 0 bits/sec, 0 packets/sec
  5 minute output rate 0 bits/sec, 0 packets/sec
     551 packets input, 34966 bytes
     Received 530 broadcasts, 0 runts, 0 giants, 0 throttles
     0 input errors, 0 CRC, 0 frame, 0 overrun, 0 ignored
     0 watchdog
     0 input packets with dribble condition detected
     150 packets output, 15486 bytes, 0 underruns
     0 output errors, 0 collisions, 1 interface resets

R4#ping 10.10.10.2

Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 10.10.10.2, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 452/657/924 ms



 

<think>好的,我现在需要帮助用户了解思科交换机中VLANIF接口的配置和使用方法。首先,我得回顾一下自己之前学过的相关知识,确保信息的准确性。根据用户提供的引用内容,VLANIF接口主要用于三层交换机的VLAN间路由,这涉及到创建VLAN、将端口加入VLAN,然后为每个VLAN配置VLANIF接口作为网关。 用户可能对VLAN的基础概念有一定了解,但需要具体的配置步骤。我需要分步骤说明,从创建VLAN开始,到配置接口,再到设置VLANIF的IP地址。同时,可能需要提到验证命令,如display ip interface brief,这样用户能够确认配置是否成功。 另外,用户提供的引用中提到了静态路由和动态路由协议的配置,特别是在多台三层交换机之间。这部分内容可能需要简要提及,以展示VLANIF在更复杂网络中的应用。例如,当VLAN跨越多个三层设备时,如何通过路由协议实现通信。 需要注意的是,思科和华为的命令可能不同,但用户明确提到思科交换机,所以必须确保使用的是思科的CLI命令,比如使用interface vlan而不是vlanif。不过,引用内容中提到的VLANIF是华为的术语,这可能存在混淆。这时候需要指出思科中的对应概念是SVI(Switch Virtual Interface),并调整命令示例,避免用户误解。 此外,用户可能希望了解实际应用场景,比如不同VLAN间的通信,或者与外部网络的连接。应该举一些常见的例子,比如部门间隔离或服务器访问控制,以帮助用户理解配置的实际意义。 最后,生成相关问题时要覆盖配置步骤、验证方法、常见错误排查以及应用场景,确保用户能进一步深入学习可能遇到的问题。</think>### 思科交换机VLANIF接口配置及使用教程 在思科三层交换机中,**VLANIF接口(即SVI,Switch Virtual Interface)**是用于实现VLAN间路由的核心配置。以下是具体步骤及原理: --- #### 一、配置流程 1. **创建VLAN** ```cisco Switch(config)# vlan 10 ! 创建VLAN 10 Switch(config-vlan)# name Sales ! 可选:命名VLAN Switch(config)# vlan 20 ! 创建VLAN 20 ``` 2. **将接口划入VLAN** - **接入端口**(连接终端设备): ```cisco Switch(config)# interface GigabitEthernet1/0/1 Switch(config-if)# switchport mode access Switch(config-if)# switchport access vlan 10 ! 将该端口划入VLAN 10 ``` - **Trunk端口**(连接其他交换机): ```cisco Switch(config)# interface GigabitEthernet1/0/24 Switch(config-if)# switchport mode trunk Switch(config-if)# switchport trunk allowed vlan 10,20 ! 允许VLAN 10、20通过 ``` 3. **配置VLANIF接口(SVI)** ```cisco Switch(config)# interface Vlan10 ! 进入VLAN 10的虚拟接口 Switch(config-if)# ip address 192.168.10.1 255.255.255.0 ! 配置IP作为网关 Switch(config-if)# no shutdown ! 激活接口 ``` - 重复上述步骤为其他VLAN配置网关,例如VLAN 20配置`192.168.20.1/24`[^3]。 4. **验证配置** ```cisco Switch# show ip interface brief ! 查看所有接口状态(含VLANIF) Switch# show interfaces vlan10 ! 检查VLAN 10接口详细信息 ``` --- #### 二、关键应用场景 1. **VLAN间路由** 通过为每个VLAN配置SVI,交换机可直接转发不同VLAN间的流量,无需外接路由器[^3]。 2. **跨交换机VLAN通信** 若VLAN分布在多台交换机上,需配置Trunk链路透传VLAN,并在所有三层交换机上为同一VLAN配置SVI(IP需在同一子网)[^1]。 3. **与外部网络互联** - 在三层交换机上配置默认路由指向防火墙或路由器: ```cisco Switch(config)# ip route 0.0.0.0 0.0.0.0 192.168.1.254 ``` - 若网络中有多台三层交换机,需配置**OSPF**或**静态路由**实现路由同步[^4]。 --- #### 三、常见问题排查 1. **VLANIF接口状态为`down`** - 确保至少有一个属于该VLAN的端口处于`up`状态。 - 使用`show vlan brief`确认VLAN已创建且端口已划入。 2. **跨VLAN无法通信** - 检查SVI的IP地址是否在同一子网。 - 验证路由表中是否存在对应网段的路由条目(`show ip route`)。 ---
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值