路由器与防火墙配置命令

路由器与防火墙配置命令

小明啊,你不是学计算机的嘛,叔叔家的路由器坏了,可以过来帮叔叔看看吗

命令可以用缩写,造就一堆容易造成歧义的缩写,比如addaddress的缩写,shshutdown的缩写。

本文有一定历史局限性。各位不要纠结于过去的繁荣,着眼现在和未来才是最重要的。

路由器为Cisco路由器,防火墙为PIX防火墙

视图模式介绍

普通视图 router>
特权视图 router#     #在普通模式下输入enable
全局视图 router(config)#   #在特权模式下输入config t
接口视图 router(config-if)#   #在全局模式下输入int 接口名称 例如int f0/0或int e0
路由协议视图 router(config-route)#  #在全局模式下输入router 动态路由协议名称
exit #从接口、协议、line等视图模式下退回到全局配置模式,或从全局配置模式退回到特权模式
end #回到特权模式
router#reload #重新启动路由器

1. 基本配置

router>en	 					#enable的缩写,进入特权模式
router#conf t 					#configure terminal的缩写,进入全局配置模式
router(config)# hostname xxx 	#设置设备名称
router(config)#enable password XXX  #设置进入特权模式密码(低级密码,密码可逆)
Router(config)#enable secret XXX    #设置进入特权模式密码(高级密码,密码不可逆)

router(config)#no ip domain lookup #不允许路由器缺省使用DNS解析命令
router(config)# Service password-encrypt 
	#对所有在路由器上输入的口令进行暗文加密
router(config)#security

router(config)#line vty 0 4 #进入虚拟终端线路配置模式
router(config-line)#password xxx #设置telnet的密码。没有密码远程连接不了
router(config-line)#no login #设置无密码登录
router(config-line)#login #开启登陆密码

router(config)#line con 0 #进入控制口的服务模式
router(config-line)#password xxx #设置console的密码
router(config-line)#login #开启密码

router#Logout  #退出当前路由器登陆模式相对与windows的注销
router#reload #重新启动路由器(热启动)冷启动就是关闭路由器再打开电源开关 

2. 接口配置与网络地址转换

NAT:network address translation,网络地址转换

PAT:port address translation,端口地址转换

router(config)#int f0/0 
	#进入接口f0/0的配置模式。
	#f0/0代表这个路由器的0槽位上的第一个接口)
router(config-if)#ip add 10.9.9.1 255.255.255.0   
	#这里的add是address的缩写,设置s0接口的ip地址,子网掩码
router(config-if)#nameif outside
	#设置接口命名为outside
router(config-if)# security-level 0
	#设置接口的安全级别为0,若安全级别相同则不能通信
router(config-if)#enca hdlc/ppp 
	#捆绑链路协议 hdlc 或者 ppp。
	#思科缺省串口封装的链路层协议是HDLC,所以在show run中不会显示enca hdlc
	#如果要封装为别的链路层协议例如PPP/FR/X25,show run才会显示enca ppp等配置
	
firewall(config)# int e0 #进入e0接口配置
firewall(config-if)# ip add 10.9.9.1 255.255.255.0 #设置e0接口的ip,netmask
firewall(config-if)# nameif inside #接口命名为inside,表示内部网络
firewall(config-if)# end #回到特权模式
firewall# conf t #进入全局模式
firewall(config)# nat (inside) 101 10.9.9.0 255.255.255.0
	#配置inside接口的网络地址转换,指定转换范围10.9.9.0/24网段的数据包
	#穿越防火墙时将进行地址转换,NAT标识ID为101
firewall(config)# global (outside) 101 192.168.9.9-192.168.9.102 netmask 255.255.255.0
	#配置outside接口的全局地址池,转换NAT标识ID为101的所有数据包源IP地址
	#(需要与nat命令的NAT标识对应),分配出站的全局地址,范围192.168.9.9-192.168.9.102。
	#比如来自内网10.9.9.2的数据包转换成192.168.9.9作为外部地址。
