1交换机Trunk端口配置1.1组网需求1.SwitchA与SwitchB用trunk互连,相同VLAN的PC之间可以互访,不同VLAN的PC之间禁止互访;2.PC1与PC2之间在不同VLAN,通过设置上层三层交换机SwitchB的VLAN接口10的IP地址为10.1.1.254/24,VLAN接口20的IP地址为20.1.1.254/24可以实现VLAN间的互访。1.2组网图1.VLAN内互访,VLAN间禁访2.通过三层交换机实现VLAN间互访1.3配置步骤实现VLAN内互访VLAN间禁访配置过程SwitchA相关配置:1.创建(进入)VLAN10,将E0/1加入到VLAN10[SwitchA]vlan10[SwitchA-vlan10]portEthernet0/12.创建(进入)VLAN20,将E0/2加入到VLAN20[SwitchA]vlan20[SwitchA-vlan20]portEthernet0/23.将端口G1/1配置为Trunk端口,并允许VLAN10和VLAN20通过[SwitchA]interfaceGigabitEthernet1/1[SwitchA-GigabitEthernet1/1]portlink-typetrunk[SwitchA-GigabitEthernet1/1]porttrunkpermitvlan1020SwitchB相关配置:1.创建(进入)VLAN10,将E0/10加入到VLAN10[SwitchB]vlan10[SwitchB-vlan10]portEthernet0/102.创建(进入)VLAN20,将E0/20加入到VLAN20[SwitchB]vlan20[SwitchB-vlan20]portEthernet0/203.将端口G1/1配置为Trunk端口,并允许VLAN10和VLAN20通过[SwitchB]interfaceGigabitEthernet1/1[SwitchB-GigabitEthernet1/1]portlink-typetrunk[SwitchB-GigabitEthernet1/1]porttrunkpermitvlan1020通过三层交换机实现VLAN间互访的配置SwitchA相关配置:1.创建(进入)VLAN10,将E0/1加入到VLAN10[SwitchA]vlan10[SwitchA-vlan10]portEthernet0/12.创建(进入)VLAN20,将E0/2加入到VLAN20[SwitchA]vlan20[SwitchA-vlan20]portEthernet0/23.将端口G1/1配置为Trunk端口,并允许VLAN10和VLAN20通过[SwitchA]interfaceGigabitEthernet1/1[SwitchA-GigabitEthernet1/1]portlink-typetrunk[SwitchA-GigabitEthernet1/1]porttrunkpermitvlan1020SwitchB相关配置:1.创建VLAN10[SwitchB]vlan102.设置VLAN10的虚接口地址[SwitchB]interfacevlan10[SwitchB-int-vlan10]ipaddress10.1.1.254255.255.255.03.创建VLAN20[SwitchB]vlan204.设置VLAN20的虚接口地址[SwitchB]interfacevlan20[SwitchB-int-vlan20]ipaddress20.1.1.254255.255.255.05.将端口G1/1配置为Trunk端口,并允许VLAN10和VLAN20通过[SwitchA]interfaceGigabitEthernet1/1[SwitchA-GigabitEthernet1/1]portlink-typetrunk[SwitchA-GigabitEthernet1/1]porttrunkpermitvlan10202链路聚合2.1链路聚合链路聚合是将多个物理以太网端口聚合在一起形成一个逻辑上的聚合组,使用链路聚合服务的上层实体把同一聚合组内的多条物理链路视为一条逻辑链路。链路聚合可以实现出/入负荷在聚合组中各个成员端口之间分担,以增加带宽。同时,同一聚合组的各个成员端口之间彼此动态备份,提高了连接可靠性。2.2组网图DeviceALinkaggregationDeviceBEth2/0/1Eth2/0/2Eth2/0/3Eth2/0/1Eth2/0/2Eth2/0/32.3组网需求设备DeviceA用3个端口聚合接入设备DeviceB,从而实现出/入负荷在各成员端口中分担。DeviceA的接入端口为Ethernet2/0/1~Ethernet2/0/3。2.4配置过程和解释DeviceB同样需要配置采用静态聚合模式#创建二层聚合端口1。DeviceAsystem-view[DeviceA]interfacebridge-aggregation1[DeviceA-Bridge-Aggregation1]quit#将以太网端口Ethernet2/0/1至Ethernet2/0/3加入聚合组1。[DeviceA]interfaceethernet2/0/1[DeviceA-Ethernet2/0/1]portlink-aggregationgroup1[DeviceA-Ethernet2/0/1]interfaceethernet2/0/2[DeviceA-Ethernet2/0/2]portlink-aggregationgroup1[DeviceA-Ethernet2/0/2]interfaceethernet2/0/3[DeviceA-Ethernet2/0/3]portlink-aggregationgroup1采用动态聚合模式#创建二层聚合端口1,并配置成动态聚合模式。DeviceAsystem-view[DeviceA]interfacebridge-aggregation1[DeviceA-Bridge-Aggregation1]link-aggregationmodedynamic[DeviceA-Bridge-Aggregation1]quit#将以太网端口Ethernet2/0/1至Ethernet2/0/3加入聚合组1。[DeviceA]interfaceethernet2/0/1[DeviceA-Ethernet2/0/1]portlink-aggregationgroup1[DeviceA-Ethernet2/0/1]interfaceethernet2/0/2[DeviceA-Ethernet2/0/2]portlink-aggregationgroup1[DeviceA-Ethernet2/0/2]interfaceethernet2/0/3[DeviceA-Ethernet2/0/3]portlink-aggregationgroup12.5配置注意事项Bridge-Aggregation视图下配置应与聚合组中端口下配置一致。3DHCP服务器动态分配地址3.1组网图WINSserver10.1.1.4/25ClientSwitchBClientDNSserver10.1.1.2/25SwitchADHCPserverVlan-int210.1.1.129/25Vlan-int110.1.1.1/25ClientClientClientClientVlan-int1GatewayBGatewayA10.1.1.126/2510.1.1.254/25DHCP服务器动态分配地址组网图3.2应用要求作为DHCP服务器的SwitchA为网段10.1.1.0/24中的客户端动态分配IP地址,该地址池网段分为两个子网网段:10.1.1.0/25和10.1.1.128/25;SwitchA的两个VLAN接口,VLAN接口1和VLAN接口2的地址分别为10.1.1.1/25和10.1.1.129/25;10.1.1.0/25网段内的地址租用期限为10天12小时,域名后缀为aabbcc.com,DNS服务器地址为10.1.1.2/25,WINS服务器地址为10.1.1.4/25,网关的地址为10.1.1.126/25;10.1.1.128/25网段内的地址租用期限为5天,域名后缀为aabbcc.com,DNS服务器地址为10.1.1.2/25,无WINS服务器地址,网关的地址为10.1.1.254/25。10.1.1.0/25网段与10.1.1.128/25网段的域名后缀、DNS服务器地址相同,可以只配置10.1.1.0/24网段的域名后缀和DNS服务器地址,10.1.1.0/25网段与10.1.1.128/25网段继承10.1.1.0/24网段的配置。开启SwitchA的伪服务器检测功能,方便管理员从系统日志中查找伪服务器信息。3.3配置过程和解释#使能DHCP服务。[SwitchA]dhcpenable#配置不参与自动分配的IP地址(DNS服务器、WINS服务器和网关地址)。[SwitchA]dhcpserverforbidden-ip10.1.1.2[SwitchA]dhcpserverforbidden-ip10.1.1.4[SwitchA]dhcpserverforbidden-ip10.1.1.126[SwitchA]dhcpserverforbidden-ip10.1.1.254#配置伪服务器检测功能。[SwitchA]dhcpserverdetect#配置DHCP地址池0的共有属性(地址池范围、DNS服务器地址)。[SwitchA]dhcpserverip-pool0[SwitchA-dhcp-pool-0]network10.1.1.0mask255.255.255.0[SwitchA-dhcp-pool-0]domain-nameaabbcc.com[SwitchA-dhcp-pool-0]dns-list10.1.1.2[SwitchA-dhcp-pool-0]quit#配置DHCP地址池1的属性(地址池范围、网关、WINS服务器地址、地址租用期限)。[SwitchA]dhcpserverip-pool1[SwitchA-dhcp-pool-1]network10.1.1.0mask255.255.255.128[SwitchA-dhcp-pool-1]gateway-list10.1.1.126[SwitchA-dhcp-pool-1]expiredday10hour12[SwitchA-dhcp-pool-1]nbns-list10.1.1.4[SwitchA-dhcp-pool-1]quit#配置DHCP地址池2的属性(地址池范围、地址租用期限、网关)。[SwitchA]dhcpserverip-pool2[SwitchA-dhcp-pool-2]network10.1.1.128mask255.255.255.128[SwitchA-dhcp-pool-2]expiredday5[SwitchA-dhcp-pool-2]gateway-list10.1.1.254[SwitchA-dhcp-pool-2]quit开启伪服务器检测功能后,SwitchA记录所有DHCP服务器的信息,包括合法的DHCP服务器。管理员需要从系统日志中查找伪DHCP服务器。当SwitchA发现网络中的其它DHCP服务器时,会记录如下所示的日志信息。SwitchA%Apr3008:07:51:8962000H3CDHCPS/4/DHCPS_LOCAL_SERVER:LocalDHCPserverinformation:ServerIP(detectedbyDHCPserver)=10.1.1.5,DHCPserverinterface=Vlan-interface1Sourcecli