网络配置 CLI 命令

使用网络配置 CLI 命令来设置 IP 地址,处理绑定和故障转移,处理辅助功能以及重置网络。

使用网络配置 CLI 命令来执行以下任务:
  • 识别机器背面的接口 (show network interface port)。
  • 安装或移动网卡 (store network interface reset) 后重置网络。
  • 设置 IP 地址 (store network interface ipstore network interface maskstore network resolverstore network routes)。
  • 启用或禁用高可用性 (store network interface high-availability)。
  • 如果它所连接的交换机未自动协商设置 (store network interface auto-negotiationstore network interface speedstore network interface duplex) ,请配置网卡。

Guardium 使用可预测的网络接口名称。 主网络接口是在安装期间设置的,可以使用 store network interface role 命令进行更改。

restart network

仅重新启动网络配置。 例如,更改 IP 地址,然后运行此 CLI 命令。

语法
restart network

show network interface all

此命令显示用于将 Guardium ® 设备连接到桌面 LAN 的网络接口的设置。 此命令显示 IP 地址、掩码、状态(启用或禁用)和高可用性状态。 如果已启用 IP 高可用性,那么系统会显示两个接口。 否则,仅显示一个界面。

语法

show network interface all

show network interface inventory

使用 show 命令来显示所有已安装网络接口的端口名称和 MAC 地址。

语法

show network interface inventory

示例

CLI> show network interface inventory
Current network card configuration:
Device     | Mac Address        | Member of
--------------------------------------------
ens32      | 00:50:56:B8:18:75  |
ens33      | 00:50:56:3b:c3:73  |
ens34      | 00:50:56:8a:0d:fb  |
ok

Member of列显示绑定对中的 NIC (如果存在绑定)。

show network routes operational

显示正在使用的 IP 路由配置。

语法
show network routes operational

示例

CLI> show net rout operational
Kernel IP routing table
Destination Gateway Genmask
Flags Metric Ref Use Iface
192.168.3.0 0.0.0.0 255.255.255.0
U 0 0 0 nic1
169.254.0.0 0.0.0.0 255.255.0.0 U 0 0 0 nic2
0.0.0.0
192.168.3.1 0.0.0.0 UG 0 0 0 nic1
确定

show network verify

显示当前网络配置。

语法
show network verify
CLI> show network verify
Current Network Configuration
------------------------------------------------------------------------------------------------------------------------
Hostname = test_system.guardium.ibm.com
------------------------------------------------------------------------------------------------------------------------
Device     | Address                                    | Prefix     | Gateway                                    | Member of
------------------------------------------------------------------------------------------------------------------------
ens256     | --                                         | None       | --                                         | br3
--         | --                                         | None       | --                                         | --
ens224     | --                                         | None       | --                                         | br2
--         | --                                         | None       | --                                         | --
ens160     | --                                         | None       | --                                         | br0
--         | --                                         | None       | --                                         | --
ens34      | 9.70.165.96                                | 24         | 9.70.165.1                                 | --
--         | 2002:920:c000:3165:9:70:165:96             | 64         | --                                         | --
ens192     | --                                         | None       | --                                         | br1
--         | --                                         | None       | --                                         | --
------------------------------------------------------------------------------------------------------------------------
Ethtool Options
------------------------------------------------------------------------------------------------------------------------
Device     | Options (speed,autoneg,duplex)
------------------------------------------------------------------------------------------------------------------------
ens256     |
ens224     |
ens160     |
ens34      |
ens192     |
------------------------------------------------------------------------------------------------------------------------
DNS Servers
------------------------------------------------------------------------------------------------------------------------
Index      | DNS Server
------------------------------------------------------------------------------------------------------------------------
1          | 9.32.193.11
------------------------------------------------------------------------------------------------------------------------
Static Routes
------------------------------------------------------------------------------------------------------------------------
Device     | Index      | Address                                    | Prefix     | Gateway
------------------------------------------------------------------------------------------------------------------------
ens34      | 0          | 9.32.145.0                                 | 24         | 9.32.145.1
------------------------------------------------------------------------------------------------------------------------