firewall(config)# global (outside) 101 192.168.9.103 netmask 255.255.255.255
	#在上一条命令之后输入这一条,表示当上一条global的全局地址全部分配完毕后,才使用这条命令的全局地址池

firewall(config)# static (dmz,outside) 192.168.9.21 172.5.5.2
	#static [(internal_if_name,external_if_name)] global_ip local_ip[netmask network_mask][max_conns [em_limit]][norandomseq]
	#配置静态网络地址转换,内部网络接口名dmz,外部网络接口名outside,
	#指定dmz区域的ip地址为172.5.5.2,转换为防火墙外部区域的IP地址192.168.9.21

firewall(config)# show run nat #查看正在运行的nat
firewall(config)# no nat (inside) 101 10.9.9.0 255.255.255.0 #删除这条配置

router(config)#int loopback 
	#建立环回口(逻辑接口)模拟不同的本机网段
router(config-if)#ip add 192.168.1.1 255.255.255.255  
	#添加ip 地址和掩码给环回口
router(config-if)#no sh  		#sh是shutdown的缩写,开启接口
router(config-if)#shutdown 		#管理性的关闭接口

3. 静态路由与动态路由

(1)静态路由

firewall(config)# route outside 0 0 10.9.9.13
	#route if_name ip_address netmask gateway_ip [metric]
    #ip_address为目的ip,metric为到gateway_ip的跳数
	#配置默认路由为10.9.9.13,从防火墙outside接口出站的所有数据包,通过默认路由到达外网

router(config)#ip route 0.0.0.0 0.0.0.0 192.168.9.1
	#目的地址为0.0.0.0(任意地址),下一跳地址192.168.9.1

(2)动态路由

rip协议
router(config)#router rip 	#启动rip协议
router(config-router)#network xxx.xxx.xxx.xxx #宣告自己的网段
router(config-router)#version 2  #转换为rip 2版本
router(config-router)#no auto-summary #关闭自动汇总功能,rip V2才有作用
router(config-router)# passive-int 接口名 
	#启动本路由器的那个接口为被动接口,该接口不会发送RIP更新
router(config-router)# nei xxx.xxx.xxx.xxx 
	#neighbor的缩写,广播转单播报文,指定邻居的接收ip
igrp协议
router(config)#router igrp xxx #启动igrp协议 
router(config-router)#network xxx.xxx.xxx.xxx #宣告自己的网段
router(config-router)#variance xxx #调整倍数因子,使用不等价的负载均衡
eigrp协议
router(config)router eigrp xxx #启动协议
router(config-router)#network xxx.xxx.xxx.xxx #宣告自己的网段
router(config-router)#variance xxx #调整倍数因子,使用不等价的负载均衡
router(config-router)#no auto-summary #关闭自动汇总功能
ospf协议
router(config)router ospf xxx #启动协议启动一个OSPF协议进程
router(config-router)network xxx.xxx.xxx.xxx area xxx 
	#宣告自己的接口或网段,在ospf的区域中可以把不同接口宣告在不同区域中
router(config-router)router-id xxx.xxx.xxx.xxx #配置路由的id
router(config-router)aera xxx stub 
	#配置xxx区域为末梢区域,加入这个区域的路由器全部要配置这个条命令
router(config-router)aera xxx stub no-summary  
	#配置xxx区域为完全末梢区域,只在ABR上配置
router(config-router)aera xxx nssa 
	#配置xxx区域为非纯末梢区域(NSSA)加入这个区域的路由器全部要配置这个条命令
router(config-router)aera xxx nssa no-summary  
	#配置xxx区域为完全非纯末梢区域,只在ABR上配置,
	#并发布缺省路由信息给进入这个区域内的路由器

4. 保存配置

router#wr 
	#write的缩写,将RAM中的当前配置存储到NVRAM中,下次路由器启动就是执行保存的配置
router#Copy running-config startup-config 
	#命令与write效果一样
pixfirewall(config)# write memory all
	#适用于多模式下的保存配置

5. 查看命令

