
vlan
创建VLAN:
[h3c]vlan 11 任何型号的交换机,都支持4096个VLAN VLAN ID从0 -- 4095 VLAN 0是保留VLAN VLAN 1是默认VLAN 删除ID为11的VLAN: undo vlan 11 display vlan 查看本机有多少个VLAN, VLAN ID是多少 把交换机的接口加入到不同的VLAN中,不同VLAN中的 就接口属于不同的广播域 举例: 1、创建ID为10, 20 , 30的VLAN,把E0/4/0加入到VLAN10 把E0/4/1加入到VLAN 20,把E0/4/3加入到VLAN 30 注意:一定要先一下接口的名称: display cu interface 创建VLAN: vlan 10 vlan 20 vlan 30 把接口加入VLAN interface Ethernet0/4/0 port link-mode bridge port access vlan 10 interface Ethernet0/4/1 port link-mode bridge port access vlan 20 interface Ethernet0/4/2 port link-mode bridge port access vlan 30 如何查看验证? 看VLAN的方法: [SW1]display vlan 10 笔记-6月16日 2016年6月16日 9:11 分区 网络笔记-6月16日 的第 1 页 [SW1]display vlan 10 VLAN ID: 10 VLAN Type: static Route Interface: not configured Description: VLAN 0010 Name: VLAN 0010 Broadcast MAX-ratio: 100% Tagged Ports: none Untagged Ports: Ethernet0/4/0 看接口的方法: display int e0/4/0 2、 Trunk 概念:只用一条链路,实现相同ID的VLAN跨交换机通信 连接终端的链路一定是接入链路 接入链路: port link-type access 交换机连接交换机多半是中继链路 交换机连接路由器也有可能是中继链路 中继链路的实质就是给数据帧Tagget VLAN标签 中继链路: port link-type trunk 举例:交换机的Gi 0/0/0改成中继链路,只允许中继VLAN 10和VLAN 20 交换机的Gi0/0/1改成中继链路,只允许中继VLAN 30 interface GigabitEthernet0/0/0 port link-mode bridge port link-type trunk port trunk permit vlan 1 10 20 两个交换机互联接口的配置必须相同 interface GigabitEthernet0/0/1 port link-mode bridge port link-type trunk port trunk permit vlan 1 30 如果不希望Gi0/0/1接口中继VLAN 1,则输入这条命令: undo port trunk permit vlan 1 如何查看? 1、可以从接口配置查看 [SW1]display cu int gi 0/0/0 # interface GigabitEthernet0/0/0 port link-mode bridge port link-type trunk port trunk permit vlan 1 10 20 # 2 、从VLAN查看 分区 网络笔记-6月16日 的第 2 页 2、从VLAN查看 目的:了解该VLAN目前有哪些接口加入,被哪些接口中继 [SW1]dis vlan 20 VLAN ID: 20 VLAN Type: static Route Interface: not configured Description: VLAN 0020 Name: VLAN 0020 Broadcast MAX-ratio: 100% Tagged Ports: GigabitEthernet0/0/0 Untagged Ports: Ethernet0/4/1 Tagged ports:说明该VLAN被哪些Trunk接口中继 Untagged Ports: 说明有哪些接口加入该VLAN 拓扑图 需求 1、在三个交换机上创建VLAN 10, 20 , 30 , 40 2、要求配置生成树协议 SW1作为 10 20 的根桥 SW2作为 30 40 的根桥 SW1/SW2/SW3 vlan 10 vlan 20 vlan 30 验证: [SW2]dis vlan Total 5 VLAN exist(s). The following VLANs exist: 1(default), 10, 20, 30, 40, 分区 网络笔记-6月16日 的第 3 页 把交换机互联接口改成中继模式,允许10, 20,30,40VLAN通过 SW1/SW2/SW3配置相同 interface Ethernet0/4/0 port link-mode bridge port link-type trunk port trunk permit vlan 1 10 20 30 40 interface Ethernet0/4/1 port link-mode bridge port link-type trunk port trunk permit vlan 1 10 20 30 40 配置生成树的时候,三个交换机必须配置相同的实例 而且,开启生成树功能: SW1/SW2/SW3 stp enable 配置实例原则: 1、网络中有几个根桥,就配几个实例 2、做VLAN的根桥,要把VLAN配置到一个实例中 配置命令 SW1/SW2/SW3 stp region-configuration region-name GZDW instance 1 vlan 10 20 instance 2 vlan 30 40 active region-configuration 配置SW1成为vlan 10 20 的根桥 [SW1]stp instance 1 priority 0 配置SW2成为vlan 30 40 的根桥 [SW2]stp instance 2 priority 0 查看: [SW1]display stp instance 1 brief MSTID Port Role STP State Protection 1 Ethernet0/4/0 DESI FORWARDING NONE 1 Ethernet0/4/1 DESI FORWARDING NONE 分区 网络笔记-6月16日 的第 4 页 DESI代表指定端口,而根桥上的端口全是指定端口 [SW1]display stp instance 2 brief MSTID Port Role STP State Protection 2 Ethernet0/4/0 ROOT FORWARDING NONE 2 Ethernet0/4/1 ALTE DISCARDING NONE Root代表根端口, ALTE,替代端口(被阻塞的端口) 开启边缘接口 stp edged-port enable 拓扑图 需求描述: 1、 VLAN 与IP地址的规划 VLAN 10 : 10.10.1.0/24 VLAN 20 : 10.20.1.0/24 VLAN 30 : 10.30.1.0/24 VLAN 40 : 10.40.1.0/24 ※:只给SW1和SW2的VLAN配置IP地址, SW3作为纯粹的二层设备 2、配置VRRP, SW1作为VLAN 10 20主用设备, SW2作为VLAN 30 40的主用设备 ※: VRRP通常要和生成树一起配置 某个VLAN的根桥一定要和VRRP的主用设备位于同一台设备 配置vrrp需要指定的参数 a、指定漂移地址,漂移地址作为当前VLAN的默认网关 漂移地址必须和当前VLANIF的IP在一个网段 但是,不能和当前IP地址相同 两台设备必须指定相同的漂移地址 vrrp vrid 10 virtual-ip 指定漂移地址 分区 网络笔记-6月16日 的第 5 页 vrrp vrid 10 virtual-ip 指定漂移地址 b、配置优先级和占先权 主用设备的优先级高于备用设备 优先级默认值是100 vrrp vrid 10 prio [优先级数值] vrrp vrid 10 preem c、配置跟踪对象 在主用设备上面跟踪对象 一旦对象失效,就降低一定的优先级 降到比备用设备的优先级更低 vrrp vrid 10 track 接口 降低的值 3、给交换机配置Loopback接口地址, SW1: 10.1.1.1 SW2: 10.2.2.2 SW3: 10.3.3.3 4、配置OSPF路由协议使得全网互通 5、 SW1、 SW2、 SW3开启SSH远程访问 用户级别设置为0 要求输入super密码以后才可以使用system-view命令 配置命令:给VLAN配置IP地址 SW1: int vlan 10 ip add 10.10.1.253 24 int vlan 20 ip add 10.20.1.253 24 int vlan 30 ip add 10.30.1.253 24 int vlan 40 ip add 10.40.1.253 24 SW2: int vlan 10 ip add 10.10.1.254 24 int vlan 20 ip add 10.20.1.254 24 int vlan 30 ip add 10.30.1.254 24 int vlan 40 ip add 10.40.1.254 24 分区 网络笔记-6月16日 的第 6 页 SW1上配置VRRP # interface Vlan-interface10 ip address 10.10.1.253 255.255.255.0 vrrp vrid 10 virtual-ip 10.10.1.1 vrrp vrid 10 priority 130 # interface Vlan-interface20 ip address 10.20.1.253 255.255.255.0 vrrp vrid 20 virtual-ip 10.20.1.1 vrrp vrid 20 priority 120 # interface Vlan-interface30 ip address 10.30.1.253 255.255.255.0 vrrp vrid 30 virtual-ip 10.30.1.1 vrrp vrid 30 priority 80 # interface Vlan-interface40 ip address 10.40.1.253 255.255.255.0 vrrp vrid 40 virtual-ip 10.40.1.1 vrrp vrid 40 priority 80 # SW2上配置VRRP [SW2]dis cu int vlan # interface Vlan-interface10 ip address 10.10.1.254 255.255.255.0 vrrp vrid 10 virtual-ip 10.10.1.1 vrrp vrid 10 priority 110 # interface Vlan-interface20 ip address 10.20.1.254 255.255.255.0 vrrp vrid 20 virtual-ip 10.20.1.1 vrrp vrid 20 priority 110 # interface Vlan-interface30 ip address 10.30.1.254 255.255.255.0 vrrp vrid 30 virtual-ip 10.30.1.1 vrrp vrid 30 priority 90 # interface Vlan-interface40 ip address 10.40.1.254 255.255.255.0 vrrp vrid 40 virtual-ip 10.40.1.1 vrrp vrid 40 priority 90 生成树协议 作用:二层防环 根网桥:网桥ID最小(优先级: MAC地址) 根端口( Root):和根桥直连的一定是根端口,根端口一定不在根桥上 指定端口( DESI):根桥上的端口全是指定端口 替代端口( ALTE) H3C交换机上开启生成树功能 stp enable H3C交换机默认的生成树模式是MSTP 查看生成树状态: display stp display stp brief 修改生成树: 修改SW3作为实例0的根桥 stp instance 0 priority 优先级( 0或者4096的倍数) 优先级的默认是: 32768 端口状态:学习、转发、阻塞、侦听、禁用 ftp:文件传输协议 控制连接端口: TCP 21 数据传输端口:主动模式TCP 20 http:超文本传输协议 TCP: 80 https=http+ssl(安全套接字层协议) TCP: 443 telnet: TCP 23 SMTP: TCP 25 DNS: UDP 53 BGP: TCP 179 POP3: TCP 110 IMAP4: TCP 143 集线器:物理层设备,总线型拓扑(流量要进行分摊),不能分割冲突域(半双工模式) 交换机:数据链路层设备,默认情况下,交换机的所有端口都在一个VLAN内,交换机靠 VLAN分割广播域 路由器:网络层设备,分割广播域,数据靠路由表转发 网络笔记 2016年5月25日 15:47 分区 2015年5月26日 的第 1 页 路由表如何形成: 直连:自动形成 非直连:手动写入,动态学习 静态路由: ip route-static 目标网段 子网掩码 下一跳地址 室外光缆可以从标识上区分如下: GYXTW-4B1 GYXTW为光缆型号,意为标准中心束管式光缆 4代表此条光缆为4芯 B1代表此光缆采用的是单模G.652B光纤 GYTS-8B4 GYTS为光缆型号,意为标准松套管层绞式光缆 8代表此条光缆为8芯 B4代表此光缆采用的是单模G.655光纤 GYFTY-16A1b GYFTY为光缆型号,意为标准非金属松套管层绞式光缆 16代表此条光缆为16芯 A1b代表此光缆采用的是多模62.5/125光纤 GYFTZY-24A1a GYFTZY为光缆型号,意为标准非金属松套管层绞式阻燃光缆 24代表此条光缆为24芯 A1a代表此光缆采用的是多模50/125光纤 室内光缆除了用以上方法来区分以外,还可以根据颜色来区分 室内单模光缆为黄色 室内多模光缆为橙色 ACL(访问控制列表) H3C 应用场合: NAT、 Qos、路由过滤 只能够根据源IP地址进行控制 标准访问控制列表: 2000---2999 高级访问控制列表: 3000---3999 创建高级访问控制列表 1、禁止10.3.3.3主机访问10.4.4.4的telnet服务( telnet服务器的端口号是tcp 23) acl number 3000 rule 5 deny tcp source 10.3.3.3 0.0.0.0 desti 10.4.4.4 0.0.0.0 destination-port eq 23 rule 10 permit ip 分区 2015年5月26日 的第 2 页 2、允许10.112.10.10主机访问10.23.21.19的http服务( http服务器的端口号是tcp 80) acl number 3000 rule 5 pemrit tcp source 10.112.10.10 0.0.0.0 desti 10.23.21.19 0.0.0.0 destination-port eq 80 rule 10 deny ip 把ACL应用到接口Gi0/0/0 int gi 0/0/0 firewall packet-filter 3000 inbound 配置OSPF路由协议 RT1上的IP地址配置: interface GigabitEthernet0/0/0 port link-mode route ip address 10.14.1.1 255.255.255.0 # interface GigabitEthernet0/0/1 port link-mode route ip address 10.12.1.1 255.255.255.0 # interface LoopBack0 ip address 10.1.1.1 255.255.255.255 RT3上的IP地址配置: interface GigabitEthernet0/0/0 port link-mode route ip address 10.23.1.3 255.255.255.0 interface loopback 0 ip address 10.3.3.3 255.255.255.255 OSPF配置 RT1: ospf 1 router-id 10.1.1.1 area 0.0.0.0 network 10.12.1.0 0.0.0.255 network 10.14.1.0 0.0.0.255 network 10.1.1.1 0.0.0.0 RT2: ospf 1 router-id 10.2.2.2 area 0.0.0.0 network 10.12.1.0 0.0.0.255 RT2上的IP地址配置: interface GigabitEthernet0/0/0 port link-mode route ip address 10.12.1.2 255.255.255.0 # interface GigabitEthernet0/0/1 port link-mode route ip address 10.23.1.2 255.255.255.0 # interface LoopBack0 ip address 10.2.2.2 255.255.255.255 RT4上的IP地址配置: interface GigabitEthernet0/0/0 port link-mode route ip address 10.14.1.4 255.255.255.0 interface loopback 0 ip address 10.4.4.4 255.255.255.255 分区 2015年5月26日 的第 3 页 network 10.12.1.0 0.0.0.255 network 10.23.1.0 0.0.0.255 network 10.2.2.2 0.0.0.0 RT3: ospf 1 router-id 10.3.3.3 area 0.0.0.0 network 10.3.3.3 0.0.0.0 network 10.23.1.0 0.0.0.255 RT4: ospf 1 router-id 10.4.4.4 area 0.0.0.0 network 10.4.4.4 0.0.0.0 network 10.14.1.0 0.0.0.255 ACL配置(禁止10.4.4.4通过Telnet访问10.3.3.3) 在RT3上开启TELNET远程访问 user-interface vty 0 4 authentication-mode scheme history-command max-size 15 idle-timeout 5 0 protocol inbound telnet local-user h3c password cipher "\\$,%M]N)+GQ=^Q`MAF4<1!! service-type telnet 在RT3上配置ACL acl number 3000 rule 5 deny tcp source 10.4.4.4 0 destination 10.3.3.3 0 destination-port eq telnet rule 10 permit ip interface GigabitEthernet0/0/0 firewall packet-filter 3000 inbound DR与BDR DR指定路由器(其他路由器只和DR建立邻接关系) DR选择 1、选择优先级最高的路由器 2、如果优先级相同,则选择Router-id最高的路由器 3、如果网络中已经选择出了DR和BDR,如果人工参与修改,则必须重启OSPF进程 4、如果路由器的优先级被设置为0,则不参与DR和BDR的选举 分区 2015年5月26日 的第 4 页 4、如果路由器的优先级被设置为0,则不参与DR和BDR的选举 Router-id如何获得? 1、选举Loopback接口IP最大的 2、没有配置Loopback接口地址,选物理接口地址最大
