Technical Tip: How to delete the default virtual hardware switch
Description
Individual interfaces can be manually removed from the hardware switch interface.
The hardware switch interface can be seen in the image below, named 'lan'.
Go to System -> Network -> Interfaces or Network -> Interfaces depending on the firmware version.

To view the hardware switch interface 'lan' via the CLI:
Version: FortiGate-60E v7.4.11,build2878,260124 (GA.M)
config system interface
edit "internal"
set vdom "root"
set ip 192.168.1.99 255.255.255.0
set allowaccess ping https ssh fabric
set type hard-switch<---
set stp enable
set role lan
set snmp-index 15
next
end
The first step is to remove all references from the hardware switch.
This is done because FortiOS cannot delete entries that have existing dependencies.
The number of current references can be seen in the web interface under Network -> Interfaces -> 'Ref'.
By selecting the number in the 'Ref' column, the types of references are listed, for example, 'Address', 'Firewall Policy', 'System DHCP Server'.
Here, the references can also be deleted directly in the web interface on current firmware releases.
To list the references from the CLI, the following command can be used (where <INTERFACE> is the name of the hardware switch, for example, 'lan' or 'internal').
diagnose sys cmdb refcnt show system.interface.name <INTERFACE>
For example:
diagnose sys cmdb refcnt show system.interface.name lan
Or:
diagnose sys cmdb refcnt show system.interface.name internal
On older firmware releases, the references could be listed with the command:
diagnose sys checkused system.interface.name <INTERFACE>
In this example, the hardware switch that will be removed is named 'lan'.
- The firewall policy, which is linked to the 'lan' interface, must first be deleted.
Go to Policy & Objects -> Policy -> IPv4.

To delete via CLI:
config firewall policy
show <--- To view existing firewall policies to gather the correct policy ID.
config firewall policy
edit 1 <--- The policy ID.
set uuid fb3f751e-72c3-51e5-9159-daebef2d0346
set srcintf "lan"
set dstintf "wan1"
set srcaddr "all"
set dstaddr "all"
set action accept
set schedule "always"
set service "ALL"
set nat enable
next
end
delete <ID> <--- With the default settings, the ID should be '1'; however, it should be verified on the system.
end

The following output will be seen via the CLI if the policy no longer exists.
show firewall policy <ID> <----- With the default settings, the ID should be '1'. However, this should be verified on the system.
entry is not found in table
Command fail. Return code 1
- The DHCP server must also be deleted for the same reasons, as it is also linked to the interface (this must be done via the CLI).
config system dhcp server
edit 1 <--- The DHCP ID.
set dns-service default
set default-gateway 192.168.100.99
set netmask 255.255.255.0
set interface "lan"
config ip-range
edit 1
set start-ip 192.168.100.110
set end-ip 192.168.100.210
next
end
To delete the entry, use the following syntax in the CLI:
delete <ID> <--- With the default settings, the ID should be '1'. However, this should be verified on the system.
end
end
entry is not found in table
Command fail. Return code 1
- The 'lan' interface can now be deleted.
Select the interface 'lan', and select the delete icon to remove it.

To delete the 'lan' switch via the CLI:
config system virtual-switch
delete "lan"
end
To verify the entry has been removed:
show system interface lan
Related documents:
