Yuri Slobodyanyuk Blog on Information Security 2024年09月12日
Fortigate CLI command alias to create shortcuts and save time
index_new5.html
../../../zaker_core/zaker_tpl_static/wap/tpl_guoji1.html

 

文章介绍了FortigateCLI命令别名的作用及相关特性,包括其能节省输入时间,以及Fortigate命令别名的一些限制和功能等。

🎯FortigateCLI命令可能很长,容易因输入错误产生问题,命令别名可解决此问题。它能节省大量输入时间,如作者计算出CLI自动化每月可节省4小时工作时间。

📌Fortigate命令别名有一些限制和特性。例如,仅在Fortigate上可用,配置的别名会保存在配置中并在重启和升级后仍存在,只能在顶层使用,命令在别名中不受子配置树深度限制,可组合多个按顺序运行的命令,但不能接受参数。

💻配置别名使用configsystemalias命令,文中给出了一些作者使用的别名示例,如'rt'用于获取路由信息等,还展示了如何使用别名获取路由表的示例。

Fortigate CLI commands can be long, like really long. And it is no fun to get an error running a command of 6 words because of the typo! The solution to this is simple - command aliases. Coming from the Cisco world I got used to creating command aliases as a way to save time typing, which, multiplied by the hundreds of devices I have access to, saves a lot of time. Saving time typing is the reason I don't use Putty but instead invested in myself and bought SecureCRT by VanDyke. I once calculated what CLI automation saves me - the whole 4 hours of work monthly!
So let's get back to the Fortigate. It has the command alias capability that allows to configure a shortcut to the full syntax CLI command and save it in the configuration. Fortigate aliases have some limitations and features, here is the list:

To configure alias we use config system alias command, here are some aliases I use:

config system alias    edit "rt"        set command "get router info routing all"    next    edit "rt6"        set command "get router info6 routing-table"    next    edit "gip"        set command "get router info protocols"    nextend

E.g. to get routing table:

# alias rt

Routing table for VRF=0Codes: K - kernel, C - connected, S - static, R - RIP, B - BGP       O - OSPF, IA - OSPF inter area       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2       E1 - OSPF external type 1, E2 - OSPF external type 2       i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area       * - candidate defaultS*      0.0.0.0/0 [10/0] via 192.168.13.1, port1C       10.10.17.0/24 is directly connected, port3C       192.168.13.0/24 is directly connected, port1

Follow me on https://www.linkedin.com/in/yurislobodyanyuk/ not to miss what I publish on Linkedin, Github, blog, and more.

Fish AI Reader

Fish AI Reader

AI辅助创作,多种专业模板,深度分析,高质量内容生成。从观点提取到深度思考,FishAI为您提供全方位的创作支持。新版本引入自定义参数,让您的创作更加个性化和精准。

FishAI

FishAI

鱼阅,AI 时代的下一个智能信息助手,助你摆脱信息焦虑

联系邮箱 441953276@qq.com

相关标签

FortigateCLI 命令别名 节省时间 配置限制
相关文章