Cisco经典文档

当前位置: 首页Cisco经典文档PIX/ASA 7.x 及更高版本: 多上下文(Multiple Context )配置示例


PIX/ASA 7.x 及更高版本: 多上下文(Multiple Context )配置示例

            

 

                                                       文档下载:

切换至英文原版


 

内容

前言
前提条件
      需求
      使用的组件
      相关产品
      惯例
背景信息
      上下文配置文件
      安全上下文的管理访问
配置
      网络图
      启用或禁用多上下文模式
      配置安全上下文
      ASA 8.x - 系统执行空间配置
      在上下文和系统执行空间之间切换
      ASA - Context1 配置
      ASA - Context2 配置
      在多上下文模式中保存配置更改
验证
故障排除
      还原单一上下文模式
      在多上下文模式下向共享接口分配相同的 IP 地址
      重命名上下文
      删除上下文
 


前言

本文档介绍了在安全设备中配置多上下文的步骤。

您可以将单个安全设备划分为多个虚拟设备(称为安全上下文)。 每个上下文都是一个独立的设备,有自己的安全策略、接口和管理员。 多个上下文类似于多个独立设备。 多上下文模式支持许多功能,包括路由表、防火墙功能、IPS 和管理功能。 但不支持某些功能,包括 VPN 和动态路由协议。

可以在下列情况下使用多安全上下文:

  • 您是服务提供商,想要向多个客户出售安全服务。 在安全设备上启用多个安全上下文后,便可以实施一个经济的、节省空间的解决方案,该解决方案将所有客户数据流彼此分开且保证安全,同时简化了配置。

  • 您是大型企业或大学校园,希望使各部门完全保持独立。

  • 您是一个企业,想要为不同部门提供不同的安全策略。

  • 您拥有任何需要多个安全设备的网络。

注意: 在多上下文模式下,您仅可以在 System EXEC 模式中对 PIX/ASA 软件进行升级或降级,在其他上下文模式中都不可以。

有关防火墙服务模块 (FWSM) 中多上下文配置步骤的详细信息,请参阅 FWSM: 多上下文配置示例

前提条件

需求

本文档没有任何特定的要求。

使用的组件

本文档中的信息基于以下软件和硬件版本:

  • Cisco 5500 系列自适应安全设备(运行软件版本 7.x 及更高版本)。

    注意: ASA 5505 系列自适应安全设备不支持多上下文功能。

本文档中的信息都是基于特定实验室环境中的设备创建的。 本文档中使用的所有设备最初均采用原始(默认)配置。 如果您在一个工作网络中操作,在使用之前请确认您已经理解所有指令的潜在影响。

相关产品

此配置还可用于 Cisco PIX 500 系列安全设备版本 7.x 及更高版本。

惯例

有关文档规则的详细信息,请参阅 Cisco 技术提示规则

背景信息

上下文配置文件

上下文配置

安全设备为每个上下文均提供一个配置,以标识安全策略、接口和几乎所有可在独立设备上配置的选项。 您可以在内部闪存或外部闪存卡上存储上下文配置,也可以从 TFTP、FTP 或 HTTP 服务器下载它们。

系统配置

系统管理员通过配置每个上下文配置的位置、分配的接口和系统配置中的其他上下文操作参数来添加并管理上下文,系统配置与单一模式配置类似,是启动配置。 系统配置标识安全设备的基本设置。 系统配置不包括本身的任何网络接口或网络设置; 相反,当系统需要访问网络资源(例如从服务器下载上下文)时,它会使用其中一个被指定为管理上下文的上下文。 系统配置包括一个仅用于对数据流进行故障切换的专用故障切换接口。

管理上下文配置

管理上下文与其他任何上下文类似,不同之处在于当用户登录管理上下文后,该用户将具有系统管理员权限,并且能够访问系统和所有其他上下文。 管理上下文不受任何形式的限制,可用作常规上下文,但由于登录到管理上下文后即具有对所有上下文的管理员权限,因此您需要对管理上下文的访问权限进行限制,仅允许适当用户对其进行访问。 管理上下文必须驻留在闪存中,不能驻留在远程位置。

