详细图解在NetFPGA上创建一个OpenFlow Switch的网络
$git clone git://openflow.org/openflow.git
$cd openflow
$git checkout -b 1.0.0-netfpga origin/devel/tyabe/1.0.0-netfpga
$./boot.sh
$cd openflow
$./configure --enable-hw-lib=nf2
$make
$sudo make install
主要安装了ofdatapath,ofprotocol等命令。
设置环境变量$cat /usr/local/netfpga/bashrc_addon >> ~/.bashrc #将NetFPGA编译用到的环境变量添加到当前用户中去$source ~/.bashrc$sudo /usr/local/netfpga/lib/scripts/grub_update/grub_update.sh #更新Grub$cd /usr/local/netfpga/lib/C/kernel/$make install$lsmod |grep nf2 #查看是否安装了netfpga 内核模块如果没有找到NetFPGA的内核模块$sudo /sbin/modprobe nf2.ko #安装内核模块重启机器。$/sbin/ifconfig #查看NetFPGA 4个端口的信息,以确认NetFPGA package安装成功。nf2c0 Link encap:Ethernet HWaddr 00:4E:46:32:43:00UP BROADCAST RUNNING PROMISC MULTICAST MTU:1986 Metric:1RX packets:0 errors:0 dropped:0 overruns:0 frame:0TX packets:0 errors:0 dropped:0 overruns:0 carrier:0collisions:0 txqueuelen:1000RX bytes:0 (0.0 b) TX bytes:0 (0.0 b)Interrupt:177nf2c1 Link encap:Ethernet HWaddr 00:4E:46:32:43:01UP BROADCAST RUNNING PROMISC MULTICAST MTU:1986 Metric:1RX packets:0 errors:0 dropped:0 overruns:0 frame:0TX packets:0 errors:0 dropped:0 overruns:0 carrier:0collisions:0 txqueuelen:1000RX bytes:0 (0.0 b) TX bytes:0 (0.0 b)Interrupt:177nf2c2 Link encap:Ethernet HWaddr 00:4E:46:32:43:02UP BROADCAST PROMISC MULTICAST MTU:1986 Metric:1RX packets:0 errors:0 dropped:0 overruns:0 frame:0TX packets:0 errors:0 dropped:0 overruns:0 carrier:0collisions:0 txqueuelen:1000RX bytes:0 (0.0 b) TX bytes:0 (0.0 b)Interrupt:177nf2c3 Link encap:Ethernet HWaddr 00:4E:46:32:43:03UP BROADCAST PROMISC MULTICAST MTU:1986 Metric:1RX packets:0 errors:0 dropped:0 overruns:0 frame:0TX packets:0 errors:0 dropped:0 overruns:0 carrier:0collisions:0 txqueuelen:1000RX bytes:0 (0.0 b) TX bytes:0 (0.0 b)Interrupt:177编译生成bit文件(可选)编译OpenFlow Switch bit文件其实很简单。$ cd ~/netfpga/projects/openflow_switch/synth$make最后会在该目录下生成nf2_top_par.bit搭建测试环境按照之前图中所示网络环境,进行搭建。1. 设置PC1的千兆网卡,与NetFPGA nf2c0相连,并配置IP地址为10.0.0.2/242. 设置PC2的千兆网卡,与NetFPGA nf2c1相连,并配置IP地址为10.0.0.3/243. PC3是一台虚拟机,需要与PC0进行网络通信。我们使用VirtualBox 镜像,下载地址:运行OpenFlow Switch进入PC0$sudo /usr/local/sbin/cpci_reprogram.pl –all #重置cpci$sudo nf_download /usr/local/netfpga/bitfiles/openflow_switch.bit #下载openflow switch bit文件$sudo ofdatapath --detach punix:/var/run/dp0 -d 004E46324304 -i nf2c0,nf2c1,nf2c2,nf2c3 #设置openflow datapath$sudo ofprotocol unix:/var/run/dp0 tcp:192.168.10.106:6633 #与远程的controller进行通信$sudo dpctl dump-flows unix:/var/run/dp0 #显示Openflow Switch的flow table信息$sudo dpctl add-flow unix:/var/run/dp0 in_port=1,actions=output:2 #添加flow,端口1进来的数据发往端口2$sudo dpctl add-flow unix:/var/run/dp0 in_port=2,actions=output:1 #添加flow,端口2进来的数据发往端口1注:因为使用的reference controller, OpenFlow Switch中的flow-table是空的,可以在本地通过dpctl命令进行手动添加规则。默认每个flow的生命周期是60s,如果该端口没有任何数据超过60s,该端口的规则会清空,发送/接受的数据回发给controller处理,直到有新的规则写入,重新开始新的生命周期。进入PC3,运行虚拟机镜像,进入Ubuntu11.1系统$sudo dhclinet eth2 #虚拟机自动获取IP地址$controller ptcp:6633 #打开OpenFlow switch controller,开始监听6633端口信息。进入PC2
- 用大电流LDO为FPGA供电需要低噪声、低压差和快速瞬态响应(08-17)
- 基于FPGA 的谐波电压源离散域建模与仿真(01-30)
- 基于FPGA的VRLA蓄电池测试系统设计(06-08)
- 降低从中间总线电压直接为低电压处理器和FPGA供电的风险(10-12)
- FPGA和功能强大的DSP的运动控制卡设计(03-27)
- DE0-Nano-SoC 套件 / Atlas-SoC 套件(10-30)