Fortinet black logo

Handbook (HTML)

Configuring network settings using the CLI

Configuring network settings using the CLI

For details about each command, see Overview of commands.

  1. To set the IP address and netmask of a network interface, execute the following command:
  2. config system interface

    edit {port1 | port2 | port3 | port4 }

    set ip <ip_address> <netmask>

    set allowaccess {http https ping ssh telnet}

    end

    where:

  • {port1 | port2 | port3 | port4 } is the network interface
  • <ip_address> is the interface IP address
  • <netmask> is the interface netmask
  • {http https ping ssh telnet} specifies the types of administrative access that are permitted

For example:

config system interface

edit port1

set ip 192.168.100.159 255.255.255.0

set allowaccess ping https ssh

end

  • To set the DNS servers, execute the following command. The secondary DNS server is optional:
  • config system dns

    set primary <dns_server_ip>

    set secondary <dns_server_ip>

    end

    where <dns_server_ip> is the IP address of the primary or secondary DNS server.

    For example:

    config system dns

    set primary 65.39.139.52

    set secondary 65.39.139.62

    end

  • To create a static route, execute the following command:
  • config system route

    edit <seq_num>

    set device <port>

    set gateway <gateway_ip>

    end

    where:

    • <seq_num> is an unused routing sequence number (numbering starts at 1)
    • <port>is the port for this route
    • <gateway_ip> is the default gateway IP address for the network

    For example:

    config system route

    edit 1

    set device port1

    set gateway 172.30.62.254

    end

    Configuring network settings using the CLI

    For details about each command, see Overview of commands.

    1. To set the IP address and netmask of a network interface, execute the following command:
    2. config system interface

      edit {port1 | port2 | port3 | port4 }

      set ip <ip_address> <netmask>

      set allowaccess {http https ping ssh telnet}

      end

      where:

    • {port1 | port2 | port3 | port4 } is the network interface
    • <ip_address> is the interface IP address
    • <netmask> is the interface netmask
    • {http https ping ssh telnet} specifies the types of administrative access that are permitted

    For example:

    config system interface

    edit port1

    set ip 192.168.100.159 255.255.255.0

    set allowaccess ping https ssh

    end

  • To set the DNS servers, execute the following command. The secondary DNS server is optional:
  • config system dns

    set primary <dns_server_ip>

    set secondary <dns_server_ip>

    end

    where <dns_server_ip> is the IP address of the primary or secondary DNS server.

    For example:

    config system dns

    set primary 65.39.139.52

    set secondary 65.39.139.62

    end

  • To create a static route, execute the following command:
  • config system route

    edit <seq_num>

    set device <port>

    set gateway <gateway_ip>

    end

    where:

    • <seq_num> is an unused routing sequence number (numbering starts at 1)
    • <port>is the port for this route
    • <gateway_ip> is the default gateway IP address for the network

    For example:

    config system route

    edit 1

    set device port1

    set gateway 172.30.62.254

    end