华为交换机ensp基础命令
具体参考华为官方ensp文档。
一、ip地址
- 路由器ip配置
int gi 0/0/0
ip address 192.168.43.4(IP地址)24(掩码)
- 三层交换机设ip
(先给vlan设ip,然后吧vlan绑定到端口上)
vlan 2
int vlanif 2
ip address ***
int gi 0/0/0
port link-type access
port default vlan 2
二、VLAN配置
- access配置
vlan 10
int ***(进入端口)
port link-type access
port default vlan 10
- trunk配置
vlan batch 2 to 3
int ***
port link-type trunk
port default allow-path vlan 2 to 4094
三、单臂路由
vlan batch 2 to 3
int *** //进入交换机一个连接pc的接口
port link-type access
port default vlan 2
int *** //进入交换机另一个连接pc的接口
port link-type access
port default vlan 3
int *** //进入交换机与路由器相邻的接口
port link-type trunk
port trunk allow-pass vlan 2 to 4094
四、路由一个接口配置多个Ip
(常和单臂路由同时用)
int gi 0/0/0.1
dot1q termination vid 2 //一个虚拟端口绑定设定的一个vlan
ip address ***
arp broadcast enable
int gi 0/0/0.2
dot1q termination vid 3
ip address
arp broadcast enable
五、静态路由和默认路由
ip route-static ****(不能直连的网段地址) ***(子网掩码) ***(该条路径下一跳地址)
ip route-static ****(不能直连的网段地址) ***(子网掩码) ***(该条路径下一跳地址) preference 100(优先级)
六、动态路由
- rip
rip
(version 2)
network ***(直连的网段)
- ospf
ospf 1
area 0
network ***(直连的网段)***(反掩码)
七、Telnet登录并设置密码(要先给端口设置ip地址)
- password模式
user-interface vty 0
authentication-mode password
(set authentication password cipher 123456)
user privilege level 3
- aaa模式
user-interface vty 0
authentication-mode aaa
q
aaa
local-user ***(你设置的用户名)password cipher ****你设置的密码
local-user ***(你设置的用户名) privilege level 3
八、ACL
- 基本ACL
acl 2000
rule 5 deny source ***(网段ip)***(反掩码)
rule 10 permit source ***(网段ip) ***(反掩码)
q
int gi 0/0/1
traffic-filter outbound/inbound acl 2000
- 高级ACL
- 拒绝ping:
acl 3000
rule 5 deny icmp souce ***(网段ip)***(反掩码) destination ***(网段ip)***(反掩码)
rule permit ip
q
int gi 0/0/0
traffic-filter inbound acl 3000
- 拒绝ftp:
rule 10 deny tcp souce ***(网段ip)***(反掩码) destination ***(网段ip)***(反掩码) destination-port eq ftp
- 拒绝www:
rule 15 deny tcp souce ***(网段ip)***(反掩码) destination ***(网段ip)***(反掩码) destination-port ep www
九、GRE
int tunnel 0/0/0 //创建隧道
tunnel-protocol gre
source ***(源ip)
destination***(目的ip)
ip address ***(隧道ip)
#配置基于GRE的路由协议,即连接隧道网段和源、目的网段
rip 1
version
network 192.168.10.0 (源/目网段)
network 172.16.0.0 (隧道网段)
十、展示当前信息
1. display this #查看当前配置过的命令
2. display current-configuration #查看所有配置 (简写 *dis cu* )
3. display ip interface brief #查看接口的ip
4. display interface brief #查看接口配置信息
5. display ip routing-table #查看路由表
6. display mac-address #查看MAC表
7. display arp #查看ARP表
8. display ospf peer brief #查看ospf邻居关系
9. display interface Eth-Trunk #查看链路聚合状态
10. display clock #查看系统当前时间
11. display saved-configuration #显示保存的配置文件
12.display port vlan #查看当前配置的vlan
13. display acl 2000/all #查看当前配置的acl
14.display interface tunnel #查看隧道接口状态
15.display ip routing-table protocol static 仅查看静态路由的路由信息
十一、取消之前的配置
1.undo ip address #取消ip
2.undo port link-type #取消配置的端口类型
3.undo termination monitor #关闭泛洪信息