{"id":33,"date":"2020-03-05T14:29:25","date_gmt":"2020-03-05T13:29:25","guid":{"rendered":"https:\/\/whatifsecu.tech\/?p=33"},"modified":"2020-03-05T14:29:39","modified_gmt":"2020-03-05T13:29:39","slug":"fortigate-cli-cheat-sheet","status":"publish","type":"post","link":"https:\/\/whatifsecu.tech\/?p=33","title":{"rendered":"Fortigate CLI Cheat Sheet"},"content":{"rendered":"\n<p><strong> Release date 20200225 \u2013 v6.2.3<\/strong><\/p>\n\n\n\n<p>Original work by Frederic Kasmirczak, updated by\nExclusive Networks<\/p>\n\n\n\n<table class=\"wp-block-table\"><tbody><tr><td>\n  Main command\n  structure\n  <\/td><\/tr><tr><td>\n  show\n  <\/td><td>\n  Display changes to the default configuration\n  <\/td><\/tr><tr><td>\n  get\n  <\/td><td>\n  List the configuration of the current object or table\n  <\/td><\/tr><tr><td>\n  edit\n  <\/td><td>\n  Create or edit a table in the current object.<br>\n  edit 0 will use the next ID available in a sequence number\n  <\/td><\/tr><tr><td>\n  set\/unset\n  <\/td><td>\n  Set a field \/ Reset a field to the default value\n  <\/td><\/tr><tr><td>\n  next\n  <\/td><td>\n  Save current entry\n  (edit X) and return to table \n  <\/td><\/tr><tr><td>\n  end\n  <\/td><td>\n  Save the current\n  changes and exit menu\n  <\/td><\/tr><tr><td>\n  abort\n  <\/td><td>\n  Exit commands without saving the fields (ctrl+C)\n  <\/td><\/tr><tr><td>\n  delete\n  <\/td><td>\n  Remove a table from the current object\n  <\/td><\/tr><tr><td>\n  tree\n  <\/td><td>\n  Display\n  the command tree for the current config section\n  <\/td><\/tr><\/tbody><\/table>\n\n\n\n<table class=\"wp-block-table\"><tbody><tr><td>\n  Interface\n  <\/td><\/tr><tr><td>\n  show\/get\n  system interface\n  <\/td><td>\n  Show interfaces status. Use get to retrieve dynamic information (such as PPPoE IP)\n  <\/td><\/tr><tr><td>\n  config sys interface<br>\n  edit &lt;port&gt;<br>\n  set ip x.x.x.x\/y<br>\n  set allow ssh ping https<br>\n  end\n  <\/td><td>\n  Basic interface ip\n  configuration\n  <\/td><\/tr><tr><td>\n  diag netlink device list\n  <\/td><td>\n  Show interfaces\n  statistics (errors)\n  <\/td><\/tr><tr><td>\n  diag hard dev nic\n  &lt;port&gt;\n  <\/td><td>\n  Show interfaces\n  statistics\n  <\/td><\/tr><\/tbody><\/table>\n\n\n\n<table class=\"wp-block-table\"><tbody><tr><td>\n  Static\n  routing\n  <\/td><\/tr><tr><td>\n  config router static<br>\n  edit 0<br>\n  set device internal <br>\n  set dst x.x.x.x\/y<br>\n  set\n  gateway z.z.z.z&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \n  set\n  dynamic-gateway ena<br>\n  end\n  <\/td><td>\n  Add a static route\n  &nbsp;\n  (set a static gateway <strong>OR<\/strong> enable dynamic-gateway for DHCP\/PPPoE)\n  <\/td><\/tr><tr><td>\n  get\n  router info routing\u00adtable all\n  get\n  router info routing\u00adtable database\n  <\/td><td>\n  Display the current routing table active\/configured\n  <\/td><\/tr><tr><td>\n  get ro info ro details x.x.x.x\n  <\/td><td>\n  Display the route used to reach the IP x.x.x.x \n  <\/td><\/tr><tr><td>\n  diag firewall proute\n  list\n  <\/td><td>\n  Display the Policy Routes (have precedence over the\n  routing table)\n  <\/td><\/tr><tr><td>\n  diag ip route list\n  <\/td><td>\n  Display the kernel routing table\n  <\/td><\/tr><\/tbody><\/table>\n\n\n\n<table class=\"wp-block-table\"><tbody><tr><td>\n  Basic\n  <\/td><\/tr><tr><td>\n  get sys status\n  <\/td><td>\n  Show status summary\n  <\/td><\/tr><tr><td>\n  get sys perf stat\n  <\/td><td>\n  Show Fortigate\n  ressources summary\n  <\/td><\/tr><tr><td>\n  execute ping(-options)\n  <\/td><td>\n  Ping something (can add options)\n  <\/td><\/tr><tr><td>\n  execute ssh\n  &lt;user&gt;@&lt;ip&gt;\n  <\/td><td>\n  SSH to another server\n  <\/td><\/tr><tr><td>\n  exec shutdown\/reboot\n  <\/td><td>\n  Shutdown the device\/reboot\n  <\/td><\/tr><tr><td>\n  get sys arp (| grep\n  x.x)\n  <\/td><td>\n  Show the arp table (filtered by x.x)\n  <\/td><\/tr><tr><td>\n  show | grep -f\n  something\n  <\/td><td>\n  Find where \u201csomething\u201d is used (cases-sensitive, can use -i to be case insensitive)\n  <\/td><\/tr><\/tbody><\/table>\n\n\n\n<table class=\"wp-block-table\"><tbody><tr><td>\n  Disk\/upgrade\/config\n  management\n  <\/td><\/tr><tr><td>\n  diag hard deviceinfo disk\n  <\/td><td>\n  Show disks and partitions usage\n  <\/td><\/tr><tr><td>\n  diag sys flash list\n  <\/td><td>\n  Show partitions\n  status\n  <\/td><\/tr><tr><td>\n  exec set\u00adnext\u00adreboot&nbsp;?\n  <\/td><td>\n  Select partition for the next reboot\n  <\/td><\/tr><tr><td>\n  exec factoryreset [keepvmlicense]\n  <\/td><td>\n  Reset to factory default (2 to keep network) (if VM,\n  use keepvmlicense)\n  <\/td><\/tr><tr><td>\n  exec backup conf\n  <\/td><td>\n  Backup configuration\n  <\/td><\/tr><tr><td>\n  exec restore config\n  <\/td><td>\n  Restore configuration\n  (reboots)\n  <\/td><\/tr><tr><td>\n  diag debug config-error-log read\n  <\/td><td>\n  Show config parsing errors (after upgrade) &gt;\n  should be empty\n  <\/td><\/tr><tr><td>\n  exec formatlogdisk\n  <\/td><td>\n  Format log disk\n  <\/td><\/tr><\/tbody><\/table>\n\n\n\n<table class=\"wp-block-table\"><tbody><tr><td>\n  High\n  availability\n  <\/td><\/tr><tr><td>\n  get sys ha status<br>\n  diag sys ha status\n  <\/td><td>\n  Show HA conf summary\n  <\/td><\/tr><tr><td>\n  diag sys ha history\n  read\n  <\/td><td>\n  Show HA history events\n  <\/td><\/tr><tr><td>\n  diag deb en\n  diag\n  deb cons timestamp en<br>\n  diag deb app hatalk \u00ad1<br>\n  diag deb app hasync \u00ad1\n  <\/td><td>\n  Troubleshoot HA synchronization issue\n  <\/td><\/tr><tr><td>\n  diag sys ha check cluster<br>\n  diag sys ha check sh root\n  <\/td><td>\n  Show the config checksum for any members of the cluster and show\n  details of the config for a vdom (here root)\n  <\/td><\/tr><tr><td>\n  exec ha synchronize\n  all\n  <\/td><td>\n  Synchronize all parts of the config\n  <\/td><\/tr><tr><td>\n  diag sys ha\n  reset\u00aduptime\n  <\/td><td>\n  Reset ha uptime criteria (to trigger failover unless override is\n  enabled =&gt; default is disabled)\n  <\/td><\/tr><tr><td>\n  diag sniffer packet\n  haint &#8216;ether[12:2]=0x8890&#8217; 6\n  <\/td><td>\n  Sniffer on heartbeat ports (here haint)\n  <\/td><\/tr><tr><td>\n  exec ha manage\n  &lt;id&gt; &lt;admin&gt;\n  <\/td><td>\n  Connect on a subordinate device\n  <\/td><\/tr><\/tbody><\/table>\n\n\n\n<table class=\"wp-block-table\"><tbody><tr><td>\n  Debug\n  <\/td><\/tr><tr><td>\n  diag debug enable<br>\n  diag debug flow sh c en<br>\n  diag debug flow sh f en<br>\n  diag debug flow filter saddr x.x.x.x<br>\n  diag debug flow filter daddr y.y.y.y<br>\n  diag debug flow trace start 10<br>\n  diag debug reset\n  <\/td><td>\n  Debug flow\n  <\/td><\/tr><tr><td>\n  diag sys\n  session <strong>filter<\/strong> src x.x.x.x<br>\n  diag sys session <strong>filter<\/strong> dst x.x.x.x<br>\n  diag sys session <strong>list<\/strong>\n  diag sys\n  session <strong>clear<\/strong>\n  <\/td><td>\n  <strong>Filter<\/strong> session table\n  &nbsp;\n  <strong>List<\/strong> session\n  <strong>Clear<\/strong> these sessions\n  <\/td><\/tr><tr><td>\n  diag debug crashlog read\n  <\/td><td>\n  Show crashlog\n  <\/td><\/tr><tr><td>\n  diag deb en<br>\n  diag deb app fnbamd -1\n  <\/td><td>\n  Debug authentication\n  <\/td><\/tr><tr><td>\n  diag debug report\n  <\/td><td>\n  Collect lots of info \n  <\/td><\/tr><tr><td>\n  diag sys top\n  &lt;seconds&gt; &lt;nb_lines&gt;<br>\n  <em>shift+P for CPU ordering, shift+M for Mem ordering<\/em>\n  <\/td><td>\n  Processes usage (CPU usage)\n  <\/td><\/tr><tr><td>\n  diag sys top-summary\n  \u2018-s mem\u2019<br>\n  <em>\u2018<\/em><em>-h<\/em><em>\u2019<\/em><em> to show\n  options<\/em>\n  <\/td><td>\n  Processes usage (Mem\n  usage)\n  <\/td><\/tr><\/tbody><\/table>\n\n\n\n<table class=\"wp-block-table\"><tbody><tr><td>\n  Network\n  Packet Capture\n  <\/td><\/tr><tr><td>\n  diag\n  sniffer packet &lt;<em>interface<\/em>&gt; \u2018&lt;<em>filter<\/em>&gt;\u2019 &lt;<em>verbose<\/em>&gt;\n  &lt;<em>count<\/em>&gt; &lt;<em>a\/l<\/em>&gt;<br>\n  &lt;<strong><em>interface<\/em><\/strong>&gt;:\n  physical, virtual, vpn, any<br>\n  &lt;<strong><em>filter<\/em><\/strong>&gt;: tcpdump\n  filter<br>\n  &lt;<strong><em>verbose<\/em><\/strong>&gt;: there are\n  six verbose levels:<br>\n  <strong>1<\/strong>\u00adprint header of packets<br>\n  <strong>2<\/strong>\u00adprint header and data from the\n  IP header<br>\n  <strong>3<\/strong>\u00adprint header and data from the\n  Ethernet header (convert using fgt2eth)<br>\n  <strong>4<\/strong>,<strong>5<\/strong>,<strong>6<\/strong>\u00adlike 1,2,3, with\n  interface name<br>\n  &lt;<strong><em>count<\/em><\/strong>&gt;\n  the number of packets, can be 0 to stop using ctrl+C<br>\n  &lt;<strong><em>a<\/em><\/strong><em>\/<strong>l<\/strong><\/em>&gt; to enable absolute\/local\n  timestamp, nothing for relative timestamp\n  <\/td><\/tr><\/tbody><\/table>\n\n\n\n<table class=\"wp-block-table\"><tbody><tr><td>\n  VPN\n  <\/td><\/tr><tr><td>\n  diag\n  vpn ike gateway list\n  <\/td><td>\n  Show phase 1\n  <\/td><\/tr><tr><td>\n  diag vpn tunnel list\n  <\/td><td>\n  Show phase 2<br>\n  (shows npu flag)\n  <\/td><\/tr><tr><td>\n  diag vpn ike gateway\n  flush name &lt;phase1&gt;\n  <\/td><td>\n  Flush a phase 1\n  <\/td><\/tr><tr><td>\n  diag vpn tunnel up\n  &lt;phase2&gt;\n  <\/td><td>\n  Bring up a phase 2\n  <\/td><\/tr><tr><td>\n  diag debug\n  en<br>\n  diag vpn ike log-filter daddr x.x.x.x<br>\n  diag debug app ike \u00ad1 \n  <\/td><td>\n  Troubleshoot VPN issue\n  <\/td><\/tr><\/tbody><\/table>\n\n\n\n<table class=\"wp-block-table\"><tbody><tr><td>\n  FortiGuard\n  <\/td><\/tr><tr><td>\n  execute\n  update-now\n  <\/td><td>\n  Forces a download of the whole AV\/IPS database, with\n  license check\n  <\/td><\/tr><tr><td>\n  diag\n  deb en<br>\n  diag deb app update -1\n  <\/td><td>\n  Troubleshoot AV\/IPS download\n  <\/td><\/tr><tr><td>\n  diag\n  autoupd status\/version\n  <\/td><td>\n  Show FGD engine and database\n  <\/td><\/tr><tr><td>\n  diag\n  debug rating\n  <\/td><td>\n  Show current connectivity with URL rating servers\n  <\/td><\/tr><\/tbody><\/table>\n\n\n\n<table class=\"wp-block-table\"><tbody><tr><td>\n  Most wanted\n  Tips : http:\/\/kb.fortinet.com\/\n  <\/td><\/tr><tr><td>\n  Multi-wan routing\n  scenarios\n  <\/td><td>\n  FD32103\n  <\/td><\/tr><tr><td>\n  Convert &#8220;diag sniff packet&#8221; to wireshark\n  <\/td><td>\n  FD30877\n  <\/td><\/tr><tr><td>\n  Hairpin NAT\n  <\/td><td>\n  FD36202\n  <\/td><\/tr><tr><td>\n  Config\n  transfer\/conversion\n  <\/td><td>\n  FD10063\n  <\/td><\/tr><tr><td>\n  FSSO Troubleshoot\n  <\/td><td>\n  FD31819\n  <\/td><\/tr><tr><td>\n  Maximum log-age\n  <\/td><td>\n  FD36366\n  <\/td><\/tr><tr><td>\n  Blackhole routes for cleaner VPN failovers\n  <\/td><td>\n  FD36695\n  <\/td><\/tr><tr><td>\n  Allow TCP session creation without SYN flag\n  <\/td><td>\n  FD40929\n  <\/td><\/tr><\/tbody><\/table>\n\n\n\n<table class=\"wp-block-table\"><tbody><tr><td>\n  <a>Other great source for information<\/a>\n  <\/td><\/tr><tr><td>\n  http:\/\/docs.fortinet.com\/\n  <\/td><td>\n  Official documentation (handbook, cli guide, release\n  notes, hardware guides, etc\u2026)\n  <\/td><\/tr><tr><td>\n  http:\/\/cookbook.fortinet.com\/\n  <\/td><td>\n  Howtos, videos, etc\u2026\n  <\/td><\/tr><tr><td>\n  http:\/\/forum.fortinet.com\/\n  <\/td><td>\n  Official forum\n  <\/td><\/tr><tr><td>\n  http:\/\/fusecommunity.fortinet.com\n  <\/td><td>\n  User communiy, with groups\n  <\/td><\/tr><\/tbody><\/table>\n\n\n\n<p>This document is distributed under the free license: &nbsp;Attribution-ShareAlike 4.0 International\nCreative Commons BY-SA 4.0 https:\/\/creativecommons.org\/licenses\/by-sa\/4.0\/<\/p>\n\n\n\n<p>You are\nfree to:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li><em>Share<\/em> \u2014 copy and redistribute the material in any medium or format.<\/li><li><em>Adapt<\/em> \u2014 remix, transform, and build upon the material for any purpose, even\ncommercially.<\/li><li>The licensor cannot revoke these freedoms as long as you follow the license\nterms. Under the following terms: <em>Attribution<\/em> \u2014 You must give appropriate credit, provide a link to the license, and\nindicate if changes were made. You may do so in any reasonable manner, but not\nin any way that suggests the licensor endorses you or your use. <em>ShareAlike<\/em>\n\u2014 If you remix, transform, or build upon the material,\nyou must distribute your contributions under the same license as the original.<\/li><\/ul>\n\n\n\n<p>No\nadditional restrictions \u2014 You may\nnot apply legal terms or technological measures that legally restrict others\nfrom doing anything the license permits.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Release date 20200225 \u2013 v6.2.3 Original work by Frederic Kasmirczak, updated by Exclusive Networks Main command structure show Display changes to the default configuration get List the configuration of the current object or table edit Create or edit a table&hellip; <a href=\"https:\/\/whatifsecu.tech\/?p=33\" class=\"more-link\">Continue Reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[1],"tags":[],"class_list":["post-33","post","type-post","status-publish","format-standard","hentry","category-non-classe"],"_links":{"self":[{"href":"https:\/\/whatifsecu.tech\/index.php?rest_route=\/wp\/v2\/posts\/33","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/whatifsecu.tech\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/whatifsecu.tech\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/whatifsecu.tech\/index.php?rest_route=\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/whatifsecu.tech\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=33"}],"version-history":[{"count":3,"href":"https:\/\/whatifsecu.tech\/index.php?rest_route=\/wp\/v2\/posts\/33\/revisions"}],"predecessor-version":[{"id":36,"href":"https:\/\/whatifsecu.tech\/index.php?rest_route=\/wp\/v2\/posts\/33\/revisions\/36"}],"wp:attachment":[{"href":"https:\/\/whatifsecu.tech\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=33"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/whatifsecu.tech\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=33"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/whatifsecu.tech\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=33"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}