Running Faucet and Gauge on localhost

In my post about how to configure mininet-ryu-faucet-gauge-influxdb I used faucet in a remote machine (as virtual machine).
Now, I going to explain how to install and configure it in localhost.
First, download it form github:

git clone
cd faucet
sudo python install

Probably, you will see this message:

build/temp.linux-x86_64-2.7/check_libyaml.c:2:18: fatal error: yaml.h: No such file or directory

To avoid it, you need to install yaml:

apt-get install libyaml-dev

If you try to install it again you will see this message:

ERROR:root:Error parsing
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/pbr/", line 111, in pbr
    attrs = util.cfg_to_args(path, dist.script_args)
  File "/usr/local/lib/python2.7/dist-packages/pbr/", line 248, in cfg_to_args
    kwargs = setup_cfg_to_setup_kwargs(config, script_args)
  File "/usr/local/lib/python2.7/dist-packages/pbr/", line 382, in setup_cfg_to_setup_kwargs
    cmd = cls(dist)
  File "/home/nboettcher/.local/lib/python2.7/site-packages/setuptools/", line 127, in __init__
    _Command.__init__(self, dist)
  File "/usr/lib/python2.7/distutils/", line 59, in __init__
    raise TypeError, "dist must be a Distribution instance"
TypeError: dist must be a Distribution instance
error: Setup script exited with error in setup command: Error parsing /tmp/easy_install-SnaOB8/traceback2-1.4.0/setup.cfg: TypeError: dist must be a Distribution instance

To skip it, install throught pip with either of these two commands

sudo pip install -e /path_to_faucet_folder/
sudo pip install ryu-faucet

Now, we procced to create the files in /etc/ryu/faucet with their respective content:

vim faucet.yaml

version: 2
        dp_id: 0x0000000000000001   # The id of the datapath to be controlled
        description: "Initial Test Faucet"    # Purely informational
        hardware: "Open_vSwitch"  # used to determine which valve implementation to use
                native_vlan: 100
                name: "port1"   # name for this port, used for logging/monitoring
                description: "Port 1"    # informational
                native_vlan: 100
                name: "port2"
                description: "Port 2"
        description: "Test vlan" # informational
        name: "test_vlan"  # used for logging/monitoring

        max_hosts: 3 # Maxium of 3 hosts can go on this VLAN

vim gauge.yaml

    - '/etc/ryu/faucet/faucet.yaml'
        type: 'port_stats'
        dps: ['test-faucet-1']
        interval: 10
        db: 'influx'
        type: 'influx'
        influx_db: 'faucet'
        influx_host: ''
        influx_port: 8086
        influx_user: ''
        influx_pwd: ''

        influx_timeout: 10

Now, run faucet as follows:

sudo ryu-manager --ofp-tcp-listen-port=6633 /path_to_faucet_folder/src/ryu_faucet/org/onfsdn/faucet/

Probably you will see this error:

IOError: [Errno 2] No such file or directory: '/var/log/ryu/faucet/faucet.log'

To fix it, you need create this folder:

cd /var/log/ 
sudo mkdir ryu             
cd ryu      
mkdir faucet  

Run it again and go to to create a faucet database in InfluxDB

Now, run gauge in other terminal:

sudo ryu-manager --verbose  --ofp-tcp-listen-port=6663 /path_to_faucet_folder/src/ryu_faucet/org/onfsdn/faucet/

In other terminal, execute mininet and connect it to gauge with the second comand (you must put this command inside mininet with the ip with number. If you use localhost it doesn't works):

sudo mn --mac --controller remote,ip=,port=6633
sh ovs-vsctl set-controller s1 tcp: tcp:

Enjoy it!


Popular posts from this blog

Fix "Set scan parameters failed: Input/output error" on Ubuntu 16.04

from: can't read /var/mail/ in Python scripts

SNMP + Telegraf + InfluxDB