特权模式下:
router#show ip int br 
	#brief的缩写,查看当前的路由器的接口ip地址启用情况
router#show ip route #查看当前的路由表
router#show ? #查看show命令用法
firewall(config)#show running-config nat #查看当前的 NAT 配置
firewall(config)#show running-config global #查看global命令配置
firewall#show config #查看防火墙配置
firewall#show run interface e0 #查看e0接口的nameif,security-level,ip address
firewall#show int ip br

6. 访问控制列表ACL

防火墙流量过滤只关注第一个初始化的数据包,而非响应包。防火墙接口没有绑定ACL时,出站的流量默认是放行,入站流量默认说拒绝。那么,拒绝默认可以出站的流量,放行默认不能入站的流量,就需要通过配置访问控制列表(Access Control List,ACL)实现流量过滤。

防火墙上的一个接口只能绑定一个ACL

#创建访问控制规则
pixfirewall(config)# access-list acl_id [line line-num] deny|permit protocol source_addr source_mask [operator [port]] destination_addr destination_mask operator [port]

acl_id 指定ACL名称
deny|permit 拒绝|允许通过PIX防火墙的数据包
operator 有效的操作符有lt,gt,eq,neq,range
remark 添加到ACL中的注释
text 用于remark注释的正文

show access-list		 #显示ACL
clear access-list [acl_id] #删除所有或指定条目的ACL
no access-list acl_id 	#删除指定条目的ACL

#绑定到防火墙的特定接口
pixfirewall(config)# access-group acl_id in interface interface_name
	#绑定一个ACL到一个接口

show access-group acl_id in interface interface_name	 #显示绑定在interface_name接口的ACL
clear access-group acl_id in interface interface_name #删除acl_id标识的ACL中的所有条目
no access-group acl_id in interface interface_name 	#删除绑定在接口上acl_id标识的ACL

示例:

pixfirewall(config)# access-list 101 extended permit icmp any any echo-reply
	#创建编号为101的ACL,放行ping命令回显数据包,标识ID为101
pixfirewall(config)# access-list 101 permit tcp any host 192.168.9.21 eq 23
	#创建ACL,放行所有到目的主机192.168.9.21且端口号为23的TCP协议数据包,标识ID为101
pixfirewall(config)# access-list accacl extended permit tcp any any eq www
	#创建名称为accacl的扩展访问控制列表(支持更复杂的匹配条件),
	#放行所有端口号为80(www)的数据包
pixfirewall(config)# show access-list
access-list cached ACL log flows: total 0, denied 0 (deny-flow-max 4096)
            alert-interval 300
access-list 101; 2 elements
access-list 101 line 1 extended permit icmp any any echo-reply (hitcnt=0) 0x30901cd
access-list 101 line 2 extended permit tcp any host 192.168.9.21 eq telnet (hitcnt=0) 0x17597d2

pixfirewall(config)# access-group 101 in interface outside
	#接口outside绑定标识为101的ACL
pixfirewall(config)# access-group 101 in interface dmz
	#接口dmz绑定标识为101的ACL
pixfirewall(config)# show run access-group
access-group 101 in interface outside
access-group 101 in interface dmz

7. 系统日志

比如在win10虚拟机上装了kiwi syslog软件

常见语法

clock timezone zone-name hours [minutes] #定义时区
clock timezone UTC-8 #定义时区

clock set hh:mm:ss {day month} year
clock set 14:30:00 25 October 2023

show logging #显示日志

pixfirewall(config)# logging host inside 33.33.33.3
	#指定系统日志服务器的IP地址为33.33.33.3,位于防火墙的inside区域。
pixfirewall(config)# logging trap ?

configure mode commands/options:
  <0-7>          Enter syslog level (0 - 7)
  WORD           Specify the name of logging list
  alerts
  critical
  debugging
  emergencies
  errors
  informational
  notifications
  warnings
pixfirewall(config)# logging trap 7
	#指定将日志级别为7的消息发送给日志服务器
pixfirewall(config)# logging timestamps 
	#为系统记录的每条日志打上时间标签