如果您的系统已处于多上下文模式中,或者您从单一模式转换,则管理上下文会自动创建为内部闪存上的一个称作 admin.cfg 的文件。 此上下文名为“admin”。 如果不希望将 admin.cfg 作为管理上下文,则可以更改管理上下文。

注意: 管理上下文不计入上下文许可证。 例如,如果获得两个上下文的许可证,则您可以拥有管理上下文和其他两个上下文。

安全上下文的管理访问

安全设备提供多上下文模式下的系统管理员访问权限以及单独的上下文管理员访问权限。 以下各部分介绍以系统管理员或上下文管理员身份登录:

系统管理员访问

作为系统管理员访问安全设备的方式有以下两种:

  • 访问安全设备控制台。

    从控制台访问系统执行空间。

  • 使用 Telnet、SSH 或 ASDM 访问管理上下文。

    请参阅“管理系统访问”,以启用 Telnet、SSH 和 SDM 访问。

作为系统管理员,您可以访问所有上下文。

从管理上下文或系统切换到某个上下文时,您的用户名将更改为默认的“enable_15”用户名。 如果该上下文中已配置命令授权,则您需要为“enable_15”用户配置授权权限,也可以使用该上下文的命令授权配置中提供有足够权限的其他名称进行登录。 输入 login 命令以使用用户名登录。 例如,使用用户名“admin”登录到管理上下文。 管理上下文没有任何命令授权配置,但所有其他上下文均包括命令授权。 为方便起见,每个上下文配置均包括一个具有最大权限的用户“admin”。 从管理上下文切换到上下文 A 时,您的用户名发生更改,因此您必须再次使用 login 命令以“admin”身份登录。 切换到上下文 B 时,必须再次输入 login 命令以“admin”身份登录。

系统执行空间不支持任何 AAA 命令,但您可以配置其自身的启用口令以及在本地数据库中配置用户名,以便提供单独登录。

上下文管理员访问

您可以使用 Telnet、SSH 或 ASDM 访问上下文。 如果您登录到非管理上下文,则只能访问该上下文的配置。 您可以提供对上下文的单独登录。

配置

本部分提供有关如何配置本文档中所述功能的信息。

注意: 使用命令查找工具仅限注册用户)可获取有关本部分所使用命令的详细信息。

网络图

本文档使用以下网络设置:

/image/gif/paws/99131/multiple-context1.gif

注意: 交换机上连接到 ASA 的端口必须处于中继模式,因为一旦 ASA 接口被划分为多个子接口,多个 VLAN 数据流将必须通过该交换机进行传输。

启用或禁用多上下文模式

您的安全设备可能已配置多个安全上下文,具体取决于您通过什么方式从 Cisco 订购该安全产品,但如果您采取的是升级方式,则可能需要从单一模式转换为多模式。 本部分介绍了升级的操作过程。 ASDM 不支持模式的更改,因此您需要使用 CLI 更改模式。

当您从单一模式转换为多模式时,安全设备会将运行配置转换为两个文件。 将不保存原始启动配置,因此如果它与运行配置有所不同,则在操作前必须备份原始启动配置。

启用多上下文模式

即使经过重新启动,上下文模式(单一模式或多模式)也不会存储在配置文件中。 如果您需要将配置复制到另一个设备,请使用 mode 命令设置新设备上的模式以匹配。

当您从单一模式转换为多模式时,安全设备会将运行配置转换为两个文件: 一个包含系统配置的新启动配置以及包含管理上下文的 admin.cfg(位于内部闪存的根目录下)。 原始运行配置保存为 old_running.cfg(位于内部闪存的根目录中)。 将不保存原始启动配置。 安全设备将自动向系统配置中为管理上下文添加一个名为“admin”的条目。

要启用多模式,请输入以下命令:

hostname(config)# mode multiple

系统将提示您重新启动安全设备。

CiscoASA(config)# mode multiple
WARNING: This command will change the behavior of the device
WARNING: This command will initiate a Reboot
Proceed with change mode? [confirm]
Convert the system configuration? [confirm]
!
The old running configuration file will be written to flash

The admin context configuration will be written to flash

The new running configuration file was written to flash
Security context mode: multiple

***
*** --- SHUTDOWN NOW ---
***
*** Message to all terminals:
***
***   change mode

Rebooting....

