'How to set IP address on an interface in Fortigate CLI?

I want to set IP address on Port1 of Fortinet Fortigate CLI.

I am trying to use the following command:

set ip 192.168.176.0 255.255.255.0

but I am getting the following error before 255.255.255.0:

IP address is illegal Value parse the error

I have tried a lot but failed to understand the reason behind this issue.



Solution 1:[1]

configure the port1 IP address and netmask.

For example:

config system interface
    edit port1
        set ip 192.168.0.100 255.255.255.0
    end

Solution 2:[2]

By default, all the interfaces of Fortigate are in DHCP mode. So, you need to make it static and allow access for protocols which you want to use there.

Another thing to note here is that if you are trying to assign 192.168.176.0/24 to an interface then that's an invalid IP as it is a Network address.

Try, below commands,

system config interface
  edit port1
    set mode static
    set allowaccess ping http https ssh telnet
    set ip 192.168.176.1/24
    end

Solution 3:[3]

You want to configure "192.168.176.0/24" as FortiGate interface ip-address:

  • Network ip of 192.168.176.0/24 = 192.168.176.0
  • First usable ip of 192.168.176.0/24 = 192.168.176.1
  • Last usable ip of 192.168.176.0/24 = 192.168.176.254
  • Broadcast ip of 192.168.176.0/24 = 192.168.176.255

You can't configure the network ip address as interface ip. Instead use a usable ip.

system config interface
  edit port1
    set mode static
    set allowaccess ping https ssh
    set ip 192.168.176.1/24
  next
end

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 mehrdad rafiee
Solution 2 nvt_dc
Solution 3 fth