pixfirewall(config)# logging on

8. 认证授权审计AAA

比如使用Cisco Secure ACS

防火墙默认情况下是拒绝入站流量,放行出站流量的。当网络通信时,要放行入站的流量,禁止出站的流量,则需要配置ACL实现,但此时对流量的监管粒度较粗。AAA服务将防火墙的粒度细化到了用户,提供认证授权审计的功能。利用AAA服务可以知道网络的用户是谁,用户可以做什么操作以及用户的行为痕迹,还可以对用户的流量进行管控。

  1. 认证:确定访问网络的用户身份。常用通信协议:TACACS+RADIUS
  2. 授权:确定用户进行网络访问的操作权限。
  3. 审计:用于记录用户对网络资源的操作行为。
#1.认证配置
#创建AAA服务器组并指定认证协议
aaa-server <server-tag> protocol <protocol>
#将服务器加入到AAA服务器组
aaa-server <server-tag> <(if_name)> host <ip_address> key timeout seconds
#删除AAA服务器组的指定服务器
no aaa-server <server-tag>  (if_name) host server_ip key timeout seconds
#清除服务器组
clear aaa-server [group_tag]
#认证aaa authentication命令语法
aaa authentication include | exclude services inbound | outbound | if_name local_ip local_mask foreign_ip foreign_mask group_tag

include 需要认证的条目
exclude 不需要认证的条目
services 认证的服务类型,any是所有TCP服务
inbound 认证入站的连接,作用于安全级别低的接口(比如outside)
outbound 认证出站的连接,作用于安全级别高的接口
if_name 用户连接数据包来自的接口,即需要认证的接口
local_ip 要求认证的地址
local_mask 要求认证的地址的掩码
foreign_ip 要访问的目的地址
foreign_mask 要访问的目的地址的掩码
group_tag aaa-server设置的服务器组标识

#结合match认证符合acl条目的流量
aaa authentication match acl_name if_name server_tag
#添加本地用户信息
username admin1 password cisco123

#2.授权配置
aaa authorization include | exclude services inbound | outbound | if_name local_ip local_mask foreign_ip foreign_mask
#结合match
aaa authorization match acl_name if_name server_tag

#3.审计配置
aaa accounting match acl_name if_name server_tag
#设置命令级别,筛选要审计的内容
aaa accounting command [privilege level] server_tag

示例

show uauth
	#显示认证统计信息
pixfirewall(config)# aaa-server aaa1 protocol tacacs+
	#创建一个名为 aaa1 的AAA服务器组,并指定使用 TACACS+ 协议进行认证。
pixfirewall(config-aaa-server-group)# aaa-server aaa1 host 133.33.33.5
	#将IP地址 133.33.33.5 添加到 aaa1 服务器组中,作为TACACS+服务器。
pixfirewall(config-aaa-server-host)# timeout 100
	#设置与TACACS+服务器的通信超时时间为100秒
pixfirewall(config-aaa-server-host)# key cisco123
	#设置与TACACS+服务器通信的共享密钥为 cisco123。
pixfirewall(config-aaa-server-host)# aaa authentication match 101 outside aaa1
	#在 outside 接口上,对匹配访问控制列表(ACL)101 的流量使用 aaa1 服务器组进行认证
pixfirewall(config)# aaa authentication match 101 dmz aaa1
	#在 dmz 接口上,对匹配ACL 101 的流量使用 aaa1 服务器组进行认证
pixfirewall(config)# aaa authorization match 101 outside aaa1
	#在 outside 接口上,对匹配ACL 101 的流量使用 aaa1 服务器组进行授权
pixfirewall(config)# aaa authorization match 101 dmz aaa1
	#在 dmz 接口上,对匹配ACL 101 的流量使用 aaa1 服务器组进行授权
pixfirewall(config)# aaa accounting match accacl outside aaa1
	#在 outside 接口上,对匹配ACL accacl 的流量使用 aaa1 服务器组进行计费
