| 模式 | 华为 | 华三 | 锐捷 | 深信服 |
|---|---|---|---|---|
| 用户模式 | <Device> |
<Device> |
Switch> |
Web界面 |
| 特权/系统模式 | [Device] system-view |
[Device] system-view |
Switch> enable → Switch# configure terminal |
Web界面 |
| 接口配置模式 | [Device-If] interface |
[Device-If] interface |
Switch(config-if)# |
Web界面 |
| VLAN配置模式 | [Device-vlan10] vlan |
[Device-vlan10] vlan |
Switch(config-vlan)# |
- |
| 返回上级 | quit / q |
quit / q |
exit |
- |
| 直接返回用户视图 | return / Ctrl+Z |
return / Ctrl+Z |
end / Ctrl+Z |
- |
| 保存配置 | save |
save |
write / copy run start |
Web界面备份 |
| 查看当前配置 | display current-configuration |
display current-configuration |
show running-config |
Web界面查看 |
华为防火墙 USG6000/USG9500 基础开局配置
1. 初始登录和基本设置
使用Console线连接防火墙Console口与终端。默认用户名 admin,默认密码 Admin@123(首次登录需修改密码)。Web管理界面:https://192.168.0.1:8443
system-view // 进入系统视图 sysname FW01 // 修改设备名称 undo info-center enable // 关闭信息中心(可选) // 配置管理接口(GE0/0/0默认为管理口) interface GigabitEthernet 0/0/0 undo shutdown ip address 192.168.0.1 255.255.255.0 service-manage https permit service-manage http permit service-manage ping permit
2. 接口配置
// 内网接口(Trust区域) interface GigabitEthernet 1/0/0 undo shutdown ip address 10.1.1.1 255.255.255.0 service-manage ping permit // 外网接口(Untrust区域) interface GigabitEthernet 1/0/1 undo shutdown ip address 100.1.1.2 255.255.255.0 service-manage ping permit // DMZ接口 interface GigabitEthernet 1/0/2 undo shutdown ip address 192.168.1.10 255.255.255.0
3. 安全区域配置
| 安全区域 | 默认优先级 | 说明 |
|---|---|---|
| Local | 100 | 防火墙自身 |
| Trust | 85 | 信任区域(内网) |
| DMZ | 50 | 非军事区(服务器区) |
| Untrust | 5 | 非信任区域(外网) |
firewall zone trust add interface GigabitEthernet 1/0/0 firewall zone untrust add interface GigabitEthernet 1/0/1 firewall zone dmz add interface GigabitEthernet 1/0/2 firewall zone management add interface GigabitEthernet 0/0/0
4. 安全策略配置
security-policy // 允许Trust区域访问Untrust区域(内网访问公网) rule name Allow_Trust_to_Untrust source-zone trust destination-zone untrust source-address 172.10.10.0 255.255.255.0 action permit // 允许公网访问DMZ Web服务器 rule name Allow_Untrust_to_DMZ_Web source-zone untrust destination-zone dmz destination-address 192.168.1.100 255.255.255.255 service http service https action permit // 允许Trust区域内网互访(ICMP ping) rule name Allow_Trust_ICMP source-zone trust destination-zone trust service icmp action permit
5. NAT配置
源NAT(Easy-IP,内网上网)
// 推荐方式:nat-policy nat-policy rule name SNAT_Trust_to_Untrust source-zone trust destination-zone untrust source-address 172.10.10.0 255.255.255.0 action source-nat easy-ip
目的NAT(服务器映射)
nat server protocol tcp global 100.1.1.2 80 inside 172.10.10.20 80 nat server protocol tcp global 100.1.1.2 443 inside 172.10.10.20 443
6. 路由配置
ip route-static 0.0.0.0 0.0.0.0 100.1.1.1 // 默认路由 ip route-static 172.10.10.0 255.255.255.0 10.1.1.2 // 内网回程路由
常用查看命令
| 命令 | 说明 |
|---|---|
display current-configuration | 查看当前配置 |
display firewall zone | 查看安全区域 |
display security-policy all | 查看安全策略 |
display nat-policy all | 查看NAT策略 |
display nat session all | 查看NAT会话表 |
display ip routing-table | 查看路由表 |
display interface brief | 查看接口摘要 |
display firewall session table | 查看防火墙会话表 |
华为交换机 S/CE系列 基础开局配置
1. 初始登录和基本设置
system-view // 进入系统视图(简写: sys) sysname SW01 // 修改设备名称 // 配置Console口认证 user-interface con 0 authentication-mode password set authentication password cipher YourPassword
2. VLAN配置
vlan batch 10 20 30 40 // 批量创建VLAN undo vlan 100 // 删除VLAN display vlan // 查看VLAN // VLANIF接口配置管理IP interface Vlanif 10 ip address 10.1.10.1 255.255.255.0 description Management-VLAN
3. 接口配置(Access/Trunk)
Access接口(连接终端)
interface GigabitEthernet 0/0/1 port link-type access port default vlan 10 undo shutdown description PC-Port
Trunk接口(交换机间互联)
interface GigabitEthernet 0/0/24 port link-type trunk port trunk allow-pass vlan 10 20 30 undo shutdown description Uplink-to-Core
Hybrid接口(华为特有)
interface GigabitEthernet 0/0/10 port link-type hybrid port hybrid tagged vlan 10 20 // 指定VLAN带Tag通过 port hybrid untagged vlan 30 // 指定VLAN去Tag通过 port hybrid pvid vlan 30
4. IP地址配置(VLANIF网关)
interface Vlanif 10 ip address 192.168.10.1 255.255.255.0 interface Vlanif 20 ip address 192.168.20.1 255.255.255.0 ip route-static 0.0.0.0 0.0.0.0 10.1.0.2
5. STP配置
stp mode rstp // 设置为RSTP模式(默认) stp priority 0 // 成为根桥(值越小优先级越高) // 或 stp root primary // 设置边缘端口(连接终端,不参与STP计算) interface GigabitEthernet 0/0/1 stp edged-port enable display stp brief // 查看STP状态
6. Telnet远程登录
telnet server enable user-interface vty 0 4 authentication-mode aaa protocol inbound all aaa local-user admin password irreversible-cipher Admin@123 local-user admin privilege level 15 local-user admin service-type telnet terminal
常用命令速查
| 命令 | 说明 |
|---|---|
system-view / sys | 进入系统视图 |
display current-configuration | 查看当前配置 |
display vlan | 查看VLAN信息 |
display interface brief | 查看接口摘要 |
display ip routing-table | 查看路由表 |
display stp brief | 查看STP状态 |
display mac-address | 查看MAC地址表 |
display arp | 查看ARP表 |
save | 保存配置 |
reset saved-configuration | 擦除旧配置文件 |
华三防火墙 F1000/F5000/SecPath 基础开局配置
1. 初始登录和基本设置
通过Console线连接,默认用户名/密码通常为 admin/admin(具体以设备标签为准)。
<H3C> system-view [H3C] sysname FW-Core [FW-Core] // 配置管理地址 [FW-Core] interface GigabitEthernet 1/0/1 [FW-Core-GigabitEthernet1/0/1] ip address 192.168.1.1 24 [FW-Core-GigabitEthernet1/0/1] undo shutdown // 配置Telnet/SSH远程登录 [FW-Core] user-interface vty 0 4 [FW-Core-ui-vty0-4] authentication-mode password [FW-Core-ui-vty0-4] set authentication password cipher Admin@123 [FW-Core-ui-vty0-4] user privilege level 3 [FW-Core-ui-vty0-4] protocol inbound telnet ssh
2. 接口配置
// 内网接口 [FW-Core] interface GigabitEthernet 1/0/2 [FW-Core-GigabitEthernet1/0/2] ip address 192.168.20.1 24 [FW-Core-GigabitEthernet1/0/2] undo shutdown // 外网接口 [FW-Core] interface GigabitEthernet 1/0/3 [FW-Core-GigabitEthernet1/0/3] ip address 200.20.20.1 24 [FW-Core-GigabitEthernet1/0/3] undo shutdown
3. 安全区域配置
// Trust区域(内网) [FW-Core] security-zone name Trust [FW-Core-security-zone-Trust] import interface GigabitEthernet 1/0/2 // Untrust区域(外网) [FW-Core] security-zone name Untrust [FW-Core-security-zone-Untrust] import interface GigabitEthernet 1/0/3 // DMZ区域(服务器区) [FW-Core] security-zone name DMZ [FW-Core-security-zone-DMZ] import interface GigabitEthernet 1/0/4
4. 安全策略配置(ACL + zone-pair方式)
// 创建高级ACL [FW-Core] acl advanced 3000 [FW-Core-acl-adv-3000] rule 10 permit ip source 192.168.20.0 0.0.0.255 // 配置Trust到Untrust的域间策略 [FW-Core] zone-pair security source Trust destination Untrust [FW-Core-zone-pair-security-Trust-Untrust] packet-filter 3000 // 配置Trust到Local的策略(允许内网管理防火墙) [FW-Core] zone-pair security source Trust destination Local [FW-Core-zone-pair-security-Trust-Local] packet-filter 3000 // 设置默认包过滤策略为拒绝 [FW-Core] firewall packet-filter default deny
source any,应细化源和目的IP地址。
5. NAT配置
NAT Outbound(源地址转换)
// 创建ACL匹配内网网段 [FW-Core] acl basic 2000 [FW-Core-acl-basic-2000] rule permit source 192.168.20.0 0.0.0.255 // 使用出接口IP做PAT(最常用) [FW-Core] interface GigabitEthernet 1/0/3 [FW-Core-GigabitEthernet1/0/3] nat outbound 2000
NAT Server(端口映射)
[FW-Core-GigabitEthernet1/0/3] nat server protocol tcp global 202.100.1.100 80 inside 192.168.1.100 80
6. 路由配置
ip route-static 0.0.0.0 0.0.0.0 200.20.20.2 // 默认路由 ip route-static 192.168.30.0 24 192.168.20.2 // 回程路由
常用查看命令
| 命令 | 说明 |
|---|---|
display current-configuration | 查看当前配置 |
display interface brief | 查看接口状态 |
display session table | 查看会话表 |
display security-zone | 查看安全区域 |
display firewall statistic system | 查看防火墙统计 |
display ip routing-table | 查看路由表 |
display cpu-usage | 查看CPU利用率 |
华三交换机 S5500/S6800/S12500 基础开局配置
1. 初始登录和基本设置
<H3C> system-view [H3C] sysname SW-Core // 配置管理VLAN接口IP [SW-Core] vlan 20 [SW-Core] interface vlan-interface 20 [SW-Core-Vlan-interface20] ip address 192.168.1.2 24 // 配置Console口密码 [SW-Core] user-interface aux 0 [SW-Core-ui-aux0] authentication-mode password [SW-Core-ui-aux0] set authentication password cipher 123456 // 配置Telnet远程登录 [SW-Core] user-interface vty 0 4 [SW-Core-ui-vty0-4] authentication-mode password [SW-Core-ui-vty0-4] set authentication password cipher Admin@123 [SW-Core-ui-vty0-4] user privilege level 3 [SW-Core-ui-vty0-4] protocol inbound telnet
2. VLAN配置
// 创建VLAN并命名 [SW-Core] vlan 10 [SW-Core-vlan10] name Finance // 批量创建VLAN [SW-Core] vlan 20 to 30 // 查看VLAN [SW-Core] display vlan
3. 接口配置(Access/Trunk/Hybrid)
Access端口(连接终端)
// 批量端口配置 [SW-Core] interface range GigabitEthernet 1/0/1 to 1/0/10 [SW-Core-if-range] port link-type access [SW-Core-if-range] port access vlan 10
Trunk端口(交换机间互联)
[SW-Core] interface GigabitEthernet 1/0/24 [SW-Core-GigabitEthernet1/0/24] port link-type trunk [SW-Core-GigabitEthernet1/0/24] port trunk permit vlan 10 20 30 [SW-Core-GigabitEthernet1/0/24] port trunk pvid vlan 1
Hybrid端口(H3C默认模式)
[SW-Core] interface GigabitEthernet 1/0/5 [SW-Core-GigabitEthernet1/0/5] port link-type hybrid [SW-Core-GigabitEthernet1/0/5] port hybrid vlan 10 untagged // 发送时不带Tag [SW-Core-GigabitEthernet1/0/5] port hybrid vlan 20 tagged // 发送时带Tag
4. IP地址配置
[SW-Core] interface vlan-interface 10 [SW-Core-Vlan-interface10] ip address 192.168.10.1 255.255.255.0 [SW-Core] interface vlan-interface 20 [SW-Core-Vlan-interface20] ip address 192.168.20.1 24 [SW-Core] ip route-static 0.0.0.0 0.0.0.0 192.168.1.1
5. STP配置
[SW-Core] stp global enable [SW-Core] stp mode rstp [SW-Core] stp root primary // 指定为根桥 // [SW-Core] stp root secondary // 指定为备份根桥 [SW-Core] display stp brief
常用命令速查
| 命令 | 说明 |
|---|---|
display current-configuration | 查看当前运行配置 |
display saved-configuration | 查看已保存配置 |
display interface brief | 查看所有接口简要状态 |
display vlan | 查看VLAN信息 |
display mac-address | 查看MAC地址表 |
display arp | 查看ARP表 |
display ip routing-table | 查看IP路由表 |
display stp brief | 查看STP简要信息 |
save | 保存配置 |
reset saved-configuration | 清除保存的配置 |
锐捷防火墙 RG-WALL系列 基础开局配置
1. 初始登录和基本设置
默认管理IP:192.168.10.100,默认账号:admin,默认密码:firewall。Web访问:https://192.168.10.100:6667/
// 修改管理端口 RG-WALL # config system global RG-WALL (global) # set admin-port 1443 RG-WALL (global) # end
2. 接口配置
// 配置WAN口 RG-WALL # config system interface RG-WALL (interface) # edit wan1 RG-WALL (wan1) # set ip 172.26.2.15/27 RG-WALL (wan1) # set mode static // static | dhcp | pppoe RG-WALL (wan1) # set static up RG-WALL (wan1) # end // 配置LAN口(内网接口) RG-WALL # config system interface RG-WALL (interface) # edit internal RG-WALL (internal) # set ip 192.168.1.1/24 RG-WALL (internal) # end
3. 安全策略配置
RG-WALL # config firewall policy RG-WALL (policy) # edit 0 // 0表示新增策略 RG-WALL (0) # set srcintf internal // 源接口 RG-WALL (0) # set dstintf wan1 // 目的接口 RG-WALL (0) # set srcaddr all // 源地址 RG-WALL (0) # set dstaddr all // 目的地址 RG-WALL (0) # set action accept // accept | deny RG-WALL (0) # set schedule always RG-WALL (0) # set service ALL RG-WALL (0) # set nat enable // 开启NAT RG-WALL (0) # end
4. NAT配置
set nat enable 直接启用,无需单独配置NAT规则。
5. 路由配置
// 默认路由 RG-WALL # config router static RG-WALL (static) # edit 0 RG-WALL (0) # set device wan1 RG-WALL (0) # set dst 0.0.0.0 0.0.0.0 RG-WALL (0) # set gateway 172.26.2.1 RG-WALL (0) # set comment "default route" RG-WALL (0) # end // 静态路由(特定网段) RG-WALL # config router static RG-WALL (static) # edit 1 RG-WALL (1) # set device wan1 RG-WALL (1) # set dst 172.26.0.0 255.255.0.0 RG-WALL (1) # set gateway 172.26.2.1 RG-WALL (1) # end
常用查看和诊断命令
| 命令 | 说明 |
|---|---|
get system arp | 查看ARP表 |
get system interface physical | 查看物理接口状态 |
show router static | 查看静态路由配置 |
get router info routing-table all | 查看全局路由表 |
show firewall policy | 查看策略配置 |
execute ping 8.8.8.8 | Ping测试 |
execute traceroute 8.8.8.8 | 路由追踪 |
execute factoryreset | 恢复出厂设置 |
锐捷交换机 S系列 基础开局配置
1. 初始登录和基本设置
锐捷交换机命令行模式与Cisco类似:用户模式 Switch> → 特权模式 Switch# → 全局配置模式 Switch(config)#
Switch> enable Switch# configure terminal Switch(config)# hostname SW-Core Switch(config)# enable secret 8888 // 开启管理服务 Switch(config)# enable services telnet-server Switch(config)# enable services web-server Switch(config)# enable services snmp-agent
2. VLAN配置
Switch(config)# vlan 10 Switch(config-vlan)# name office Switch(config-vlan)# exit Switch(config)# vlan 20 Switch(config-vlan)# name server Switch(config-vlan)# exit // 查看VLAN Switch# show vlan
3. 接口配置(Access/Trunk)
Access口(接入端口)
// 批量配置Access口 Switch(config)# interface range gigabitethernet 0/1-10 Switch(config-if-range)# switchport mode access Switch(config-if-range)# switchport access vlan 10 Switch(config-if-range)# no shutdown
Trunk口(中继端口)
Switch(config)# interface gigabitethernet 0/24 Switch(config-if)# switchport mode trunk Switch(config-if)# switchport trunk allowed vlan all Switch(config-if)# switchport trunk native vlan 1 Switch(config-if)# no shutdown
4. IP地址配置
SVI(VLAN虚拟接口)方式
Switch(config)# interface vlan 10 Switch(config-if)# ip address 192.168.10.1 255.255.255.0 Switch(config-if)# no shutdown // 默认路由 Switch(config)# ip route 0.0.0.0 0.0.0.0 192.168.10.254
三层路由口方式(Routed Port)
Switch(config)# interface gigabitethernet 0/1 Switch(config-if)# no switchport // 转为三层模式 Switch(config-if)# ip address 10.1.252.26 255.255.255.252 Switch(config-if)# no shutdown
5. STP配置
Switch(config)# spanning-tree // 开启生成树 Switch(config)# spanning-tree mode rstp // stp | rstp | mstp Switch(config)# spanning-tree priority 4096 // 优先级值越小越优先 Switch# show spanning-tree
常用命令速查
| 命令 | 说明 |
|---|---|
show running-config | 查看当前配置 |
show interface | 查看所有接口状态 |
show interface switchport | 查看交换端口状态 |
show mac-address-table | 查看MAC地址表 |
show vlan | 查看VLAN信息 |
show spanning-tree | 查看STP状态 |
write | 保存配置 |
reload | 重启设备 |
深信服防火墙 AF系列 基础开局配置
https://10.251.251.251,默认账号/密码:admin/admin。
1. 初始登录和初始化向导
| 步骤 | 操作说明 |
|---|---|
| 硬件连接 | 使用网线将电脑连接至AF设备的 manage口,电脑IP设为 10.251.251.200/24 |
| Web登录 | 浏览器输入 https://10.251.251.251,忽略证书安全提示 |
| 修改密码 | 首次登录后修改管理员密码(建议包含大小写字母、数字、特殊符号) |
| 系统设置 | 配置系统时区和NTP服务器(如 ntp.aliyun.com) |
| 管理地址 | 可选修改管理地址(修改后需使用新地址重新登录) |
2. 接口配置
配置路径:【网络】→【接口】
| 接口 | 用途 | 配置示例 |
|---|---|---|
| eth0 (manage口) | 带外管理 | 10.251.251.251/24(出厂默认,不可删除) |
| eth1 | 内网接口(LAN) | 192.168.1.1/24,作为内网网关 |
| eth2 | 外网接口(WAN) | 运营商分配静态IP,如 203.0.113.10/24,网关 203.0.113.1 |
| eth3 | DMZ接口 | 172.16.1.1/24,部署对外服务器 |
3. 区域配置
配置路径:【网络】→【区域】→【新增】
| 区域名称 | 说明 | 关联接口 |
|---|---|---|
| trust | 内网区域 | eth1 |
| untrust | 外网区域 | eth2 |
| dmz | DMZ区域 | eth3 |
4. 安全策略配置
配置路径:【策略】→【安全策略】→【新增】。深信服防火墙默认拒绝所有跨区域流量,必须手动配置允许策略。
| 策略 | 源区域 | 目的区域 | 源地址 | 目的地址 | 服务 | 动作 |
|---|---|---|---|---|---|---|
| 内网访问外网 | trust | untrust | 192.168.1.0/24 | ANY | ANY | 允许 |
| 外网访问DMZ | untrust | dmz | ANY | 172.16.1.10 | HTTP/HTTPS | 允许 |
| 默认拒绝 | ANY | ANY | ANY | ANY | ANY | 拒绝 |
5. NAT配置
配置路径:【网络】→【NAT】→【新增NAT规则】
| NAT类型 | 说明 | 配置参数 |
|---|---|---|
| SNAT(源地址转换) | 让内网用户上网 | 源地址 192.168.1.0/24,转换为出接口IP(eth2),出接口 eth2 |
| DNAT(目的地址转换) | 端口映射 | 目的地址 eth2外网IP,映射到 172.16.1.10,端口 TCP 80 → 80 |
6. 路由配置
配置路径:【网络】→【路由】→【新增路由】
| 路由类型 | 目标地址 | 下一跳 | 出接口 |
|---|---|---|---|
| 默认路由 | 0.0.0.0/0 | 运营商网关(如 203.0.113.1) | eth2 |
| 回程路由 | 192.168.1.0/24 | 内网核心交换机IP | eth1 |
注意事项
链路聚合 / OSPF / ACL / 端口镜像
1. 链路聚合(LACP / ETH-Trunk)
核心交换机与防火墙之间常用链路聚合做冗余和带宽叠加。
华为 - ETH-Trunk
// 创建Eth-Trunk接口 interface Eth-Trunk 1 port link-type trunk port trunk allow-pass vlan 10 20 99 mode lacp-static // LACP模式(静态协商) undo shutdown // 将物理端口加入Eth-Trunk interface GigabitEthernet 0/0/23 eth-trunk 1 undo shutdown interface GigabitEthernet 0/0/24 eth-trunk 1 undo shutdown // 可选:配置LACP系统优先级(越小越优先成为主动端) lacp priority 100 interface Eth-Trunk 1 lacp system-priority 100 max active-linknumber 2 // 最大活跃链路数
华三 - Link-Aggregation
// 创建聚合接口 [SW-Core] interface bridge-aggregation 1 [SW-Core-Bridge-Aggregation1] port link-type trunk [SW-Core-Bridge-Aggregation1] port trunk permit vlan 10 20 99 [SW-Core-Bridge-Aggregation1] link-aggregation mode dynamic // 动态LACP // 将物理端口加入聚合组 [SW-Core] interface GigabitEthernet 1/0/23 [SW-Core-GigabitEthernet1/0/23] port link-aggregation group 1 [SW-Core] interface GigabitEthernet 1/0/24 [SW-Core-GigabitEthernet1/0/24] port link-aggregation group 1
锐捷 - Port-Channel
Switch(config)# interface port-channel 1 Switch(config-if-po1)# switchport mode trunk Switch(config-if-po1)# switchport trunk allowed vlan all Switch(config)# interface range gigabitethernet 0/23-24 Switch(config-if-range)# channel-group 1 mode active
2. OSPF动态路由
中大型网络内网使用OSPF动态路由协议,替代大量静态路由。
华为 / 华三 - OSPF基础配置
// 启用OSPF进程 ospf 1 router-id 10.0.0.2 // 手动指定Router-ID // 创建区域0(骨干区域) area 0.0.0.0 // 宣告直连网段(华为用反掩码,华三用正掩码) // 华为 network 192.168.10.0 0.0.0.255 // VLAN10网段 network 192.168.20.0 0.0.0.255 // VLAN20网段 network 10.0.0.0 0.0.0.255 // 管理网段 // 华三 [SW-Core-ospf-1] area 0.0.0.0 [SW-Core-ospf-1-area-0.0.0.0] network 192.168.10.0 0.0.0.255 [SW-Core-ospf-1-area-0.0.0.0] network 192.168.20.0 0.0.0.255 [SW-Core-ospf-1-area-0.0.0.0] network 10.0.0.0 0.0.0.255 // 静默接口(不发送OSPF报文的接口,如连接终端的VLANIF) silent-interface Vlanif 10 silent-interface Vlanif 20 // 查看OSPF邻居和路由 display ospf peer display ospf routing
锐捷 - OSPF
Switch(config)# router ospf 1 Switch(config-router)# router-id 10.0.0.2 Switch(config-router)# network 192.168.10.0 0.0.0.255 area 0 Switch(config-router)# network 192.168.20.0 0.0.0.255 area 0 Switch(config-router)# passive-interface vlan 10 Switch(config-router)# passive-interface vlan 20
3. ACL访问控制列表
交换机VLAN间访问控制,限制不同网段之间的访问权限。
华为 - 基于ACL的包过滤
// 场景:禁止VLAN10(办公)访问VLAN20(服务器)的特定服务器 acl number 3001 rule 10 deny ip source 192.168.10.0 0.0.0.255 destination 192.168.20.100 0 rule 20 permit ip // 允许其他流量 // 在VLANIF接口上应用ACL interface Vlanif 10 traffic-filter inbound acl 3001 // 入方向过滤 traffic-filter outbound acl 3001 // 出方向过滤 // 场景:仅允许VLAN10访问VLAN20的Web服务(80/443) acl number 3002 rule 10 permit tcp source 192.168.10.0 0.0.0.255 destination 192.168.20.0 0.0.0.255 destination-port eq 80 rule 20 permit tcp source 192.168.10.0 0.0.0.255 destination 192.168.20.0 0.0.0.255 destination-port eq 443 rule 30 deny ip source 192.168.10.0 0.0.0.255 destination 192.168.20.0 0.0.0.255
华三 - ACL包过滤
[SW-Core] acl advanced 3001 [SW-Core-acl-adv-3001] rule 10 deny ip source 192.168.10.0 0.0.0.255 destination 192.168.20.100 0 [SW-Core-acl-adv-3001] rule 20 permit ip [SW-Core] interface vlan-interface 10 [SW-Core-Vlan-interface10] packet-filter 3001 inbound
锐捷 - ACL
Switch(config)# ip access-list extended NO-ACCESS-SERVER Switch(config-ext-nacl)# deny ip 192.168.10.0 0.0.0.255 host 192.168.20.100 Switch(config-ext-nacl)# permit ip any any Switch(config)# interface vlan 10 Switch(config-if)# ip access-group NO-ACCESS-SERVER in
4. 端口镜像(抓包排障)
将指定端口的流量复制到镜像端口,用于接入抓包工具(如Wireshark)。
华为
// 方式一:本地镜像 observe-port 1 interface GigabitEthernet 0/0/22 // 镜像目的口(接抓包PC) interface GigabitEthernet 0/0/1 // 被镜像口(需抓包的端口) port-mirroring to observe-port 1 both // both=双向, inbound=入, outbound=出 // 方式二:流镜像(按VLAN/ACL匹配后镜像) acl number 3000 rule 10 permit ip source 192.168.10.50 0 // 只镜像特定IP的流量 mirror to observe-port 1 mirror acl 3000
华三
[SW-Core] mirroring-group 1 local [SW-Core] mirroring-group 1 mirroring-port GigabitEthernet 1/0/1 both [SW-Core] mirroring-group 1 monitor-port GigabitEthernet 1/0/22
锐捷
Switch(config)# monitor session 1 source interface gigabitethernet 0/1 both Switch(config)# monitor session 1 destination interface gigabitethernet 0/22 Switch(config)# no monitor session 1 // 取消镜像
高级配置补充:SSH / DHCP / AAA / 日志
1. SSH安全远程登录
华为 / 华三
// 生成RSA密钥对 rsa local-key-pair create // 开启SSH服务 ssh server enable // 配置VTY虚拟终端支持SSH user-interface vty 0 4 authentication-mode aaa protocol inbound ssh user privilege level 15 // 创建SSH用户(方式一:密码认证) aaa local-user netadmin password cipher YourStrongPass@2026 service-type ssh telnet terminal authorization-attribute level 15 // 创建SSH用户(方式二:密钥认证,更安全) ssh user netadmin service-type stelnet ssh user netadmin authentication-type rsa ssh user netadmin assign rsa-key netadmin-key
锐捷
Switch(config)# crypto key generate rsa Switch(config)# ip ssh version 2 Switch(config)# username admin privilege 15 secret YourStrongPass Switch(config)# line vty 0 4 Switch(config-line)# login local Switch(config-line)# transport input ssh telnet
2. DHCP服务配置
华为 - DHCP Server(交换机作为DHCP服务器)
dhcp enable // 创建VLAN 10的DHCP地址池 ip pool vlan10 network 192.168.10.0 mask 255.255.255.0 gateway-list 192.168.10.1 dns-list 223.5.5.5 114.114.114.114 excluded-ip-address 192.168.10.1 192.168.10.10 // 排除保留地址 lease day 3 // 租期3天 // 在VLANIF接口上启用DHCP interface Vlanif 10 dhcp select global
华为 / 华三 - DHCP中继(DHCP服务器在其他设备上)
// 华为 dhcp enable interface Vlanif 10 dhcp select relay dhcp relay server-ip 10.1.0.100 // 华三 [SW-Core] dhcp relay enable [SW-Core] interface vlan-interface 10 [SW-Core-Vlan-interface10] dhcp relay address 10.1.0.100
锐捷 - DHCP中继
Switch(config)# service dhcp Switch(config)# ip helper-address 10.1.0.100
3. AAA认证配置
华为 - 本地用户管理
aaa // 创建只读用户(权限级别0-5) local-user monitor password cipher Monitor@123 service-type telnet ssh authorization-attribute level 1 // 创建运维用户(权限级别6-10) local-user opsadmin password cipher Ops@123 service-type telnet ssh authorization-attribute level 10 // 创建管理员用户(权限级别15) local-user superadmin password cipher Super@123 service-type telnet ssh http authorization-attribute level 15
华三 - RADIUS服务器对接(企业常见场景)
// 配置RADIUS服务器 [FW-Core] radius scheme radius1 [FW-Core-radius-radius1] primary authentication 192.168.1.100 [FW-Core-radius-radius1] primary accounting 192.168.1.100 [FW-Core-radius-radius1] key authentication cipher RadiusKey@123 [FW-Core-radius-radius1] key accounting cipher RadiusKey@123 [FW-Core-radius-radius1] user-name-format without-domain // 配置ISP域使用RADIUS认证 [FW-Core] domain default [FW-Core-isp-default] authentication login radius-scheme radius1 [FW-Core-isp-default] authorization login radius-scheme radius1 [FW-Core-isp-default] accounting login radius-scheme radius1
4. 日志配置
华为 / 华三 - 发送日志到日志服务器
// 开启信息中心 info-center enable // 配置日志服务器(Syslog) info-center loghost 192.168.1.200 // 设置日志级别(emergencies=0, debugging=7) info-center source default channel loghost level informational // 配置时间戳 info-center timestamp log date // 华三额外配置 [FW-Core] info-center loghost 192.168.1.200 port 514 [FW-Core] info-center timestamp log
典型开局完整配置示例(中小企业出口场景)
Step 1: 核心交换机(华为S5700)完整配置
# ============================== # 华为S5700核心交换机开局配置 # ============================== system-view sysname SW-Core // --- VLAN创建 --- vlan batch 10 20 99 vlan 10 description Office-VLAN vlan 20 description Server-VLAN vlan 99 description Management-VLAN // --- VLANIF网关 --- interface Vlanif 10 ip address 192.168.10.1 255.255.255.0 dhcp select relay dhcp relay server-ip 192.168.20.100 interface Vlanif 20 ip address 192.168.20.1 255.255.255.0 interface Vlanif 99 ip address 10.0.0.2 255.255.255.0 // --- 上联防火墙口(Trunk) --- interface GigabitEthernet 0/0/24 port link-type trunk port trunk allow-pass vlan 10 20 99 description To-Firewall // --- 下联接入交换机口(Trunk) --- interface GigabitEthernet 0/0/1 port link-type trunk port trunk allow-pass vlan 10 20 description To-Access-SW1 // --- STP配置(核心为根桥) --- stp mode rstp stp root primary stp priority 0 // --- 默认路由指向防火墙 --- ip route-static 0.0.0.0 0.0.0.0 10.0.0.1 // --- SSH远程管理 --- rsa local-key-pair create ssh server enable user-interface vty 0 4 authentication-mode aaa protocol inbound ssh aaa local-user admin password cipher Admin@2026 service-type ssh telnet authorization-attribute level 15 info-center loghost 192.168.20.10 save
Step 2: 接入交换机(华为S2700)完整配置
system-view sysname SW-Access-1F // --- VLAN --- vlan batch 10 20 // --- Access端口(1-20口接办公电脑) --- interface range GigabitEthernet 0/0/1 to GigabitEthernet 0/0/20 port link-type access port default vlan 10 stp edged-port enable undo shutdown // --- Access端口(21-24口接服务器) --- interface range GigabitEthernet 0/0/21 to GigabitEthernet 0/0/24 port link-type access port default vlan 20 undo shutdown // --- 上联核心(Trunk) --- interface GigabitEthernet 0/0/26 port link-type trunk port trunk allow-pass vlan 10 20 undo shutdown // --- STP --- stp mode rstp stp priority 4096 save
Step 3: 防火墙(华为USG6000)完整配置
# ============================== # 华为USG6000防火墙开局配置 # ============================== system-view sysname FW-Exit // --- 接口配置 --- // 内网接口(连接核心交换机) interface GigabitEthernet 1/0/0 undo shutdown ip address 10.0.0.1 255.255.255.0 // 外网接口(连接运营商) interface GigabitEthernet 1/0/1 undo shutdown ip address 202.100.1.2 255.255.255.0 // --- 安全区域 --- firewall zone trust add interface GigabitEthernet 1/0/0 firewall zone untrust add interface GigabitEthernet 1/0/1 firewall zone local // --- 安全策略 --- // 允许内网访问外网 security-policy rule name Allow_Office_Internet source-zone trust destination-zone untrust source-address 192.168.10.0 255.255.255.0 action permit rule name Allow_Server_Internet source-zone trust destination-zone untrust source-address 192.168.20.0 255.255.255.0 action permit // 允许内网管理防火墙 rule name Allow_Manage_FW source-zone trust destination-zone local source-address 10.0.0.0 255.255.255.0 service telnet ssh http https ping action permit // --- NAT(内网上网) --- nat-policy rule name SNAT_All source-zone trust destination-zone untrust source-address 192.168.0.0 255.0.0.0 action source-nat easy-ip // --- 端口映射(Web服务器对外发布) --- nat server protocol tcp global 202.100.1.2 80 inside 192.168.20.10 80 nat server protocol tcp global 202.100.1.2 443 inside 192.168.20.10 443 // --- 路由 --- ip route-static 0.0.0.0 0.0.0.0 202.100.1.1 // 默认路由 ip route-static 192.168.10.0 255.255.255.0 10.0.0.2 // 回程路由 ip route-static 192.168.20.0 255.255.255.0 10.0.0.2 // 回程路由 save
Step 4: 验证测试
| 测试项 | 测试方法 | 预期结果 |
|---|---|---|
| 交换机互联 | 从核心交换机 ping 接入交换机管理IP | 通 |
| 交换机到防火墙 | 从核心交换机 ping 防火墙内网口 10.0.0.1 | 通 |
| 内网互通 | 从VLAN10的PC ping VLAN20的服务器 | 通(经过三层交换机路由) |
| 内网上网 | 从内网PC ping 223.5.5.5 | 通(经防火墙NAT) |
| 端口映射 | 从外网(手机4G)访问 http://202.100.1.2 | 能看到Web服务器页面 |
| SSH管理 | 从管理PC SSH到交换机/防火墙 | 登录成功 |
| VLAN隔离 | VLAN10的PC尝试访问VLAN20未授权服务器 | 不通(ACL控制时) |
VRRP 网关冗余 / 防火墙双机热备
1. VRRP 网关冗余配置
两台核心交换机组成VRRP组,虚拟IP作为终端默认网关,实现网关级冗余。
华为 / 华三
// === 主设备(Master) === interface Vlanif 10 ip address 192.168.10.2 255.255.255.0 // 物理IP vrrp vrid 10 virtual-ip 192.168.10.1 // 虚拟IP(网关) vrrp vrid 10 priority 120 // 优先级(默认100,越大越优先) vrrp vrid 10 preempt-mode timer delay 20 // 抢占延迟20秒 vrrp vrid 10 track interface GigabitEthernet 0/0/24 reduced 30 // 监控上联口,故障时降30优先级 // === 备设备(Backup) === interface Vlanif 10 ip address 192.168.10.3 255.255.255.0 vrrp vrid 10 virtual-ip 192.168.10.1 vrrp vrid 10 priority 100 // 默认优先级,作为Backup vrrp vrid 10 preempt-mode timer delay 20 // 验证命令 display vrrp brief
锐捷
// === 主设备 === Switch(config)# interface vlan 10 Switch(config-if)# ip address 192.168.10.2 255.255.255.0 Switch(config-if)# vrrp 10 ip 192.168.10.1 Switch(config-if)# vrrp 10 priority 120 Switch(config-if)# vrrp 10 preempt // === 备设备 === Switch(config-if)# vrrp 10 ip 192.168.10.1 Switch(config-if)# vrrp 10 priority 100 Switch# show vrrp brief
2. 防火墙双机热备(HA)
华为 USG6000 双机热备
// 主防火墙配置 firewall zone trust add interface GigabitEthernet 1/0/0 hrp interface GigabitEthernet 1/0/6 // HA心跳口 hrp enable // 开启HA hrp role standby // 主备模式(主设备自动协商为主) hrp mirror session enable // 会话镜像同步 hrp track interface GigabitEthernet 1/0/1 // 监控业务口 // 备防火墙配置(相同配置,hrp role standby) // 配置会自动从主设备同步到备设备 display hrp state // 查看HA状态
安全加固:DHCP Snooping / ARP防护 / 端口安全
1. DHCP Snooping(防止非法DHCP)
防止接入层私接DHCP服务器,同时建立DHCP绑定表用于DAI和IPSG。
华为
dhcp snooping enable // 全局开启 // 上联口(连接合法DHCP服务器或上联设备)设为信任口 interface GigabitEthernet 0/0/24 dhcp snooping trusted // 接入口(连接终端)默认不信任 // 可选:限制每个端口学习的最大MAC数 interface GigabitEthernet 0/0/1 dhcp snooping max-learning-num 5 display dhcp snooping
华三
[SW-Core] dhcp snooping enable [SW-Core] interface GigabitEthernet 1/0/24 [SW-Core-GigabitEthernet1/0/24] dhcp snooping trust
锐捷
Switch(config)# ip dhcp snooping Switch(config)# interface gigabitethernet 0/24 Switch(config-if)# ip dhcp snooping trust
2. ARP防护(DAI动态ARP检测)
基于DHCP Snooping绑定表,检测并拦截非法ARP报文,防止ARP欺骗。
华为
// 需先开启DHCP Snooping arp anti-attack check user-bind enable // 全局开启ARP绑定检查 // 在接入端口启用 interface GigabitEthernet 0/0/1 arp anti-attack check user-bind enable // 可选:配置ARP严格学习模式 arp learning strict enable
3. 端口安全(MAC地址绑定)
华为
interface GigabitEthernet 0/0/5 port-security enable // 开启端口安全 port-security max-mac-num 2 // 最大学习2个MAC port-security protect-action restrict // 超出后丢弃(restrict)或关闭(shutdown) port-security mac-address sticky // MAC地址粘滞(自动转为静态绑定)
锐捷
Switch(config)# interface gigabitethernet 0/5 Switch(config-if)# switchport port-security Switch(config-if)# switchport port-security maximum 2 Switch(config-if)# switchport port-security violation restrict Switch(config-if)# switchport port-security mac-address sticky
4. BPDU Guard / 根桥保护
在接入端口启用BPDU Guard,防止私接交换机引发网络风暴。
华为
// 方式一:全局开启BPDU保护(边缘端口收到BPDU则自动关闭) stp bpdu-protection enable // 方式二:在接口上单独配置 interface GigabitEthernet 0/0/1 stp edged-port enable stp bpdu-protection enable // 根桥保护(防止接入设备抢占根桥) stp root-protection
锐捷
Switch(config)# spanning-tree portfast bpduguard default // 全局开启 Switch(config-if)# spanning-tree bpduguard enable // 接口开启 Switch(config-if)# spanning-tree guard root // 根桥保护
运维管理:NTP / SNMP / 配置备份 / 固件升级
1. NTP 时间同步
华为 / 华三
clock timezone Beijing add 08:00 // 设置时区(东八区) // 华为 ntp-service unicast-server ntp.aliyun.com // 阿里云NTP ntp-service unicast-server cn.ntp.org.cn // 中国NTP // 华三 [SW-Core] ntp-service unicast-server ntp.aliyun.com // 验证 display clock display ntp-service status
锐捷
Switch(config)# clock timezone Beijing 8 Switch(config)# ntp server ntp.aliyun.com Switch(config)# ntp server cn.ntp.org.cn Switch# show clock
2. SNMP 网管配置
华为
snmp-agent sys-info version v3 // 使用SNMPv3(推荐) snmp-agent group v3 snmpv3group privacy // 启用加密 snmp-agent usm-user v3 snmpadmin snmpv3group snmp-agent usm-user v3 snmpadmin snmpv3group authentication-mode sha AuthPass123 privacy-mode aes128 PrivPass123 snmp-agent target-host trap address udp-domain 192.168.1.200 params securityname snmpadmin v3 privacy snmp-agent trap enable
3. 配置备份与恢复
| 厂商 | 备份命令 | 恢复命令 |
|---|---|---|
| 华为 | save 或 ftp 服务器IP put vrpcfg.zip |
ftp 服务器IP get vrpcfg.zip → set saved-configuration |
| 华三 | save 或 tftp 服务器IP put config.cfg |
tftp 服务器IP get config.cfg → restore startup-configuration |
| 锐捷 | write 或 copy running-config tftp://IP/backup.cfg |
copy tftp://IP/backup.cfg running-config |
| 深信服 | Web界面【系统维护】→【配置备份】下载 | Web界面【系统维护】→【配置恢复】上传 |
4. 固件升级注意事项
| 步骤 | 操作要点 |
|---|---|
| 1. 版本确认 | display version / show version,确认当前版本和BootROM版本 |
| 2. 兼容性检查 | 查阅官方Release Notes,确认目标版本兼容当前硬件和License |
| 3. 配置备份 | 升级前务必备份当前配置文件 |
| 4. 传输文件 | 通过FTP/TFTP将固件文件传输到设备存储 |
| 5. 设置启动文件 | startup system-software(华为)/ boot system(锐捷) |
| 6. 重启设备 | 计划维护窗口执行,确认有Console口访问权限 |
| 7. 升级后验证 | 检查版本号、接口状态、路由表、策略是否正常 |
常见故障排查命令与流程
排障流程
1. 物理层检查 - 接口状态是否 UP? → display interface brief - 线缆是否插好?端口灯是否亮? 2. 数据链路层检查 - VLAN是否正确? → display vlan - Trunk是否放行VLAN? → display interface switchport - MAC地址是否学习到? → display mac-address 3. 网络层检查 - IP地址是否配置? → display ip interface brief - 路由是否可达? → display ip routing-table - ARP是否解析? → display arp 4. 策略层检查(防火墙) - 安全策略是否放行? → display security-policy all - NAT是否配置? → display nat-policy all - 会话表是否有条目? → display firewall session table 5. 逐段Ping测试 - PC → 网关 → 核心交换机 → 防火墙内网口 → 防火墙外网口 → 运营商网关 → 公网IP
常用排障命令速查
| 故障现象 | 排查命令 | 说明 |
|---|---|---|
| 接口不通 | display interface brief | 查看物理状态和协议状态 |
| VLAN不通 | display vlan | 确认VLAN创建和端口归属 |
| 路由不通 | display ip routing-table | 检查路由表是否有目的网段 |
| ARP不通 | display arp | 检查ARP解析是否正常 |
| 策略拦截 | display security-policy all | 查看命中计数,确认是否被策略丢弃 |
| NAT不通 | display nat session all | 查看NAT会话是否建立 |
| 丢包定位 | ping -c 100 -s 1500 x.x.x.x | 大包测试MTU问题 |
| 路径追踪 | tracert x.x.x.x | 逐跳定位断点位置 |
| 端口错误 | display counters interface GE x/x/x | 查看端口收发计数和错误 |
| CPU过高 | display cpu-usage | 检查CPU利用率 |
| 内存不足 | display memory-usage | 检查内存使用率 |
| 清除计数 | reset counters interface GE x/x/x | 清除接口统计后重新观察 |
开局配置检查清单
点击每一项可标记为已完成,方便现场逐项确认。数据保存在浏览器本地。
- 修改默认管理员密码
- 配置管理接口IP地址
- 配置内网接口IP地址
- 配置外网接口IP地址(或DHCP获取)
- 创建安全区域并绑定接口
- 配置内网到外网的安全策略(允许)
- 配置源NAT(内网上网)
- 配置默认路由指向运营商网关
- 配置回程路由(指向内网网段)
- 配置端口映射(如需对外发布服务)
- 开启SSH远程管理
- 配置日志服务器
- 保存配置并验证
- 修改设备名称
- 创建所需VLAN并命名
- 配置Access端口并划分VLAN
- 配置Trunk端口并放行VLAN
- 配置VLANIF网关IP地址
- 配置STP(根桥/边缘端口)
- 配置默认路由
- 配置DHCP中继或服务器
- 开启SSH远程管理
- 配置管理VLAN和远程管理IP
- 配置日志服务器
- 关闭未使用的端口
- 保存配置并验证