一个VLAN=一个广播域=一个网段
静态VLAN命令:
1.创建VLAN:
conf t
vlan ID,ID
exit
2.查看vlan简要信息
show vlan b
3.将端口加入到VLAN
int f0/x
switchport access vlan ID
exit
trunk
trunk/中继链路/公共链路
作用:允许所有VLAN数据通过trunk链路
方法:通过在数据帧上加标签,来区分不同的vlan的数据
trunk标签:
1.ISL标签:cisco私有的,标签26+4
2.802.1q标签:共有协议,所有厂家都支持,标签大小4字节。属于内部标签。
3.交换机端口链路类型:
接入端口:也称为access端口,一般用于连接pc,只能属于某1个vlan,也只能传输1个vlan的数据
中继端口:也成为trunk端口,一般用于连接其他交换机,属于公共端口,允许所有vlan的数据通过
配置trunk命令
int f0/x
switchport trunk encapsulation dotlq/is (可选)
switchport mode trunk
exit
单臂路由
缺点:
1.网络瓶颈
2.容易发生单点物理故障(所有的子接口依赖于总物理接口)
3.VLAN间通信每一个帧都进行单独路由
命令
conf t
int f0/0.1
encapsulation dot1q 10
ip add 10.1.1.254 255.255.255.0
no shut
exit
int f0/0.2
eccapsulation dot1q 20
ip add 20.1.1.254 255.255.255.0
no shut
exit
int f0/0
no shut
在三层路由器上部署DHCP服务器
conf t
ip dhcp excluded-address 10.1.1.1 10.1.1.99 //排除地址池
ip dhcp pool v10 //v10(地址池名字)
network 10.1.1.0 255.255.255.0 //网段
default-router 10.1.1.254 //默认网关
dns-server 40.1.1.1 //dns
lease 1 0 0 //(租约)
exit
删除:
no ip dhcp excluded-address 10.1.1.1 10.1.1.99
no ip dhcp pool v10
DHCP中继
跨网段获取地址
命令
f0/0.1
ip helper-address 40.1.1.1 (40.1.1.1是DHCP服务器地址)
exit