pixfirewall(config)# aaa accounting match accacl dmz aaa1
	#在 dmz 接口上,对匹配ACL accacl 的流量使用 aaa1 服务器组进行计费
pixfirewall(config)# auth-prompt prompt who
	#设置认证提示信息为 who(用户认证时看到的提示)
pixfirewall(config)# auth-prompt accept welcome
	#设置认证成功时的欢迎信息为 welcome
pixfirewall(config)# auth-prompt reject we do not know you
	#设置认证失败时的拒绝信息为 we do not know you

9. 安全上下文

PIX防火墙需要激活高级功能。

​ 使用安全上下文构建虚拟防火墙,安全上下文(Security Context,SC)的个数取决于防火墙的许可证。一个物理防火墙可以配置多个虚拟防火墙,每个虚拟防火墙就是一个上下文(Context),可以作为一个独立的防火墙实例运行和管理,这些虚拟防火墙共享物理防火墙的硬件资源。

防火墙的安全上下文有两种运行模式:单模式和多模式。

共享接口:多个上下文的外接口共享一个防火墙的接口。

先对Cisco交换机(R7-SW)进行配置

R7-SW(config)#int f1/0
R7-SW(config-if)#switchport mode trunk
	#将接口 f1/0 配置为 Trunk 模式,允许该接口传输多个 VLAN 的流量
R7-SW(config-if)#exit
R7-SW(config)#int f1/1
R7-SW(config-if)#switchport access vlan 40
% Access VLAN does not exist. Creating vlan 40
	#尝试将接口 f1/1 分配到 VLAN 40。由于 VLAN 40 不存在,系统自动创建了 VLAN 40
R7-SW(config-if)#switchport access vlan 40
	#再次确认将接口 f1/1 分配到 VLAN 40
R7-SW#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
R7-SW(config)#int f1/2
R7-SW(config-if)#switchport access vlan 30
% Access VLAN does not exist. Creating vlan 30
R7-SW(config-if)#switchport access vlan 30
R7-SW(config-if)#end
R7-SW#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
R7-SW(config)#vlan 20,30,40
	#创建 VLAN 20、30 和 40
R7-SW(config-vlan)#ex
	#退出 VLAN 配置模式
R7-SW(config)#int f1/1
R7-SW(config-if)#sw mo acc
	#switchport mode access的缩写,将接口 f1/1 配置为 Access 模式
R7-SW(config-if)#switchport access vlan 40
R7-SW(config-if)#int f1/2
R7-SW(config-if)#switchport mode access
R7-SW(config-if)#switchport access vlan 30
R7-SW(config-if)#int f1/0
R7-SW(config-if)#switchport mode trunk
R7-SW(config-if)#switchport trunk encap
R7-SW(config-if)#switchport trunk encapsulation dot1q
	#配置 Trunk 封装的封装类型为 dot1q(IEEE 802.1Q)

对防火墙进行配置,以下是部分命令

pixfirewall(config)# mode multiple
	#切换防火墙为多模式,通常会重启失败,我们手动关一下防火墙再启动
pixfirewall(config)# show run context 
	#查看当前安全上下文

#现在配置一下防火墙接口VLAN
pixfirewall(config)# changeto context system
	#切换到系统上下文
pixfirewall(config)# int  e1
pixfirewall(config-if)# int e1.2
	#创建并进入子接口e1.2的配置模式
pixfirewall(config-subif)# vlan 20
	#将子接口e1.2与VLAN 20关联。这意味着该子接口将处理VLAN 20的流量
pixfirewall(config-subif)# exit
pixfirewall(config)# int e1
pixfirewall(config-if)# int e1.3
pixfirewall(config-subif)# vlan 30
pixfirewall(config-subif)# exit
pixfirewall(config)# int e1
pixfirewall(config-if)# int e1.4
pixfirewall(config-subif)# vlan 40
pixfirewall(config-subif)# exit

#创建用户上下文A
pixfirewall(config)# context CXTA
	#创建一个名为CXTA的用户上下文。