Booting system, please wait...
*
*
!--- output suppressed

*
*
INFO: Admin context is required to get the interfaces
*** Output from config line 20, "arp timeout 14400"
Creating context 'admin'... Done. (1)
*** Output from config line 23, "admin-context admin"

Cryptochecksum (changed): a219baf3 037b31b4 09289829 1ab9790a

*** Output from config line 25, "  config-url flash:/admi..."

Cryptochecksum (changed): d4f0451b 405720e1 bbccf404 86be061c
Type help or '?' for a list of available commands.
CiscoASA>

重新启动后,ASA 的默认配置如下所示:

ASA 8.x 默认配置

CiscoASA# show running-config
: Saved
:
ASA Version 8.0(2) <system>
!
hostname CiscoASA
enable password 8Ry2YjIyt7RRXU24 encrypted
no mac-address auto
!
interface Ethernet0/0
shutdown
!
interface Ethernet0/1
shutdown
!
interface Ethernet0/2
 shutdown
!
interface Ethernet0/3
 shutdown
!
interface Management0/0
 shutdown
!
class default
  limit-resource All 0
  limit-resource ASDM 5
  limit-resource SSH 5
  limit-resource Telnet 5
!

ftp mode passive
pager lines 24
no failover
asdm image disk0:/asdm-602.bin
no asdm history enable
arp timeout 14400
console timeout 0

admin-context admin
context admin
   config-url disk0:/admin.cfg
!
!--- admin context is created
!--- by default once you enable 
!--- multiple mode


prompt hostname context
Cryptochecksum:410be16e875b7302990a831a5d91aefd
: end

 

 

配置安全上下文

系统配置中的安全上下文定义用于标识上下文名称、配置文件 URL 以及上下文可以使用的接口。

注意: 如果您没有管理上下文(例如,如已清除配置),则在输入以下命令时必须首先指定管理上下文名称:

hostname(config)# admin-context <name>

注意: 虽然您的配置中尚不存在此上下文名称,但可随后输入 context name 命令以便与指定的名称匹配,从而继续配置管理上下文。

若要在系统配置中添加或更改上下文,请执行以下步骤:

  1. 若要添加或修改上下文,请在系统执行空间中输入以下命令:

    hostname(config)# context <name>
    

    该名称是一个最大长度为 32 个字符的字符串。 该名称区分大小写,因此,您可以有两个分别名为“customerA”和“CustomerA”的上下文。 您可以使用字母、数字或连字符,但名称不能以连字符开始或结束。

    “System”或“Null”(大写或小写字母)是保留名称,不能使用。

  2. (可选)若要添加此上下文的说明,请输入以下命令:

    hostname(config-ctx)# description text
    
    
  3. 若要指定上下文中可以使用的接口,请输入适用于物理接口或适用于一个或多个子接口的命令。

    • 若要分配物理接口,请输入以下命令:

      hostname(config-ctx)# allocate-interface 
      <physical_interface> [mapped_name] 
      [visible | invisible]
      
    • 若要分配一个或更多子接口,请输入以下命令:

      hostname(config-ctx)# allocate-interface 
      <physical_interface.subinterface[-physical_interface.subinterface]>
      [mapped_name[-mapped_name]] [visible | invisible]
      

      您可以多次输入这些命令以指定不同的范围。 如果使用此命令的 no 形式删除某个接口分配,则所有包含该接口的上下文命令都将从运行配置中删除。

  4. 要标识系统下载上下文配置的 URL,请输入以下命令:

    hostname(config-ctx)# config-url url
    
    

    注意: 先输入 allocate-interface 命令,然后再输入 config-url 命令。 在加载上下文配置之前,安全设备必须向上下文分配接口; 上下文配置可以包括引用接口的命令(interface、nat、global 等)。 如果先输入 config-url 命令,安全设备将立即加载上下文配置。 如果上下文包含任何引用接口的命令,则这些命令将失败。

在这种情况下,请遵循表中的步骤配置多上下文。

有两个客户,Customer A 和 Customer B。在单个 ASA 框中创建三个多上下文(实际上是三个 ASA),例如 Context1 用于 Customer A、Context2 用于 Customer B,而 Admin Context 用于管理 ASA 上下文。

