############################ # MANAGING INTERFACES # Target: FortiOS 8.0.0 ############################ # Show SFP/SFP+/SFP28 transceiver information when supported by the model. get system interface transceiver # Configure a static external interface. config system interface edit "wan1" set mode static set ip 172.16.21.2 255.255.255.0 set allowaccess ping set role wan next end # Add VLAN subinterfaces. config system interface edit "VLAN_100" set vdom "root" set interface "internal" set type vlan set vlanid 100 set mode static set ip 10.1.1.1 255.255.255.0 set allowaccess ping https set role lan next edit "VLAN_200" set vdom "root" set interface "internal" set type vlan set vlanid 200 set mode static set ip 10.1.2.1 255.255.255.0 set allowaccess ping https set role lan next end # Create address objects for the VLAN subnets. config firewall address edit "VLAN_100_Net" set type ipmask set subnet 10.1.1.0 255.255.255.0 set associated-interface "VLAN_100" next edit "VLAN_200_Net" set type ipmask set subnet 10.1.2.0 255.255.255.0 set associated-interface "VLAN_200" next end # Permit traffic in both directions between the VLANs without NAT. FortiOS # allocates policy IDs for edit 0; verify the resulting order afterward. config firewall policy edit 0 set name "VLAN100-to-VLAN200" set srcintf "VLAN_100" set srcaddr "VLAN_100_Net" set dstintf "VLAN_200" set dstaddr "VLAN_200_Net" set schedule "always" set service "ALL" set action accept set nat disable set logtraffic all set status enable next edit 0 set name "VLAN200-to-VLAN100" set srcintf "VLAN_200" set srcaddr "VLAN_200_Net" set dstintf "VLAN_100" set dstaddr "VLAN_100_Net" set schedule "always" set service "ALL" set action accept set nat disable set logtraffic all set status enable next end # Permit Internet access from both VLANs with source NAT. config firewall policy edit 0 set name "VLAN100-to-Internet" set srcintf "VLAN_100" set srcaddr "VLAN_100_Net" set dstintf "wan1" set dstaddr "all" set schedule "always" set service "ALL" set action accept set nat enable set logtraffic all set status enable next edit 0 set name "VLAN200-to-Internet" set srcintf "VLAN_200" set srcaddr "VLAN_200_Net" set dstintf "wan1" set dstaddr "all" set schedule "always" set service "ALL" set action accept set nat enable set logtraffic all set status enable next end # Enable virtual VLAN switches on supported FortiGate 8.0 appliance models. config system global set virtual-switch-vlan enable end # Create a virtual VLAN switch and assign physical switch ports. config system virtual-switch edit "VLAN10" set physical-switch "sw0" set vlan 10 config port edit "internal1" next edit "internal2" next end next end # Configure the virtual VLAN switch interface. config system interface edit "VLAN10" set vdom "root" set ip 192.168.10.99 255.255.255.0 set allowaccess ping https ssh set type hard-switch set role lan next end # Designate a supported physical switch port as a VLAN trunk. config system interface edit "internal5" set trunk enable next end # Create an LACP aggregate interface. config system interface edit "aggregate" set vdom "root" set type aggregate set member "port4" "port5" "port6" set lacp-mode active set ip 10.1.10.1 255.255.255.0 set allowaccess ping https ssh set role lan next end # Drive port3 down if either member of agg1 fails. config system interface edit "agg1" set vdom "root" set type aggregate set member "port1" "port2" set lacp-mode active set fail-detect enable set fail-alert-method link-down set fail-alert-interfaces "port3" next end # Create a redundant interface. config system interface edit "redundant" set vdom "root" set type redundant set member "port4" "port5" "port6" set ip 10.13.101.1 255.255.255.0 set allowaccess ping https ssh set role lan next end # Create a software switch. Member ports must be free of conflicting # configuration references before being added. config system switch-interface edit "lan-switch" set vdom "root" set member "port4" "port5" set type switch set intra-switch-policy implicit next end config system interface edit "lan-switch" set vdom "root" set type switch set ip 192.168.20.1 255.255.255.0 set allowaccess ping https ssh set role lan next end # Add ports to an existing hardware switch on supported models. config system virtual-switch edit "internal" set physical-switch "sw0" config port edit "internal3" next edit "internal4" next edit "internal5" next edit "internal6" next end next end # Remove ports from an existing hardware switch. config system virtual-switch edit "internal" config port delete "internal2" delete "internal7" end next end # FortiOS 8.0.0: create an 802.1X-enabled software switch. The RADIUS-backed # group must exist, and all switch members must be physical interfaces. config system switch-interface edit "auth-switch" set vdom "root" set member "port6" "port7" set type switch set intra-switch-policy explicit next end config system interface edit "auth-switch" set vdom "root" set type switch set ip 192.168.30.1 255.255.255.0 set allowaccess ping https ssh set security-mode 802.1X set security-groups "radius-8021x" set role lan next end # Inspect the 802.1X bridge and authenticated IPv4/IPv6 address objects. diagnose netlink brctl name port auth-switch diagnose sys 802-1x-addr diagnose sys 802-1x-addr6 # Group interfaces into a zone. Interfaces cannot already belong to another # zone or be referenced directly by firewall policies. config system zone edit "Zone_1" set interface "internal" "VLAN_100" set intrazone deny next end # Use the zone in a firewall policy. config firewall policy edit 0 set name "Zone1-to-port15" set srcintf "Zone_1" set dstintf "port15" set srcaddr "all" set dstaddr "all" set action accept set schedule "always" set service "ALL" set nat enable set logtraffic all next end # Create a virtual wire pair. Both members must have no IP address, must not be # switch members, and cannot provide the current administrative connection. config system virtual-wire-pair edit "VWP-name" set member "port3" "port4" set wildcard-vlan disable next end # Permit traffic through the virtual wire pair in both directions. config firewall policy edit 0 set name "VWP-Policy" set srcintf "port3" "port4" set dstintf "port3" "port4" set srcaddr "all" set dstaddr "all" set action accept set schedule "always" set service "ALL" set utm-status enable set logtraffic all next end # Create two wildcard-VLAN virtual wire pairs. config system virtual-wire-pair edit "test-vwp-1" set member "wan1" "wan2" set wildcard-vlan enable next edit "test-vwp-2" set member "port19" "port20" set wildcard-vlan enable next end # Apply one policy to both virtual wire pairs. Members must be entered as # matching source/destination pairs. config firewall policy edit 0 set name "vwp1-and-vwp2-policy" set srcintf "port19" "wan1" set dstintf "port20" "wan2" set srcaddr "all" set dstaddr "all" set action accept set schedule "always" set service "ALL" set logtraffic all next end # Create EMAC VLAN interfaces for three existing VDOMs sharing port1. config system interface edit "port1.emacvlan1" set vdom "VDOM1" set type emac-vlan set interface "port1" next edit "port1.emacvlan2" set vdom "VDOM2" set type emac-vlan set interface "port1" next edit "port1.emacvlan3" set vdom "VDOM3" set type emac-vlan set interface "port1" next end