Fortinet black logo

Administration Guide

Virtual routing and forwarding

Virtual routing and forwarding

NOTE: This feature is supported only on the switch virtual interface (SVI).

You can use the virtual routing and forwarding (VRF) feature to create multiple routing tables within the same router.

Use the following steps to configure VRF:

  1. Creating a VRF instance
  2. Assigning the VRF instance to a SVI
  3. Assigning the VRF instance to a static route
  4. Checking the VRF configuration

Starting in FortiSwitchOS 7.0.0, OSPF supports VRF. To use VRF with OSPF, create a VRF instance and then use the same VRF identifier in the config vrf commands under config router ospf.

Creating a VRF instance

You create a VRF instance by assigning a name and an identifier.

  • The VRF name cannot match any SVI name.
  • The VRF identifier is a number in the range of 1-1023, except for 252, 253, 254, and 255. You cannot assign the same VRF identifier to more than one VRF instance. After the VRF instance is created, the VRF identifier cannot be changed.

config router vrf

edit <string>

set vrfid <VRF_ID>

end

For example:

config router vrf

edit vrfv4

set vrfid 1

next

edit vrfv6

set vrfid 2

next

end

Assigning the VRF instance to a SVI

You assign the VRF instance to an SVI when you create the SVI. After the SVI is created, the VRF instance cannot be changed or unset.

You can assign the same VRF instance to more than one SVI. The VRF instance cannot be assigned to an internal SVI.

config system interface

edit <interface_name>

set vrf <string>

end

For example:

config system interface

edit v40

set vlanid 40

set vrf vrfv4

next

edit v50

set vlanid 50

set vrf vrfv4

next

end

Assigning the VRF instance to a static route

You assign the VRF instance to an IPv4 or IPv6 static route when you create the static route. After the static route is created, the VRF instance cannot be changed or unset.

You can assign the same VRF instance to more than one static route.

config router static

edit <seq-num>

set vrf <string>

end

config router static6

edit <seq-num>

set vrf <string>

end

For example:

config router static

edit 1

set device mgmt

set gateway 192.168.0.10

set status enable

set vrf vrfv4

end

config router static6

edit 2

set dst 5555::/64

set gateway 4000::2

set status enable

set vrf vrfv6

end

Checking the VRF configuration

Use the following commands to check the VRF routes in the routing table:

  • get router info routing-table vrf <VRF_name>
  • get router info6 routing-table vrf <VRF_name>

Virtual routing and forwarding

Virtual routing and forwarding

NOTE: This feature is supported only on the switch virtual interface (SVI).

You can use the virtual routing and forwarding (VRF) feature to create multiple routing tables within the same router.

Use the following steps to configure VRF:

  1. Creating a VRF instance
  2. Assigning the VRF instance to a SVI
  3. Assigning the VRF instance to a static route
  4. Checking the VRF configuration

Starting in FortiSwitchOS 7.0.0, OSPF supports VRF. To use VRF with OSPF, create a VRF instance and then use the same VRF identifier in the config vrf commands under config router ospf.

Creating a VRF instance

You create a VRF instance by assigning a name and an identifier.

  • The VRF name cannot match any SVI name.
  • The VRF identifier is a number in the range of 1-1023, except for 252, 253, 254, and 255. You cannot assign the same VRF identifier to more than one VRF instance. After the VRF instance is created, the VRF identifier cannot be changed.

config router vrf

edit <string>

set vrfid <VRF_ID>

end

For example:

config router vrf

edit vrfv4

set vrfid 1

next

edit vrfv6

set vrfid 2

next

end

Assigning the VRF instance to a SVI

You assign the VRF instance to an SVI when you create the SVI. After the SVI is created, the VRF instance cannot be changed or unset.

You can assign the same VRF instance to more than one SVI. The VRF instance cannot be assigned to an internal SVI.

config system interface

edit <interface_name>

set vrf <string>

end

For example:

config system interface

edit v40

set vlanid 40

set vrf vrfv4

next

edit v50

set vlanid 50

set vrf vrfv4

next

end

Assigning the VRF instance to a static route

You assign the VRF instance to an IPv4 or IPv6 static route when you create the static route. After the static route is created, the VRF instance cannot be changed or unset.

You can assign the same VRF instance to more than one static route.

config router static

edit <seq-num>

set vrf <string>

end

config router static6

edit <seq-num>

set vrf <string>

end

For example:

config router static

edit 1

set device mgmt

set gateway 192.168.0.10

set status enable

set vrf vrfv4

end

config router static6

edit 2

set dst 5555::/64

set gateway 4000::2

set status enable

set vrf vrfv6

end

Checking the VRF configuration

Use the following commands to check the VRF routes in the routing table:

  • get router info routing-table vrf <VRF_name>
  • get router info6 routing-table vrf <VRF_name>