为每个上下文创建两个子接口,分别用于内部连接和外部连接。 为每个子接口分配不同的 VLAN。

在以太网 0/0 中创建两个子接口 - 以太网 0/0.1 和以太网 0/0.2,分别用于 context1 和 context2 的外部连接。 同样,在以太网 0/1 中创建两个子接口 - 以太网 0/1.1 和以太网 0/1.2,分别用于 context1 和 context2 的内部连接。

为每个子接口分配 VLAN,例如为以太网 0/0.1 分配 VLAN 2,为以太网 0/1.1 分配 VLAN3,为以太网 0/0.2 分配 VLAN 4,为以太网 0/1.2 分配 VLAN5。

ASA 多上下文配置步骤

:

!--- Outside interface for context1 and context2.
!--- Create the sub interface in 
!--- outside interface for context1 and context2.


ciscoasa(config)# interface Ethernet0/0
ciscoasa(config-if)# no shutdown

!--- Inside interface for context1 and context2.
!--- Create the sub interface in 
!--- inside interface for context1 and context2.


ciscoasa(config)# interface Ethernet0/1
ciscoasa(config-if)# no shutdown


!--- Outside interface for admin context 
!--- to access the ASA from outside network
!--- using telnet or SSH.


ciscoasa(config-if)# interface Ethernet0/2
ciscoasa(config-if)# no shutdown
ciscoasa(config-if)# vlan 6


!--- Inside interface for admin context 
!--- to access the ASA from inside network
!--- using telnet or SSH.


ciscoasa(config-if)# interface Ethernet0/3
ciscoasa(config-if)# no shutdown
ciscoasa(config-if)# vlan 7


!--- Context1 outside subinterface

ciscoasa(config-subif)# interface Ethernet0/0.1
ciscoasa(config-subif)# vlan 2

!--- !--- Context1 inside subinterface

ciscoasa(config-subif)# interface ethernet 0/1.1
ciscoasa(config-subif)# vlan 3

!--- !--- Context2 outside subinterface

ciscoasa(config-subif)# interface ethernet 0/0.2
ciscoasa(config-subif)# vlan 4

!--- !--- Context2 inside subinterface

ciscoasa(config-subif)# interface ethernet 0/1.2
ciscoasa(config-subif)# vlan 5

!--- Customer A Context as Context1


ciscoasa(config)# context context1
Creating context 'context1'... Done. (3)
ciscoasa(config-ctx)# allocate-interface 
   Ethernet0/0.1 outside-context1
ciscoasa(config-ctx)# allocate-interface 
   Ethernet0/1.1 inside-context1

!--- To specify the interfaces 
!--- used for the context1

ciscoasa(config-ctx)# config-url disk0:/context1.cfg

!--- To identify the URL from which the 
!--- system downloads the context configuration.


ciscoasa(config-ctx)# exit

!--- Customer B Context as Context2


ciscoasa(config)# context context2
Creating context 'context2'... Done. (3)
ciscoasa(config-ctx)# allocate-interface 
   Ethernet0/0.2 outside-context2
ciscoasa(config-ctx)# allocate-interface 
   Ethernet0/1.2 inside-context2
ciscoasa(config-ctx)# config-url 
   disk0:/context2.cfg

ciscoasa(config)# context admin
ciscoasa(config-ctx)# allocate-interface Ethernet0/2 outside
ciscoasa(config-ctx)# allocate-interface Ethernet0/3 inside


 

 

ASA 8.x - 系统执行空间配置

ASA 8.x - 系统执行空间配置

ciscoasa# sh run


ASA Version 8.0(2) <system>
!
hostname ciscoasa
enable password 8Ry2YjIyt7RRXU24 encrypted
mac-address auto
!
interface Ethernet0/0
!
interface Ethernet0/0.1
 vlan 2
!
interface Ethernet0/0.2
 vlan 4
!
interface Ethernet0/1
!
interface Ethernet0/1.1
 vlan 3
!
interface Ethernet0/1.2
 vlan 5
!
interface Ethernet0/2
!
interface Ethernet0/3
!
interface Management0/0
 shutdown
!
class default
  limit-resource All 0
  limit-resource ASDM 5
  limit-resource SSH 5
  limit-resource Telnet 5