store network interface auto-negotiation

如果在与 Guardium 端口连接的交换机上提供了自动协商,那么将使用自动协商,并且仅此命令的重新启动选项具有任何效果。 使用此命令对指定的网络接口 (NIC) 启用、禁用或重新启动自动协商。 使用 show network interface inventory 来显示所有端口名。

语法

store network interface auto-negotiation <NIC> <on | off | restart>

show 命令

show network interface auto-negotiation

store network interface duplex

仅当自动协商在 Guardium 端口所连接的交换机上不可用时,才使用此命令。 此命令对端口配置双工方式。 使用 show network interface inventory 命令来显示所有端口名称。

语法

store network interface duplex <NIC> <half | full>

show 命令

show network interface duplex <NIC>

store network interface high-availability

启用或禁用 IP 团队 (也称为绑定) ,这将为 Guardium 系统主 IP 地址提供故障转移功能。

所使用的两个端口 (主接口和辅助接口) 必须连接到同一网络。 如果交换机需要重新学习端口配置,那么可能会发生轻微延迟。 缺省设置为 off。

启用高可用性选项后, Guardium 系统会根据需要自动故障转移到指定的辅助接口,这会将主 IP 地址传输到辅助接口。

注: 您可以指定 IP 团队和辅助接口,但不能同时指定两者。
语法
store network interface high-availability [on <NIC> [mode <1|4>]|off] ]
如果启用了高可用性,您可以选择指定 NIC 方式,这可以是:
  • 1 - 主动备份 - 使用活动备份策略提供故障容错功能。
  • 4 - lacp/802.3ad - 根据 802.3ad 规范提供负载均衡和容错。

store network interface ip

设置 Guardium 设备采用 CIDR (无类域间路由) 格式的主 IP 地址。 更改网络接口 IP 地址时,可能需要更改子网掩码。 有关更多信息,请参阅store network interface mask

请参阅 store network interface secondary 来创建和管理辅助 IP 地址。 通过 store network interface high-availability CLI 命令来管理绑定或故障转移。

语法

store network interface ip <ip address>

store network interface mask

为主 IP 地址设置子网掩码。 如果更改网络接口掩码,那么可能还需要更改其 IP 地址。 请参阅 store network interface ip
注意: 辅助 IP 地址的子网掩码只能通过设置 > 工具和视图 > 系统进行分配。
注: 此命令仅支持 IPv4 地址。

语法

store network interface mask <ip mask>

store network interface mtu

使用此 CLI 命令来设置最大传输单元 (MTU)。

CLI> store network interface mtu
Usage: store network interface mtu <interface> <mtu>]

其中, interface 是接口名称 (ens32) , mtu 是传输单元数 (介于 1000 到 9000 之间)。

show 命令

show network interface mtu 

show network interface port

使用此命令来查找设备背面上的物理连接器。 使用 show network interface inventory显示所有端口名后,使用此命令将 NIC 指定的物理端口上的指示灯闪烁 20 次 (例如, ens32)。

语法

show network interface port <nic>

示例

CLI> show network interface port ens32
The orange light on interface ens32 will now blink 20 times.

store network interface reset

使用此 CLI 命令可以擦除现有的操作系统网络配置。 此命令还会检测并构建 Guardium 设备中板载 NIC 卡的配置。

语法

CLI> store network interface reset
WARNING: This command will clear existing network interface configuration.
Network will be disconnected due to this operation.
Are you SURE you want to continue? (y/n)

store network interface restore

使用此命令可以从 Guardium 数据库设置复原所有网络设置。 例如,当补丁在网络配置中引入错误时,复原设置可能非常有帮助。 在这种情况下,数据库中的信息仍正确,您可以快速复原所有设置。
注: 静态路由设置不会保存在数据库中,也不会复原。

语法

CLI> store network interface restore
WARNING: This command will overwrite the network configuration with the stored Guardium network settings.
         It may disconnect your current ssh session.
Are you SURE you want to continue? (y/n)

store network interface role