Creating context 'CXTA'... Done. (2)
pixfirewall(config-ctx)# allocate-interface E0 INTF0
	#将物理接口E0分配给用户上下文CXTA,并在该上下文中将其命名为INTF0
pixfirewall(config-ctx)# allocate-interface E1.3 INTF1
	#将子接口E1.3(之前配置为VLAN 30)分配给用户上下文CXTA,并在该上下文中将其命名为INTF1
pixfirewall(config-ctx)# config-url flash:/CXTA.cfg
	#指定用户上下文CXTA的配置文件路径为flash:/CXTA.cfg

pixfirewall(config-ctx)# exit
pixfirewall(config)# context admin
	#创建一个名为 admin 的安全上下文(Security Context)
pixfirewall(config-ctx)# allocate-interface Ethernet0
	#将物理接口 Ethernet0 分配给 admin 上下文
pixfirewall(config-ctx)# allocate-interface Ethernet1.2

#配置用户上下文A
pixfirewall(config)# changeto context CXTA
	#切换到安全上下文CXTA
pixfirewall/CXTA(config)# int intf0
pixfirewall/CXTA(config-if)# ip add 192.168.9.3 255.255.255.0
pixfirewall/CXTA(config-if)# no sh
pixfirewall/CXTA(config-if)# nameif outside
INFO: Security level for "outside" set to 0 by default.
pixfirewall/CXTA(config-if)# exit
pixfirewall/CXTA(config)# int intf1
pixfirewall/CXTA(config-if)# ip add 10.9.9.3 255.255.255.0
pixfirewall/CXTA(config-if)# no sh
pixfirewall/CXTA(config-if)# nameif inside
INFO: Security level for "inside" set to 100 by default.
pixfirewall/CXTA(config-if)# exit
pixfirewall/CXTA(config)# nat (inside) 11 0.0.0.0 0.0.0.0
pixfirewall/CXTA(config)# global (outside) 11 192.168.9.111
INFO: Global 192.168.9.111 will be Port Address Translated
pixfirewall/CXTA(config)# wr

10. 防火墙IPSec功能

需要激活防火墙高级功能,保证两个防火墙之间可以正常通信,配置需要两端对应。

虚拟专用网络:Virtual Private Networks,VPNs

互联网安全协议:Internet Protocol Security,IPSec

认证头:Authentication Header,AH

封装安全载荷:Encapsulate Security Payload,ESP

安全关联:Security Association,SA

网络密钥交换协议:Internet Key Exchange,IKE

安全策略数据库:Security Policy Database,SPD

安全参数索引:Security Parameter Index,SPI

加密图是用于定义 IPSec VPN 策略的配置集合。它指定了以下内容:

  • 哪些流量需要被保护(通过 ACL 定义)。
  • 加密流量的对等体(Peer)是谁(即远程 VPN 设备的 IP 地址)。
  • 使用哪种加密和认证方式(通过变换集定义)。
  • 加密图需要应用到哪个接口。

变换集定义了 IPSec VPN 隧道中使用的加密和认证算法。它指定了以下内容:

  • 使用的加密算法(如 AES、3DES)。
  • 使用的认证算法(如 SHA、MD5)。
  • 使用的协议(如 ESP 或 AH)。

站点到站点 VPN 的建立流程通常分为两个主要阶段:IKE阶段IPSec 阶段

IKE阶段:

主要目的是在对等体(Peer)之间建立一个安全的通信通道,用于后续的 IPSec 协商。

  1. 协商 IKE 策略,对等体之间交换 IKE 策略,双方必须匹配相同的 IKE 策略才能继续(这意味着左右两边防火墙的认证方式,加密算法,散列算法,密钥交换方式和IKE SA有效期等参数完全相同)。

  2. 执行 DH 密钥交换,使用 Diffie-Hellman 算法生成一个共享的密钥,用于加密后续的 IKE 通信。

  3. 对等体验证,双方使用预共享密钥或数字证书进行身份验证,如果验证成功,IKE SA 建立完成。

结果:建立一个安全的 IKE SA,用于保护后续的 IPSec 协商。