!

ftp mode passive
pager lines 24
no failover
no asdm history enable
arp timeout 14400
console timeout 0


admin-context admin
context admin
  allocate-interface Ethernet0/2 outside
  allocate-interface Ethernet0/3 inside
  config-url disk0:/admin.cfg
!


context context1
  allocate-interface Ethernet0/0.1 outside-context1
  allocate-interface Ethernet0/1.1 inside-context1
  config-url disk0:/context1.cfg
!

context context2
  allocate-interface Ethernet0/0.2 outside-context2
  allocate-interface Ethernet0/1.2 inside-context2
  config-url disk0:/context2.cfg
!

prompt hostname context
Cryptochecksum:9e8bc648b240917631fa5716a007458f
: end

 

 

在上下文和系统执行空间之间切换

如果登录到系统执行空间(或者使用 Telnet 或 SSH 登录到管理上下文),则可以在上下文之间切换,并在每个上下文中执行配置和监控任务。 您在配置模式中编辑的运行配置或者在 copy 或 write 命令中使用的运行配置取决于您的位置。 当您处于系统执行空间中时,运行配置仅包含系统配置; 当您位于上下文中时,运行配置仅包括相应的上下文。 例如,如果您输入 show running-config 命令,则并不能查看所有运行配置(系统和所有上下文)。 将仅显示当前配置。

若要在系统执行空间和上下文之间切换,或者在上下文之间切换,请参考以下这些命令:

  • 若要切换到上下文,请输入以下命令:

    hostname# changeto context <context name>
    

    提示将更改为:

    hostname/name#
    
  • 若要切换到系统执行空间,请输入以下命令:

    hostname/admin# changeto system
    

    提示将更改为:

    hostname#
    

ASA - Context1 配置

若要配置 context1,请切换到 context1 并按照以下过程执行操作:


!--- From the system execution space, 
!--- enter the command
!--- "changeto context context1 
!--- to configure the context1 configuration"

ciscoasa(config)# changeto context context1
ciscoasa/context1(config)#

ASA 8.x - Context1 默认配置

ciscoasa/context1(config)# show run


!--- Default configuration of the context1



ASA Version 8.0(2) <context>
!
hostname context1
enable password 8Ry2YjIyt7RRXU24 encrypted
names
!
interface outside-contex1
 no nameif
 no security-level
 no ip address
!
interface inside-contex1
 no nameif
 no security-level
 no ip address
!
passwd 2KFQnbNIdI.2KYOU encrypted
pager lines 24
icmp unreachable rate-limit 1 burst-size 1
no asdm history enable
arp timeout 14400
timeout xlate 3:00:00
timeout conn 1:00:00 half-closed 
   0:10:00 udp 0:02:00 icmp 0:00:02
timeout sunrpc 0:10:00 h323 0:05:00 h225 
   1:00:00 mgcp 0:05:00 mgcp-pat 0:05:00
timeout sip 0:30:00 sip_media 0:02:00 sip-invite 
   0:03:00 sip-disconnect 0:02:00
timeout uauth 0:05:00 absolute
no snmp-server location
no snmp-server contact
no crypto isakmp nat-traversal
telnet timeout 5
ssh timeout 5
!
class-map inspection_default
 match default-inspection-traffic
!
!
policy-map type inspect dns preset_dns_map
 parameters
  message-length maximum 512
policy-map global_policy
 class inspection_default
  inspect dns preset_dns_map
  inspect ftp
  inspect h323 h225
  inspect h323 ras
  inspect netbios
  inspect rsh
  inspect rtsp
  inspect skinny
  inspect esmtp
  inspect sqlnet
  inspect sunrpc
  inspect tftp
  inspect sip
  inspect xdmcp
!
service-policy global_policy global
Cryptochecksum:00000000000000000000000000000000
: end

 

 

客户 A 的 Internet 连接配置。

ASA 8.x - Context1 的配置


!--- Configuring Context1 for customer A


ciscoasa/context1# conf t
ciscoasa/context1(config)# int outside-context1
ciscoasa/context1(config-if)# ip add 10.1.1.1 255.255.255.0
ciscoasa/context1(config-if)# no shutdown
ciscoasa/context1(config-if)# nameif outside
INFO: Security level for "outside" set to 0 by default.

