Juniper SRX300防火墙零基础实战:从拆箱到上网的完整指南
刚拿到一台Juniper SRX300防火墙时,面对密密麻麻的接口和陌生的命令行界面,很多新手会感到无从下手。这台银色金属外壳的设备虽然只有1U高度,却承载着企业网络的第一道防线。本文将用最直白的语言,带你一步步完成从拆箱到上网的全过程配置,即使你从未接触过企业级防火墙也能轻松上手。
1. 开箱与物理连接
拆开SRX300的包装箱,你会看到以下标准配件:
- 防火墙主机(含机架安装套件)
- 电源线
- 串口控制线(RJ45转DB9)
- 快速入门指南
物理连接步骤:
- 电源接入:将电源线插入设备后方标有"PWR"的接口,接通电源后前面板的"PWR"指示灯会亮起绿色
- 控制台连接:
- 使用附带的串口线连接设备Console口和电脑
- 在电脑上打开终端工具(如PuTTY),设置参数:
波特率:9600 数据位:8 奇偶校验:无 停止位:1 流控:无
- 网络接口连接:
- ge-0/0/0:连接外网(如光猫或上级路由器)
- ge-0/0/1:连接内网交换机
- 其他接口可留作未来扩展使用
注意:首次启动约需3-5分钟,系统指示灯会从黄色变为稳定绿色表示启动完成
2. 初始系统配置
首次登录需要使用控制台连接,默认无密码。看到login:提示后直接输入root回车即可进入系统。
基础系统设置:
# 进入配置模式 cli configure # 恢复出厂设置(确保开始前环境干净) load factory-default # 设置root密码(建议使用复杂密码) set system root-authentication plain-text-password New password: [输入密码] Retype new password: [再次输入密码] # 配置管理用户 set system login user admin class super-user set system login user admin authentication plain-text-password New password: [输入管理员密码] Retype new password: [再次输入密码] # 设置主机名和时区 set system host-name SRX300-Office set system time-zone Asia/Shanghai # 配置NTP时间同步 set system ntp server pool.ntp.org # 提交配置并保存 commit save关键参数说明:
| 配置项 | 示例值 | 作用 |
|---|---|---|
| root密码 | Juniper@2023 | 设备最高权限密码 |
| 管理用户 | admin | 日常管理账户 |
| 主机名 | SRX300-Office | 设备标识名称 |
| NTP服务器 | pool.ntp.org | 时间同步服务器 |
3. 网络接口与安全区域配置
SRX300的核心概念是安全区域(Security Zone)和接口绑定。我们需要明确三个关键点:
- trust区域:通常指内网,安全等级高
- untrust区域:通常指外网,安全等级低
- 接口类型:二层(交换)或三层(路由)接口
具体配置步骤:
# 创建VLAN和IRB接口 set vlans vlan-untrust vlan-id 10 set vlans vlan-untrust l3-interface irb.10 set vlans vlan-trust vlan-id 20 set vlans vlan-trust l3-interface irb.20 # 配置物理接口 set interfaces ge-0/0/0 unit 0 family ethernet-switching vlan members vlan-untrust set interfaces ge-0/0/1 unit 0 family ethernet-switching vlan members vlan-trust # 配置IRB接口IP set interfaces irb unit 10 family inet address 203.0.113.2/24 # 外网IP set interfaces irb unit 20 family inet address 192.168.1.1/24 # 内网IP # 配置安全区域 set security zones security-zone untrust interfaces irb.10 set security zones security-zone trust interfaces irb.20 # 设置默认路由(假设网关是203.0.113.1) set routing-options static route 0.0.0.0/0 next-hop 203.0.113.1接口规划表:
| 接口 | 类型 | VLAN | IP地址 | 安全区域 |
|---|---|---|---|---|
| ge-0/0/0 | 二层 | vlan-untrust (10) | - | untrust |
| ge-0/0/1 | 二层 | vlan-trust (20) | - | trust |
| irb.10 | 三层 | - | 203.0.113.2/24 | untrust |
| irb.20 | 三层 | - | 192.168.1.1/24 | trust |
4. DHCP服务与NAT配置
为了让内网设备自动获取IP并访问互联网,需要配置DHCP和NAT:
DHCP服务器配置:
# 创建DHCP地址池 set access address-assignment pool lan-pool family inet network 192.168.1.0/24 set access address-assignment pool lan-pool family inet range dhcp-range low 192.168.1.100 set access address-assignment pool lan-pool family inet range dhcp-range high 192.168.1.200 # 设置DHCP选项 set access address-assignment pool lan-pool family inet dhcp-attributes router 192.168.1.1 set access address-assignment pool lan-pool family inet dhcp-attributes name-server 8.8.8.8 set access address-assignment pool lan-pool family inet dhcp-attributes propagate-settings irb.20 # 启用DHCP服务 set system services dhcpNAT配置(内网访问外网):
# 配置源NAT规则 set security nat source rule-set trust-to-untrust from zone trust set security nat source rule-set trust-to-untrust to zone untrust set security nat source rule-set trust-to-untrust rule src-nat-rule match source-address 192.168.1.0/24 set security nat source rule-set trust-to-untrust rule src-nat-rule then source-nat interface5. 安全策略与管理服务
最后需要配置安全策略允许流量通过,并开启必要的管理服务:
基础安全策略:
# 允许内网访问外网 set security policies from-zone trust to-zone untrust policy allow-outbound match source-address any set security policies from-zone trust to-zone untrust policy allow-outbound match destination-address any set security policies from-zone trust to-zone untrust policy allow-outbound match application any set security policies from-zone trust to-zone untrust policy allow-outbound then permit # 允许外网ping和必要的管理访问(谨慎配置) set security zones security-zone untrust host-inbound-traffic system-services ping set security zones security-zone untrust host-inbound-traffic system-services sshWeb管理界面配置:
# 启用HTTP/HTTPS管理 set system services web-management http interface irb.20 set system services web-management https interface irb.20 # 限制管理访问IP(可选但推荐) set system services ssh client-match 192.168.1.0/24 set system services web-management http client-match 192.168.1.0/24完成所有配置后,记得执行commit和save保存配置。现在你的SRX300应该已经可以正常工作了,内网设备可以通过它访问互联网。如果遇到问题,可以使用以下命令检查状态:
show interfaces terse # 查看接口状态 show security nat source rule all # 检查NAT规则 show security policies # 查看安全策略 ping 8.8.8.8 # 测试外网连通性第一次配置企业级防火墙可能会觉得步骤繁琐,但SRX300的这种模块化设计实际上让网络结构更清晰。我在实际部署中发现,理清安全区域与接口的关系后,后续维护会轻松很多。建议配置完成后导出备份配置:
show configuration | save /var/tmp/srx300-backup.conf