// to display images directly on GitHub
ifdef::env-github[]
:encoding: UTF-8
:lang: en
:doctype: book
:toc: left
:imagesdir: ../../images
endif::[]

////

    This file is part of the PacketFence project.

    See PacketFence_Network_Devices_Configuration_Guide.asciidoc
    for authors, copyright and license information.

////


//=== Anyfi Networks

This section will discuss about the configuration of your Anyfi Gateway and Controller in order to use it with our configured PacketFence environment.

==== Deploy Anyfi Controller and Gateway

First thing, you will need to deploy the Anyfi Gateway and Controller on your network and configure basic connectivity between both of them.

When installing the Anyfi Gateway, have one interface in trunk mode for the packet bridge. In this example it will be `eth2` which is the last card on the machine.

==== Anyfi Gateway Basic Configuration

Connect to the gateway using SSH and enter configuration mode.
Now you need to add the configuration for `br0 which will link the access point traffic to your network.
    
    interfaces {
        bridge br0 {
            aging 300
            hello-time 2
            max-age 20
            priority 0
            stp false
        }
    }

In this example `eth1` will be the management interface of the Anyfi Gateway and `eth2` will be the interface that will contain the outbound WiFi traffic.

    interfaces {
        ethernet eth1 {
            address <your management ip address>/<mask>
            duplex auto
            smp_affinity auto
            speed auto
        }
        ethernet eth2 {
            bridge-group {
                bridge br0
            }
            duplex auto
            smp_affinity auto
            speed auto
        }
    }

==== Open SSID Configuration

Still in configuration mode, configure the RADIUS server and SSID security.

    service {
        anyfi {
            gateway ma-gw {
                accounting {
                    radius-server <Management IP of PacketFence> {
                        port 1813
                        secret useStrongerSecret 
                    }
                }
                authorization {
                    radius-server <Management IP of PacketFence> {
                        port 1812
                        secret useStrongerSecret
                    }
                }
                bridge br0
                controller <IP or FQDN of the Anyfi Controller>
                isolation
                nas {
                    identifier anyfi
                    port 3799
                }
                ssid DemoOpen
            }
    }

==== Secure SSID Configuration

Still in configuration mode, configure the Anyfi Gateway to broadcast a WPA2 enterprise SSID.

    service {
        anyfi{
            gateway secure-gw {
                authentication {
                    eap {
                        radius-server <Management IP of PacketFence> {
                            port 1812
                            secret useStrongerSecret 
                        }
                    }
                }
                bridge br0
                controller <IP or FQDN of the Anyfi Controller>
                isolation
                ssid DemoSecure
                wpa2 {
                }
            }
        }
    }


==== Deploy Access Point

You will now need to install CarrierWRT on a compatible access point and configure the Anyfi Controller in it. 
Depending on the access point you're using, the method to install CarrierWRT will vary.
For specifics about the CarrierWRT installation, refer to Anyfi's documentation.
Once this step is done, the SSID should be broadcasted.