ciscoasa/context1(config-if)# int inside-context1
ciscoasa/context1(config-if)# ip add 172.16.1.1 255.255.255.0
ciscoasa/context1(config-if)# no shutdown
ciscoasa/context1(config-if)# nameif inside
INFO: Security level for "inside" set to 100 by default.
ciscoasa/context1(config-if)# exit

ciscoasa/context1(config)# access-list outbound permit ip any any
ciscoasa/context1(config)# nat (inside-context1) 1 access-list outbound
ciscoasa/context1(config)# global (outside-context1) 1 interface
INFO: outside interface address added to PAT pool
ciscoasa/context1(config)# route outside-context1 0.0.0.0 0.0.0.0 10.1.1.2
ciscoasa/context1(config)# exit

 

 

ASA 8.x - Context1 配置

ciscoasa/context1(config)# show run

ciscoasa/context1# sh run
: Saved
:
ASA Version 8.0(2) <context>
!
hostname context1
enable password 8Ry2YjIyt7RRXU24 encrypted
names
!
interface outside-context1
 nameif outside
 security-level 0
 ip address 10.1.1.1 255.255.255.0
!
interface inside-context1
 nameif inside
 security-level 100
 ip address 172.16.1.1 255.255.255.0
!
passwd 2KFQnbNIdI.2KYOU encrypted
access-list outbound extended permit ip any any
pager lines 24
mtu outside 1500
mtu inside 1500
icmp unreachable rate-limit 1 burst-size 1
no asdm history enable
arp timeout 14400

global (outside-context1) 1 interface
nat (inside-context1) 1 access-list outbound
route outside-context1 0.0.0.0 0.0.0.0 10.1.1.2 1


!--- Output Suppressed

!
!
policy-map type inspect dns preset_dns_map
 parameters
  message-length maximum 512
policy-map global_policy
 class inspection_default
  inspect dns preset_dns_map
  inspect ftp
  inspect h323 h225
  inspect h323 ras
  inspect netbios
  inspect rsh
  inspect rtsp
  inspect skinny
  inspect esmtp
  inspect sqlnet
  inspect sunrpc
  inspect tftp
  inspect sip
  inspect xdmcp
!
service-policy global_policy global
Cryptochecksum:00000000000000000000000000000000
: end
ciscoasa/context1#

 

 

ASA - Context2 配置

客户 B 的 Internet 连接配置。

若要配置 context2,请从 context1 切换到 context2:


!--- From the system execution space, enter the command
!--- "changeto context context2
---to configure the context2 configuration"

ciscoasa/context1(config)# changeto context context2
ciscoasa/context2(config)#

ASA 8.x - Context2 配置

ciscoasa/context2(config)# show run
ASA Version 8.0(2) <context>
!
hostname context2
enable password 8Ry2YjIyt7RRXU24 encrypted
names
!
interface inside-context2
 nameif inside
 security-level 100
 ip address 172.17.1.1 255.255.255.0
!
interface outside-context2
 nameif outside
 security-level 0
 ip address 10.2.2.1 255.255.255.0
!

!--- Output Suppressed

!
access-list outbound extended permit ip any any
pager lines 24
mtu outside 1500
mtu inside 1500
icmp unreachable rate-limit 1 burst-size 1
no asdm history enable
arp timeout 14400

global (outside-context2) 1 interface
nat (inside-context2) 1 access-list outbound
route outside-context2 0.0.0.0 0.0.0.0 10.2.2.2 1


!--- Output Suppressed

!
!
policy-map type inspect dns preset_dns_map
 parameters
  message-length maximum 512
policy-map global_policy
 class inspection_default
  inspect dns preset_dns_map
  inspect ftp
  inspect h323 h225
  inspect h323 ras
  inspect netbios
  inspect rsh
  inspect rtsp
  inspect skinny
  inspect esmtp
  inspect sqlnet
  inspect sunrpc
  inspect tftp
  inspect sip
  inspect xdmcp
!
service-policy global_policy global
Cryptochecksum:00000000000000000000000000000000
: end

 

 

以同样方式配置管理上下文以便从内部和外部接口管理 ASA 及其上下文。

在多上下文模式中保存配置更改

