目录
10.1 vlan间通信技术
实现不同vlan间的通讯:
示例一(多臂路由):
先配置SW1:
[SW1]vlan 10 20
[SW1]int g1/0/1
[SW1-GigabitEthernet1/0/1]port link-type access
[SW1-GigabitEthernet1/0/1]port access vlan 10
[SW1-GigabitEthernet1/0/1]int g1/0/2
[SW1-GigabitEthernet1/0/2]port link-type access
[SW1-GigabitEthernet1/0/2]port access vlan 20
[SW1-GigabitEthernet1/0/2]int g1/0/4
[SW1-GigabitEthernet1/0/4]port link-type access
[SW1-GigabitEthernet1/0/4]port access vlan 10
[SW1-GigabitEthernet1/0/4]int g1/0/3
[SW1-GigabitEthernet1/0/3]port link-type access
[SW1-GigabitEthernet1/0/3]port access vlan 20
再配置R1:
[R1]int g0/0/2
[R1-GigabitEthernet0/0/2]ip add 192.168.10.254 24
[R1-GigabitEthernet0/0/2]int g0/0/1
[R1-GigabitEthernet0/0/1]ip add 192.168.20.254 24
此时vlan10与vlan20能够互通了,这个也叫做多臂路由。
10.2 子接口技术
示例二(子接口技术):
先配置SW1:
[SW1]vlan 10 20
[SW1]int g1/0/1
[SW1-GigabitEthernet1/0/1]port link-type access
[SW1-GigabitEthernet1/0/1]port access vlan 10
[SW1-GigabitEthernet1/0/1]int g1/0/2
[SW1-GigabitEthernet1/0/2]port link-type access
[SW1-GigabitEthernet1/0/2]port access vlan 20
[SW1-GigabitEthernet1/0/2]int g1/0/24
[SW1-GigabitEthernet1/0/24]port link-type trunk
[SW1-GigabitEthernet1/0/24]port trunk permit vlan all
再配置R1:
[R1]int g0/0/0.10
[R1-GigabitEthernet0/0/0.10]vlan-type dot1q vid 10
[R1-GigabitEthernet0/0/0.10]ip add 192.168.10.254 24
[R1-GigabitEthernet0/0/0.10]int g0/0/0.20
[R1-GigabitEthernet0/0/0.20]vlan-type dot1q vid 20
[R1-GigabitEthernet0/0/0.20]ip add 192.168.20.254 24
10.3 vlannif接口技术
10.3.1 三层交换机与VLANNIF技术
示例三VLANNIF配置(将交换机当成路由器使用):
先配置SW1:
[SW1-GigabitEthernet1/0/3]port link-type access
[SW1-GigabitEthernet1/0/3]port access vlan 10
[SW1-GigabitEthernet1/0/3]int g1/0/4
[SW1-GigabitEthernet1/0/4]port link-type access
[SW1-GigabitEthernet1/0/4]port access vlan 20
#设置三层vlan,这个vlan可以当作网关,这个网关是交换机内置的一个虚拟路由器的
[SW1]interface vlan-interface 10
[SW1-Vlan-interface10]ip add 192.168.10.254 24
[SW1-Vlan-interface10]interface vlan-interface 20
[SW1-Vlan-interface20]ip add 192.168.20.254 24
此时的vlan10与vlan20区域的IP能够互通。
后配置R1与SW1使得与外网通讯:
[R1]int g0/0/1
[R1-GigabitEthernet0/0/1]ip add 10.1.1.1 24#环回口用于测试通往外网的接口
[R1-GigabitEthernet0/0/1]int LoopBack 0
[R1-LoopBack0]ip add 1.1.1.1 32
配置静态路由是为了与内网互通
[R1]ip route-static 192.168.10.0 24 g0/0/1 10.1.1.2
[R1]ip route-static 192.168.20.0 24 g0/0/1 10.1.1.2
[SW1-GigabitEthernet1/0/1]port link-mode route #设置成三层接口
[SW1-GigabitEthernet1/0/1]ip add 10.1.1.2 24 #直接当路由器来用
#当路由器配置静态路由用来与外网互通
[SW1]ip route-static 1.1.1.1 32 g1/0/1 10.1.1.1
标签:R1,接口技术,vlan,GigabitEthernet1,access,与子,SW1,H3CNE,port From: https://blog.csdn.net/2201_75638644/article/details/140695514