使用此命令可以向物理网络接口分配角色。 网络接口角色可以是主角色、辅助角色或无角色(未定义)。 使用“未定义”(undef) 可清除当前设置为 secondary 的接口角色。
注意: store network interface role <NIC> <undef> 不会禁用辅助网络接口卡 (NIC)。

语法

store network interface role <NIC> <undef | primary | secondary>

show 命令

show network interface role

store network interface secondary

使用此命令可将 Guardium 系统上的端口配置为具有与主服务器不同的 IP 地址,网络掩码和网关的辅助管理接口。

注: 不能同时使用 IP 团队和辅助接口。
语法
store network interface secondary [on <interface> <ip[/prefix]> <gateway> | off [ipv4|ipv6]]
位置
  • interface 是有效的接口。
  • ipgateway 是有效的 IP 地址。
  • /prefix 是 CIDR 中的 IP 地址前缀长度。 /prefix 为可选项。 对于 IPv4,缺省值为 24,对于 IPv6,缺省值为 64。
  • ipv4ipv6 是 IP 版本。

show 命令

show network interface secondary

store network interface speed

仅当自动协商在 Guardium 端口所连接的交换机上不可用时,才使用此命令。 此命令配置端口的速度设置。 使用 show network interface inventory 命令来显示所有端口名称。

语法

store network interface speed <NIC> <auto | 10 | 100 | 1000>

show 命令

show network interface speed <NIC>

show network interface status

使用此命令可显示网络接口的物理链路状态。

语法

show network interface status <NIC>

示例

show network interface status ens32
Network Interface Status
        Link detected: yes
ok

show network arp-table

显示地址解析协议 (ARP) 表,它是可操作系统值。 此命令仅用于支持。

语法

show network arp-table

示例

CLI> sho net arp
IP address
HW type Flags HW address Mask Device
192.168.3.1 0x1 0x2 00:0E:D7:98:07:7F * nic1
192.168.3.20 0x1 0x2 00:C0:9F:40:33:30 * nic1
确定
CLI>

show network macs

显示 MAC 地址列表(类似于 show network interface inventory 命令)。

语法

show network macs

示例

CLI> show network macs

ens32:     00:50:56:b8:18:75
lo:        00:00:00:00:00:00

store network resolvers

设置 Guardium 设备要使用的第一个,第二个或第三个 DNS 服务器的 IP 地址。 每个解析器地址都必须唯一。

语法

store network resolvers <IP address 1 [IP address 2] [IP address 3] | null>
请最多输入三个以空格分隔的 IP 地址。 要移除 DNS 服务器,请输入 null
注: 此命令将替换现有 DNS 设置。
例如,
  • IPv4
    store network resolvers 192.0.2.0 192.0.2.1 192.0.2.2
    This change will take effect after restart network.
    ok
    
  • IPv6
    store network resolvers 2001:0DB8:0:0:0:0:0:0 2001:0DB8:0:0:0:0:0:1 2001:0DB8:0:0:0:0:0:3
    This change will take effect after restart network.
    ok
    
  • 双方式(IPv4 和 IPv6)
    store network resolvers 2001:0DB8:0:0:0:0:0:1 192.0.2.0 2001:0DB8:0:0:0:0:0:3
    This change will take effect after restart network.
    ok
    

show 命令

show network resolvers

store network routes defaultroute

将缺省路由器的 IP 地址设置为指定值。

语法

store network routes defaultroute <ip address>

show 命令

show network routes defaultroute

store network routes static

允许用户每个设备只有一个 IP 地址 (通过主接口) ,并通过使用静态路由表的不同路由器来引导流量。 将行添加至静态路由选择表。

语法

store network routes static

show 命令

列出具有标识当前静态路由 - 设备、索引、地址、网络掩码和网关。

show network routes static

delete 命令

delete network routes static

store system domain

将系统域名设置为指定的值。

语法

store system domain <value>

show 命令

show system domain

store system hostname

将系统的主机名设置为指定的值。

语法

store system hostname <value>

show 命令

show system hostname