IPSec 阶段:

主要目的是在对等体之间建立 IPSec SA,用于加密实际的数据流量。

  1. 协商 IPSec 策略,对等体之间交换 IPSec 策略,
  2. 建立 IPSec SA,双方根据协商的参数生成 IPSec SA。IPSec SA 包括入站和出站两个方向的安全关联。
  3. 加密数据传输,使用 IPSec SA 对实际的数据流量进行加密和传输

结果:建立一个 IPSec 隧道,用于加密和保护站点之间的数据流量。

防火墙PIX1部分命令

#1.协商IKE策略
pixfirewall(config)# isakmp policy 10
	#创建优先值为10的IKE策略
pixfirewall(config-isakmp-policy)# group 1
	#使用group1的DH算法
pixfirewall(config-isakmp-policy)# lifetime 86400
	#生存时间一天
pixfirewall(config-isakmp-policy)# encryption des
	#加密算法des
pixfirewall(config-isakmp-policy)# authentication pre-share
	#共享密钥值
pixfirewall(config-isakmp-policy)# hash sha
	#散列算法sha
pixfirewall(config-isakmp-policy)# exit
pixfirewall(config)# isakmp enable outside
	#开启outside接口的VPN功能
pixfirewall(config)# clear configure tunnel-group 192.168.9.5
ERROR: Tunnel group 192.168.9.5 does not exist
pixfirewall(config)# isakmp key cllsse123 address 192.168.9.5
	#设置了与对端192.168.9.5预共享密钥值cllsse123,这条命令相当于三条命令
pixfirewall(config)# show run tunnel-group
tunnel-group 192.168.9.5 type ipsec-l2l #指定对端类型是ipsec lan2lan
tunnel-group 192.168.9.5 ipsec-attributes #指定ipsec的策略attitude是预共享密钥
 pre-shared-key * #密钥值被隐藏
pixfirewall(config)# show run isakmp
crypto isakmp enable outside
crypto isakmp policy 10
 authentication pre-share
 encryption des
 hash sha
 group 1
 lifetime 86400
no crypto isakmp nat-traversal

#2.协商IPSec策略
pixfirewall(config)# crypto map fw1 10 ipsec-isakmp
	#指定IPSec的isakmp模式下创建加密图fw1,序号为10
pixfirewall(config)# crypto map fw1 10 match address 101
	#配置名称为fw1,序号为10的加密图集合 与加密ACL 101相互绑定
pixfirewall(config)# crypto map fw1 10 set peer 192.168.9.5
	#保护流量转发到地址192.168.9.5
pixfirewall(config)# crypto ipsec transform-set fw5 esp-3des
	#定义变换集名称为fw5,使用ESP和3des配置IPSec变换集
pixfirewall(config)# crypto map fw1 10 set transform-set fw5
	#指定加密图使用变换集fw5
pixfirewall(config)# crypto map fw1 interface outside
	#应用到外部接口
pixfirewall(config)# no sysopt connection permit-vpn
	#禁用VPN流量自动绕过访问控制列表(ACL)检查的功能
pixfirewall(config)# show run crypto
pixfirewall(config)# show run access-group
access-group aclvpn in interface outside
pixfirewall(config)# show access-list
pixfirewall(config)# show crypto ipsec sa

There are no ipsec sas
#PIX2还没配置

防火墙PIX2部分命令

