华为路由器交换机的一些入门级操做
服务器
一、如何配置console线路密码
session
A、用password认证方式设置密码:ssh
<Huawei>system-view //进入配置模式ide
[Huawei] sysname R1 //更改主机名ui
[R1] user-interface console 0 //进入console口加密
[R1-ui-console0]authentication-mode password //认证模式为passwordspa
输入密码,验证orm
B、用aaa认证方式router
[R1] user-interface console 0 server
[R1-ui-console0]authentication-mode aaa
[R1]aaa
[R1-aaa]local-user zhangsan password cipher 123456 //建立用户名和密码
[R1-aaa]local-user zhangsan privilege level 15 //访问级别
二、配置远程telnet远程管理
[R1]user-interface vty 0 4
[R1-ui-vty0-4]authentication-mode aaa
[R1-ui-vty0-4]quit
[R1]aaa
[R1-aaa]local-user zhangsan password cipher 123456
[R1-aaa]local-user zhangsan privilege level 15
[R1-aaa]local-user zhangsan service-type telnet //该用户容许的服务类型
三、ssh远程管理配置
[R1]stelnet server enable //开启ssh功能
[R1]rsa local-key-pair create //建立加密报文的密钥对
[R1]aaa
[R1-aaa]local-user zhangsan password cipher 123456
[R1-aaa]local-user zhangsan privilege level 15
[R1-aaa]local-user zhangsan service-type ssh
[R1]user-interface vty 0 4
[R1-ui-vty0-4]authentication-mode aaa
[R1-ui-vty0-4]protocol inbound ssh //开启vty线路的ssh访问功能
[R1]ssh user zhangsan authentication-type all //定义ssh用户的认证模式
四、配置IP地址和查看
[R1]int g0/0/0
[R1-GigabitEthernet0/0/0]ip address 12.1.1.1 24
[R1-GigabitEthernet0/0/0]quit
查看接口IP配置:
[R1]display ip interface brief
五、配置静态路由:
[R1]ip route-static 23.1.1.0 24 g0/0/0 12.1.1.2
// 目标网段 子网掩码 本地出口 下一跳地址
六、配置等价静态路由:
[R1]ip route-static 23.1.1.0 24 g0/0/1 12.1.1.2
[R1]ip route-static 23.1.1.0 24 g0/0/0 21.1.1.2
七、路由的选举规则是什么?
第一步比较掩码长度,越长越优
第二步比较路由优先级,越小越优
第三步比较路由开销值,越小越优
配置浮动静态路由:
[R1]ip route-static 23.1.1.0 24 g0/0/0 21.1.1.2
[R1]ip route-static 23.1.1.0 24 s1/0/0 12.1.1.2 preference 61
八、配置缺省静态路由:
[R1]ip route-static 0.0.0.0 0 g0/0/0 12.1.1.2
九、ospf的简单配置
[R2]ospf 100 //启动ospf进程
[R2-ospf-100]area 0 //进入0区域
[R2-ospf-100-area-0.0.0.0]network 12.1.1.0 0.0.0.255 //宣告网段
[R2-ospf-100-area-0.0.0.0]network 23.1.1.0 0.0.0.255
[R2-ospf-100-area-0.0.0.0]quit
查看OSPF邻居:
[R1]display ospf peer
查看OSPF路由:
[R1]display ip routing-table protocol ospf
十、修改OSPF的RID:
[R1] ospf 100 router-id 1.1.1.1
(RID修改后不会当即生效,须要重启OSPF
进程新的RID才会生效)
重启OSPF进程:
<R1>reset ospf process
十一、修改OSPF基准带宽:当带宽高于100时需修改
[R1]ospf 100
[R1-ospf-100]bandwidth-reference 10000
十二、修改OSPF计时器:邻居之间必须同时修改
[R1]int g0/0/0 //基于端口的修改
[R1-GigabitEthernet0/0/0]ospf timer hello 20
[R1-GigabitEthernet0/0/0]ospf timer dead 60
1三、修改OSPF的DR接口优先级:只能把优先级调低
[R2]int g0/0/0
[R2-GigabitEthernet0/0/0] ospf dr-priority 0
1四、配置OSPF接口认证:
[R1]int g0/0/0
[R1-GigabitEthernet0/0/0]ospf authentication-mode md5 1 cipher huawei123
配置OSPF区域认证:
[R2]ospf 100
[R2-ospf-100]area 0
[R2-ospf-100-area-0.0.0.0]authentication-mode md5 1 cipher huawei123
1五、配置基本ACL:
[R1]acl 2000
[R1-acl-basic-2000]rule deny source 10.1.1.1 0
[R1-acl-basic-2000]quit
调用基本ACL:
[R1]int g0/0/1
[R1-GigabitEthernet0/0/1]traffic-filter outbound acl 2000
1六、配置扩展ACL:
[R1]acl 3000
[R1-acl-adv-3000]rule deny ip source 10.1.1.1 0 destination 20.1.1.1 0
[R1-acl-adv-3000]quit
调用扩展ACL:
[R1]int g0/0/0
[R1-GigabitEthernet0/0/0]traffic-filter inbound acl 3000
[R1-GigabitEthernet0/0/0]quit
1七、配置静态NAT
[R1]int g0/0/1
[R1-GigabitEthernet0/0/1]nat static global 12.1.1.1 inside 10.1.1.1
1八、配置动态NAT:
[R1]nat address-group 0 12.1.1.1 12.1.1.3 //动态地址池
[R1]acl 2000
[R1-acl-basic-2000]rule permit source 10.1.1.1 0.0.0.0
[R1-acl-basic-2000]rule permit source 10.1.1.2 0.0.0.0
[R1-acl-basic-2000]rule permit source 10.1.1.3 0.0.0.0
[R1-acl-basic-2000]quit
[R1]int g0/0/1
[R1-GigabitEthernet0/0/1]nat outbound 2000 address-group 0 no-pat
1九、配置NAPT:
[R1]nat address-group 0 12.1.1.1 12.1.1.1
[R1]acl 2000
[R1-acl-basic-2000]rule permit source 10.1.1.1 0.0.0.0
[R1-acl-basic-2000]rule permit source 10.1.1.2 0.0.0.0
[R1-acl-basic-2000]rule permit source 10.1.1.3 0.0.0.0
[R1-acl-basic-2000]quit
[R1]int g0/0/1
[R1-GigabitEthernet0/0/1]nat outbound 2000 address-group 0
[R1-GigabitEthernet0/0/1]quit
[R1]display nat session all //查看转换信息
20、easy-ip配置
[R1]acl 2000
[R1-acl-basic-2000]rule permit source 10.1.1.0 0.0.0.255
[R1]int g0/0/1
[R1-GigabitEthernet0/0/1]nat outbound 2000
2一、配置DHCP server:
[R1]dhcp enable //启用dhcp服务
[R1]ip pool dhcp1 //定义地址池
[R1-ip-pool-dhcp1] network 10.1.1.0 mask 255.255.255.0
[R1-ip-pool-dhcp1] gateway-list 10.1.1.1
[R1-ip-pool-dhcp1] dns-list 10.1.1.1
[R1-ip-pool-dhcp1]lease day 2
[R1]int g0/0/0 //在接口调用
[R1-GigabitEthernet0/0/0]dhcp select global
2二、DHCP中继
服务器端:
[R2]dhcp enable // 启用
[R2]ip pool dhcp1 //地址池1
[R2-ip-pool-dhcp1]network 10.1.1.0 mask 255.255.255.0
[R2-ip-pool-dhcp1]gateway-list 10.1.1.1
[R2-ip-pool-dhcp1]dns-list 10.1.1.1
[R2-ip-pool-dhcp1]lease day 2
[R2-ip-pool-dhcp1]quit
[R2]ip pool dhcp2 //地址池2
[R2-ip-pool-dhcp2]network 20.1.1.0 mask 255.255.255.0
[R2-ip-pool-dhcp2]gateway-list 20.1.1.1
[R2-ip-pool-dhcp2]dns-list 20.1.1.1
[R2-ip-pool-dhcp2]lease day 2
[R2-ip-pool-dhcp2]quit
[R2]int g0/0/2
[R2-GigabitEthernet0/0/2]dhcp select global //端口启用dhcp
[R2-GigabitEthernet0/0/2]quit
[R2]ip route-static 10.1.1.0 24 g0/0/2 12.1.1.1 //配置静态路由
[R2]ip route-static 20.1.1.0 24 g0/0/2 12.1.1.1
配置DHCP relay:
[R1]dhcp enable
[R1]int g0/0/0
[R1-GigabitEthernet0/0/0]dhcp select relay //启用中继
[R1-GigabitEthernet0/0/0]dhcp relay server-ip 12.1.1.2 //指定服务的地址
[R1-GigabitEthernet0/0/0]quit
[R1]int g0/0/1
[R1-GigabitEthernet0/0/1]dhcp select relay
[R1-GigabitEthernet0/0/1]dhcp relay server-ip 12.1.1.2
2三、配置手工eth-trunk:
[SW1] int Eth-Trunk 12 //建立
[SW1-Eth-Trunk12]trunkport Ethernet 0/0/1 to 0/0/3 //加入端口
[SW1]display interface brief //查看端口状态
[SW1]display stp brief //查看生成树的状态
2四、配置LACP方式eth-trunk:另一端的交换机只需指定模式,加入端口
[SW1]int Eth-Trunk 12
[SW1-Eth-Trunk12]mode lacp-static //指定模式
[SW1-Eth-Trunk12]trunkport Ethernet 0/0/1 to 0/0/3 //加入端口
[SW1]lacp priority 100 //设置LACP的主设备,调整优先级
[SW1]int Ethernet 0/0/1
[SW1-Ethernet0/0/1]lacp priority 100 //设置LACP接口的优先级
[SW1]int Ethernet 0/0/2
[SW1-Ethernet0/0/2]lacp priority 100
[SW1]int Eth-Trunk 12
[SW1-Eth-Trunk12]max active-linknumber 2 //设置最大活动链路数量
[SW1-Eth-Trunk12]lacp preempt enable //开启LACP抢占功能
[SW1]display eth-trunk 12 //查看链路状态
2五、vlan基本的建立
[SW1]vlan batch 10 20 //建立vlan
[SW1]display vlan summary //查看设备的vlan信息
[SW1]int Ethernet0/0/1
[SW1-Ethernet0/0/1]port link-type access //指定端口类型
[SW1-Ethernet0/0/1]port default vlan 10 //默认的vlan编号
[SW1]display port vlan active //查看接口对应的vlan信息
2六、配置trunk接口:两边交换机要同时配置
[SW1]int Ethernet0/0/3
[SW1-Ethernet0/0/3]port link-type trunk
[SW1-Ethernet0/0/3]port trunk allow-pass vlan all
[SW1-Ethernet0/0/3]quit
查看trunk接口:
[SW1]display port vlan active
2七、配置hybrid接口类型
建立vlan十、vlan20、vlan30、vlan40、vlan50、vlan60
配置hybrid接口,vlan10\30\50带标记,vlan20\40\60不带标记:
[SW1]int Ethernet0/0/3
[SW1-Ethernet0/0/3]port link-type hybrid
[SW1-Ethernet0/0/3]port hybrid tagged vlan 10 30 50
[SW1-Ethernet0/0/3]port hybrid untagged vlan 20 40 60
2八、配置单臂路由:实现不一样网段之间的通讯,交换机连路由器的接口设置为trunk
[R1]int GigabitEthernet 0/0/0.10
[R1-GigabitEthernet0/0/0.10]dot1q termination vid 10 //和vlan关联
[R1-GigabitEthernet0/0/0.10]ip address 10.1.1.100 24
[R1-GigabitEthernet0/0/0.10]arp broadcast enable //开启arp广播
[R1]int GigabitEthernet 0/0/0.20
[R1-GigabitEthernet0/0/0.20]dot1q termination vid 20
[R1-GigabitEthernet0/0/0.20]ip address 20.1.1.100 24
[R1-GigabitEthernet0/0/0.20]arp broadcast enable
2九、配置三层交换:先建立vlan,而后把端口加入。
[SW1]interface Vlanif 10
[SW1-Vlanif10]ip address 10.1.1.100 24
[SW1]interface Vlanif 20
[SW1-Vlanif20]ip address 20.1.1.100 24
30、修改stp的角色
将SW2设置为新的根交换机:
[SW2]stp priority 4096
将SW3的e0/0/3接口修改成新的根端口:
[SW3]int e0/0/4
[SW3-Ethernet0/0/4]stp cost 10 //改大原来根端口的开销值
[SW3-Ethernet0/0/4]quit