您可以分别保存每个上下文(和系统)配置,也可以同时保存所有上下文配置。 本部分包括以下主题:

分别保存每个上下文和系统

若要保存系统或上下文配置,请在系统或上下文中输入以下命令:

hostname# write memory

注意: copy running-config startup-config 命令与 write memory 命令等效。

对于多上下文模式,上下文启动配置可以驻留在外部服务器上。 在这种情况下,安全设备会将配置保存回您在上下文 URL(HTTP 或 HTTPS URL 除外,它们不让您将配置保存到服务器)中标识的服务器。

同时保存所有上下文配置

若要同时保存所有上下文配置以及系统配置,请在系统执行空间中输入以下命令:

hostname# write memory all [/noconfirm]

如果不输入 /noconfirm 关键字,则会看到以下提示:

Are you sure [Y/N]:

验证

使用本部分可确认配置能否正常运行。

命令输出解释程序工具仅限注册用户)(OIT) 支持某些 show 命令。 使用 OIT 可查看对 show 命令输出的分析。

  • show flash — 验证上下文配置文件是否存储在闪存中。

  • show mode — 验证 ASA 是配置为单一模式还是多模式。

ciscoasa# sh flash
--#--  --length--  -----date/time------  path
   71  14524416    Jul 23 2007 23:11:22  asa802-k8.bin
   75  6889764     Jul 23 2007 23:32:16  asdm-602.bin
    2  4096        Jul 23 2007 23:51:36  log
    6  4096        Jul 23 2007 23:51:48  crypto_archive
   76  2635734     Aug 12 2007 22:44:50  anyconnect-win-2.0.0343-k9.pkg
   77  1841        Sep 20 2007 04:21:38  old_running.cfg
   78  1220        Sep 20 2007 04:21:38  admin.cfg

ciscoasa/context2# sh mode
Security context mode: multiple

故障排除

还原单一上下文模式

如果您从多模式转换到单一模式,则可首先将完全启动配置(如果存在)复制到安全设备; 从多模式继承的系统配置不是单一模式设备的完全有效配置。 由于系统配置没有将任何网络接口作为其配置的一部分,因此,您必须从控制台访问安全设备以执行复制。

若要将旧的运行配置复制到启动配置并将模式更改为单一模式,请在系统执行空间中执行以下步骤:

  1. 若要将原始运行配置的备份版本复制到当前启动配置,请在系统执行空间中输入以下命令:

    hostname(config)# copy flash:old_running.cfg startup-config
    
    
  2. 若要将模式设置为单一模式,请在系统执行空间中输入以下命令:

    hostname(config)# mode single
    

安全设备将重新启动。

在多上下文模式下向共享接口分配相同的 IP 地址

您可以向不同上下文中的共享接口分配相同的 IP 地址。 虽然可以这样,但必须在每个上下文中为该接口分配单独的 MAC 地址,以便对进入上下文的数据流进行分类,如下所示。

注意:  如果管理员不希望手动分配 MAC 地址,则可以使用命令 mac-address auto。 此命令将自动为所有接口(包括子接口)分配 MAC 地址。

<system context configuration>
interface Ethernet0
!
interface Ethernet0.1
 vlan 2
!
interface Ethernet0.2
 vlan 3
!

<context1 configuration>
!
interface Ethernet0.1
mac-address 0000.0707.0000


!--- MAC address must be unique


nameif inside
 security-level 100
 ip address 192.168.0.1 255.255.255.0
!

<context2 configuration>
!
interface Ethernet0.2
mac-address 0000.0808.0000


!--- MAC address must be unique


nameif inside
 security-level 100
 ip address 192.168.0.1 255.255.255.0
!

重命名上下文

在多上下文模式中,不支持在不更改配置的情况下重命名上下文。

您可以将配置保存为防火墙配置,但需要将整个配置复制到新的上下文名称,并删除旧的上下文配置。

删除上下文

从系统空间发出此命令以删除上下文:

  
no context contA 

另外,请确保删除相关上下文的对应配置文件。

dir disk:
 
delete disk:/contA.cfg

 

 

注:本人能力有限,如遇不足之处,还请指正!

China-CCIE  QQ交流群:106155045   点击与作者QQ交谈