pixfirewall(config)# isakmp policy 10
pixfirewall(config-isakmp-policy)# group 1
pixfirewall(config-isakmp-policy)# lifetime 86400
pixfirewall(config-isakmp-policy)# encryption des
pixfirewall(config-isakmp-policy)# authentication pre-share
pixfirewall(config-isakmp-policy)# hash sha
pixfirewall(config-isakmp-policy)# exit
pixfirewall(config)# isakmp enable outside
pixfirewall(config)# clear configure tunnel-group 192.168.3.3
ERROR: Tunnel group 192.168.3.3 does not exist
pixfirewall(config)# isakmp key cllsse123 address 192.168.3.3
pixfirewall(config)# show run tunnel-group
pixfirewall(config)# crypto map fw1 10 ipsec-isakmp
pixfirewall(config)# crypto map fw1 10 match address 101
pixfirewall(config)# crypto map fw1 10 set peer 192.168.3.3
pixfirewall(config)# crypto ipsec transform-set fw5 esp-3des
pixfirewall(config)# crypto map fw1 10 set transform-set fw5
pixfirewall(config)# crypto map fw1 interface outside
pixfirewall(config)# no sysopt connection permit-vpn
<think>好的,用户想了解如何对银河风云交换机进行初始化配置。首先,我需要整理一下现有的引用内容,看看有没有相关的步骤。引用[2]提到了风云交换机的配置详解,特别是保存配置命令,这应该有用。引用[3]和[4]中的华为和常用交换机命令可能也有参考价值,比如显示当前配置、保存配置、设置密码等。 用户需要的是初始化配置,所以可能需要包括进入配置模式、设置主机名、配置管理IP、创建VLAN、设置密码、保存配置等步骤。引用[2]中的保存配置命令是Switch#write,而引用[3]提到华为的display current-configuration和保存配置命令,可能需要区分不同品牌的命令差异。不过银河风云交换机可能更接近通用的Cisco命令结构,比如使用enable、configure terminal等。 另外,引用[4]提到enable password用于设置非加密密码,而可能还有加密的enable secret命令。初始化时,安全设置也很重要,比如设置特权密码和远程访问密码。还要确保保存配置,避免重启后丢失,引用[2]和[3]都提到了保存配置命令。 需要检查步骤是否全面,是否覆盖了初始化所需的基本配置,比如管理IP、默认网关、SSH/Telnet访问、端口基本设置等。可能还需要提醒用户不同型号的差异,建议查看官方文档。最后,生成相关问题,帮助用户深入理解后续配置和常见问题。</think>### 银河风云交换机初始化配置操作指南 #### 1. **连接控制台端口** - 使用Console线连接交换机控制台端口PC,通过终端软件(如SecureCRT、PuTTY)设置波特率$9600$,数据位$8$,停止位$1$,无校验[^2][^3]。 #### 2. **进入特权模式** ```bash Switch> enable Switch# ``` #### 3. **清除旧配置(可选)** ```bash Switch# erase startup-config # 清除启动配置文件 Switch# reload # 重启交换机(确认后生效) ``` #### 4. **基础配置** ```bash Switch# configure terminal Switch(config)# hostname FY-SW-01 # 设置主机名 FY-SW-01(config)# interface vlan 1 FY-SW-01(config-if)# ip address 192.168.1.1 255.255.255.0 # 配置管理IP FY-SW-01(config-if)# no shutdown FY-SW-01(config)# ip default-gateway 192.168.1.254 # 设置默认网关 ``` #### 5. **安全配置** ```bash FY-SW-01(config)# enable secret your_password # 设置加密特权密码 FY-SW-01(config)# line console 0 FY-SW-01(config-line)# password console_pass # 控制台登录密码 FY-SW-01(config-line)# login FY-SW-01(config-line)# line vty 0 4 # 配置远程访问 FY-SW-01(config-line)# password telnet_pass FY-SW-01(config-line)# login ``` #### 6. **端口基础配置** ```bash FY-SW-01(config)# interface GigabitEthernet0/1 FY-SW-01(config-if)# description "Link_to_Server" FY-SW-01(config-if)# speed 1000 # 设置端口速率 FY-SW-01(config-if)# duplex full # 全双工模式 FY-SW-01(config-if)# no shutdown ``` #### 7. **保存配置** ```bash FY-SW-01# write memory # 或简写为`wr`,保存配置到启动文件[^2] Building configuration... [OK] ``` #### 8. **验证配置** ```bash FY-SW-01# show running-config # 查看当前配置 FY-SW-01# show interfaces status # 检查端口状态 ``` --- ###
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

cllsse

富✌您吉祥

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值