Compare commits

...

18 Commits

Author SHA1 Message Date
XDL 29fc9b6afd 删除了附件中三个实验拓扑图,引用实验案例位置的图片
5 years ago
Xphi f5e4d4bf20 调整代码框行距、修正ENSP大小写问题、修正部分格式错误、完善方正系列字体设置
5 years ago
xphi 1604846d09 增加Linux与Mac下的编译脚本,增加Overleaf使用说明
5 years ago
xphi 90d5ae0cfb 替换第一章图片为PDF矢量图,修正一个错字
5 years ago
xphi a2bd9d2a53 修改字体设置
5 years ago
xphi 9771e99156 修正目录错误,更改附录实现方式
5 years ago
xphi 9c9d1d3eb3 调整主文件位置,适配Overleaf
5 years ago
xphi 9f2859956c 调整FAST介绍手册文件名,调整部分图片格式,移除不需要的图片
5 years ago
xphi f552f6edaf Merge commit 'e9eab4d95eee7c84cf4bc0ad1bcec7faaf2a367d'
5 years ago
夏竟 e9eab4d95e Merge branch 'branch-xdl' into 'branch-wudi'
5 years ago
XDL b1c36fe1f0 修改文件忘记添加了
5 years ago
xphi 52c2ebe577 Merge branch 'layout'
5 years ago
夏竟 ace3ce84cc Merge branch 'branch-xdl' into 'branch-wudi'
5 years ago
Xphi 7067b86081 清理格式,基础文档类调整为ctexbook
5 years ago
XDL 96d4c1292b 修改4,5单元内容,重点修改了附件C内容。从内容描述中去除了附件D的内容,并在ins文件中注释了附件D的加入
5 years ago
xphi 4b89a51914 初步将文档基础类初步迁移到ElegantBook
5 years ago
Xphi 7676abc0e8 Merge branch 'master' into general
5 years ago
Xphi 78ede2280d 更改第二章编者
5 years ago

@ -11,11 +11,11 @@
项目根目录下的目录功能如下:
* book实验指导书主文件
* data实验指导书分章节内容
* code参考代码
* config实验指导书格式配置文件
* figure用到的图片
* bib参考文献
* code参考代码
## 3. 编译
@ -29,16 +29,21 @@ pip install Pygments
1. Windows 环境下推荐使用最新版TeX Live套件然后在工程目录下运行以下命令编译
``` shell
cd book
compile.bat
```
2. MacOS 环境下推荐使用MacTex套件然后编译。
2. MacOS 环境下推荐使用MacTex套件然后在工程目录下运行以下命令编译
``` shell
./compile.sh
```
3. Linux 环境下推荐使用最新版TeX Live套件然后编译。
3. Linux 环境下推荐使用最新版TeX Live套件然后在工程目录下运行以下命令编译:
由于实验指导书较长,从头开始进行一次编译需要几分钟时间,请耐心等待。
``` shell
./compile.sh
```
## 4. 说明
4. 本文档支持在Overleaf在线编辑环境中编辑编译前需要将Compiler配置为XeLaTex。
项目主要结构参考了“Q-book LaTeX书籍模板”的早期版本
由于实验指导书较长,从头开始进行一次编译需要几分钟时间,请耐心等待

@ -1,192 +0,0 @@
%# -*- coding: utf-8-unix -*-
@article {EK85,
AUTHOR = {Ed Turner and Karen Gold},
TITLE = {Rubik's groups},
JOURNAL = {\textbf{\textit{American Mathematical Monthly}}},
VOLUME = {92},
NUMBER = {9},
PAGES = {617-629},
YEAR = {1985}
}
@article {G03,
AUTHOR = {Gabriel Navarro},
TITLE = {On the fundamental theorem of finite abelian groups},
JOURNAL = {\textbf{\textit{American Mathematical Monthly}}},
VOLUME = {110},
NUMBER = {2},
PAGES = {153-154},
YEAR = {2003}
}
@article {G64,
AUTHOR = {Gert Sabidussi},
TITLE = {Vertex-transitive graphs},
JOURNAL = {\textbf{\textit{Monatshefte fur Mathematik}}},
VOLUME = {68},
NUMBER = {5},
PAGES = {426-438},
YEAR = {1964}
}
@article {BDC64,
AUTHOR = { B.A. Kennedy and D.A. McQuarrie and Jr,C.H. Brubaker },
TITLE = {Group theory and isomerism},
JOURNAL = {\textbf{\textit{Inorganic Chemistry}}},
VOLUME = {3},
NUMBER = {2},
PAGES = {265-268},
YEAR = {1964}
}
@book{U05,
title = {\textbf{\textit{International Tables for Crystallography}}},
publisher = {Springer},
year = {2005},
edition = {5th edition},
author = { Uri Shmueli},
volume={ A}
}
@book{D65,
title = {\textbf{\textit{Molecular Symmetry}}},
publisher = {D. Van Nostrand},
year = {1965},
adress={London},
author = { David S. Schonland}
}
@book{ST69,
title = {\textbf{\textit{Theory of Groups and its Application to
Physical Problems}}},
publisher = { Academic Press},
year = {1969},
author = {S. Bhagavantam and T. Venkatarayudu},
address={ New York}
}
@book{D07,
title = {\textbf{\textit{Music: a Mathematical Offering}}},
publisher = { Cambridge University Press},
year = {2007},
author = { David J. Benson},
address={Cambridge CB2 2RU, UK}
}
@book{C78,
title = {\textbf{\textit{Field Theory and its Classic Problems}}},
publisher = {Mathematical Association of America},
year = {1978},
author = { Charles Robert Hadlock},
series={Number 19 in
Carus Mathematical Monographs}
}
@book{WI64,
title = {\textbf{\textit{ Groups and their Graphs}}},
publisher = {Mathematical Association of America},
year = {1964},
author = { Wilhelm Magnus and Israel Grossman},
series={Anneli Lax New
Mathematical Library}
}
@book{HBE02,
title = {The SmallGroups library
—— a GAP package},
year = {2002},
author = { Hans Ulrich Besche and Bettina Eick and Eamonn O'Brien}
}
@book{JS03,
title = {Classification of finite abelian groups},
publisher={ Course notes available on
the World Wide Web},
year = {2003},
author = { John M. Sullivan}
}
@book{P88,
title = {\textbf{\textit{Group representations in probability and statistics}}},
publisher = { Academic Press},
year = {1988},
author = { Persi Diaconis},
address={ Institute of Mathe-
matical Statistics, Hayward, CA},
series={Institute of
Mathematical Statistics Lecture Notes——Monograph Series,11}
}
@online {J05,
AUTHOR = {Jonathan Goss},
TITLE = {Point group symmetry},
URL = {www.phys.ncl.ac.uk/staff/njpg/symmetry/},
YEAR = {2005}
}
@online {L03,
AUTHOR = {Larry Copes},
TITLE = {Representations of contra dance moves},
URL = { www.edmath.org/copes/contra/representations.html},
YEAR = {2003}
}
@online {I03,
AUTHOR = { Ivars Peterson},
TITLE = { Contra dances, matrices, and groups},
URL = {www.sciencenews.org/articles/20030308/mathtrek.asp},
YEAR = {2003}
}
@book{M91,
author = {Michael Artin},
title = { \textbf{\textit{Algebra}}},
publisher = {Prentice Hall},
address = { Englewood Cliffs, NJ},
year = {1991}
}
@book{J02,
title = {\textbf{\textit{A First Course in Abstract Algebra}}},
publisher = {Addison-Wesley},
address = { Reading, MA},
year = {2002},
edition = {seventh edition},
author = { John B. Fraleigh}
}
@book{D01,
title = {\textbf{\textit{Solved and Unsolved Problems in Number Theory}}},
publisher = {American
Mathematical Society Chelsea Publishing},
address = { Providence, RI},
year = {2001},
edition = {fourth edition},
author = { Daniel Shanks}
}
@book{J04,
title = {\textbf{\textit{Contemporary Abstract Algebra}}},
publisher = {Houghton Mifflin Company},
year = {2004},
author = { Joseph Gallian}
}
@book{E30,
title = {\textbf{\textit{Algebraic Equations, An Introduction to the Theories of Lagrange
and Galois}}},
publisher = {Columbia University Press},
year = {1930},
author = { Edgar Dehn},
adress={New York}
}

@ -1,71 +0,0 @@
@echo off
chcp 65001 >nul
set flag=%1
if %flag%x == x (
set flag=instr
)
if %flag%x == instrx (
call :cleanall
call :instr
if ERRORLEVEL 1 (
echo Error! Please check the 'instructions.log' for more details...
pause
) else (
call :clean
echo Finished!
)
goto :EOF
)
if %flag%x == cleanx (
call :clean
goto :EOF
)
if %flag%x == cleanallx (
call :cleanall
goto :EOF
)
:help
echo This is the compile batch script for CNAP Instructions.
echo Usage:
echo make.bat [option]
echo options:
echo instr Compile the instructions book (default)
echo clean Clean all work files
echo cleanall Clean all work files and generated pdf
echo help Print this help message
goto :EOF
:instr
echo Compile...
latexmk -xelatex -shell-escape --halt-on-error -silent instructions >nul 2>nul
goto :EOF
:clean
echo Clean files...
latexmk -c -silent 2>nul
del instructions.bbl >nul 2>nul
del instructions.listing >nul 2>nul
del instructions.xdv >nul 2>nul
del instructions.run.xml >nul 2>nul
rmdir /S /Q _minted-instructions >nul 2>nul
goto :EOF
:cleanall
echo Clean files...
latexmk -C -silent 2>nul
del instructions.bbl >nul 2>nul
del instructions.listing >nul 2>nul
del instructions.xdv >nul 2>nul
del instructions.run.xml >nul 2>nul
rmdir /S /Q _minted-instructions >nul 2>nul
if exist instructions.pdf (
echo Close the file: instructions.pdf!
pause
call :cleanall
)
goto :EOF

@ -1,23 +0,0 @@
%# -*- coding: utf-8-unix -*-
%======================================================================
%% Book Configurations
%======================================================================
\ProvidesFile{qbook.cfg}[2019/03/19 v1.00 Qbook configuration file]
\def\q@contentsname{目~~~~录}
\def\q@figurename{图}
\def\q@listfigurename{插图索引}
\def\q@tablename{表}
\def\q@listtablename{表格索引}
\def\q@overviewname{概~~~~览}
\def\q@pre{前~~~~言}
\def\q@label@thm{定理}
\def\q@label@defn{定义}
\def\q@label@keypoint{关键点}
\def\q@label@rem{注}
\def\q@label@prop{性质}
\def\q@label@proof{证明}
\def\q@label@lem{引理}
\def\q@label@cor{推论}
\def\q@label@exmp{例}
\def\q@value@listingname{算法}
\endinput

@ -1,425 +0,0 @@
%# -*- coding: utf-8-unix -*-
%=========================================================================
% instructions.cls for Computer Network Assigenment & Project Instructions
%=========================================================================
\NeedsTeXFormat{LaTeX2e}[1995/12/01]
\ProvidesClass{instructions}[2019/05/16 v2.01 Qbook Template]
\def\version{v2.01}
\DeclareOption*{\PassOptionsToClass{\CurrentOption}{ctexbook}}
\ProcessOptions\relax
\PassOptionsToClass{scheme=chinese}{ctexbook}
\PassOptionsToClass{zihao=-4}{ctexbook}
\PassOptionsToPackage{no-math}{fontspec}
\LoadClass[a4paper,UTF8]{ctexbook}
%========================================================================
% instructions.cfg
\AtEndOfClass{\input{instructions.cfg}}
%========================================================================
% LaTeX
\RequirePackage{extarrows}
\RequirePackage{eso-pic}
\RequirePackage{url}
\RequirePackage{environ}
\RequirePackage{manfnt,pifont}
\RequirePackage{titlesec}
\RequirePackage{float}
\RequirePackage{wallpaper}
\RequirePackage[breakable,minted]{tcolorbox}
\RequirePackage{xpatch}
\RequirePackage[centering,a4paper,body={16cm,22cm}]{geometry}
\RequirePackage{fancyhdr}
\RequirePackage{lastpage}
\RequirePackage{amsmath,mathtools,amsthm,amsfonts,amssymb,bm}
% \RequirePackage{sourcecodepro}
\RequirePackage{upgreek}
\RequirePackage{wasysym}
\RequirePackage{anyfontsize}
\RequirePackage{metalogo,doc}
\RequirePackage{array}
\RequirePackage{threeparttable}
\RequirePackage{dcolumn}
\RequirePackage{multirow}
\RequirePackage{booktabs}
\RequirePackage{graphicx}
\RequirePackage[labelformat=empty]{caption}
\RequirePackage[list=off]{bicaption}
\RequirePackage{subcaption}
\RequirePackage[backend=biber, hyperref=auto,maxnames=4]{biblatex}
\RequirePackage{xcolor}
\RequirePackage{listings}
\RequirePackage[unicode, xetex, bookmarksnumbered, colorlinks, urlcolor=blue, linkcolor=purple, citecolor=red, plainpages=false, pdfstartview=FitH]{hyperref}
\RequirePackage{bookmark}
\bookmarksetup{
open,
numbered
}
\RequirePackage{longtable}
\RequirePackage[perpage, bottom]{footmisc}
\RequirePackage[inline]{enumitem}
\RequirePackage{pdfpages}
\RequirePackage{calc}
\RequirePackage{algorithm, algorithmicx, algpseudocode}
\RequirePackage{siunitx}
\RequirePackage{tikz}
\usepackage{titlesec}
\newcommand{\sectionbreak}{\clearpage}
\usepackage{setspace}
\usepackage{lscape}
% \usepackage{makecell}
%======================================================================
% tikz
\usetikzlibrary{shapes.geometric, arrows}
\usetikzlibrary{shapes,decorations}
\usetikzlibrary{intersections,decorations.text}
%======================================================================
% PDF
\hypersetup{
pdfauthor = {},
pdftitle = {},
pdfkeywords = {}}
%======================================================================
%
\g@addto@macro\backmatter{
\renewcommand{\em}{\itshape} %
\renewcommand{\refname}{}
\renewcommand{\bibname}{}
}
\DefineBibliographyStrings{english}{%
in = {},
editor = {},
byeditor = {},
}
%======================================================================
%
\newcommand{\watermark}[3]{\AddToShipoutPictureBG{
\parbox[b][\paperheight]{\paperwidth}{
\vfill%
\centering%
\tikz[remember picture, overlay]%
\node [rotate = #1, scale = #2] at (8.5,-13)%
{\textcolor{gray!80!cyan!30}{#3}};
\vfill}}}
%======================================================================
%
\definecolor{ocre}{RGB}{243,102,25}
\definecolor{LightGoldenrod}{RGB}{238,221,130}
\definecolor{sthlmGreen}{RGB}{0,134,127}
\definecolor{Gold}{RGB}{255,215,0}
\definecolor{C1}{RGB}{32,88,153}
\definecolor{C2}{RGB}{218,222,238}
\definecolor{tssteelblue}{RGB}{0,40,220}
\definecolor{tsorange}{RGB}{255,138,88}
\definecolor{tsblue}{RGB}{23,74,117}
\definecolor{tsforestgreen}{RGB}{21,122,81}
\definecolor{tsyellow}{RGB}{255,185,88}
\definecolor{tsgrey}{RGB}{200,200,200}
\definecolor{main}{RGB}{0,120,2}
\definecolor{seco}{RGB}{230,90,7}%
\definecolor{thid}{RGB}{0,160,152}%
\definecolor{bule}{RGB}{18,29,57}
\definecolor{bablue}{RGB}{248,248,248}
\definecolor{c1}{RGB}{116, 52, 129}
\definecolor{c2}{RGB}{130, 80, 140}
\definecolor{c3}{RGB}{230, 180, 240}
\definecolor{c4}{RGB}{100, 172, 174}
\definecolor{c5}{RGB}{95, 162, 162}
%======================================================================
% yyyy-mm-dd
\def\twodigits#1{\ifnum#1<10 0\fi\the#1}
\renewcommand{\today}{\number\year-\twodigits\month-\number\day}
%======================================================================
\setcounter{secnumdepth}{4} % (part -1)
\setcounter{tocdepth}{1} % (part -1)
\newcolumntype{d}[1]{D{.}{.}{#1}}% or D{.}{,}{#1} or D{.}{\cdot}{#1}
%======================================================================
\newcommand{\cndash}{\rule{0.0em}{0pt}\rule[0.35em]{1.4em}{0.05em}\rule{0.2em}{0pt}}
\newcommand{\ch}{\titleformat{\chapter}[display]{\centering}{}{-3mm}{\Huge\bfseries}
\titlespacing{\chapter}{0pt}{0pt}{2\baselineskip}}%
%======================================================================
%
\linespread{1.3}
%======================================================================
%
\ctexset{contentsname={\q@contentsname}}
\ctexset{listfigurename={\q@listfigurename}}
\ctexset{listtablename={\q@listtablename}}
\renewcommand{\lstlistingname}{\q@value@listingname}
%======================================================================
%
\ctexset{chapter/name={,}}
\titleformat{\chapter}[display]{\flushleft}{
\begin{tikzpicture}
\node[anchor=south west] (chap) at (0,1.3){
\Large\heiti {\zhnumber{\thechapter}}};
\path [left color=c1,right color=c3] (0,-0.3) rectangle (\textwidth,-0.5);
\path(0,-0.2);
\end{tikzpicture}
}{-30mm}{\Huge\heiti}
\titlespacing{\chapter}{0pt}{0pt}{2\baselineskip}
%======================================================================
% section
\ctexset{section/break = \Needspace{\textheight}}
\ctexset{section={
name={},
format={\color{tssteelblue}\Large\bfseries\centering},
afterskip={1.0ex \@plus .2ex},
}
}
%======================================================================
% subection
\ctexset{subsection={
format={\color{tssteelblue}\bfseries\normalsize},
indent={0\ccwd},
afterskip={1.0ex \@plus .2ex},
number={\chinese{subsection}~.}
}
}
%======================================================================
% subsubection
\ctexset{subsubsection={
format={\bfseries\normalsize},
indent={0\ccwd},
afterskip={1.0ex \@plus .2ex},
number={\arabic{subsection}.\arabic{subsubsection}}
}
}
%======================================================================
% paragraph
\ctexset{paragraph={
format={\normalfont\normalsize},
indent={0\ccwd},
number={\arabic{subsection}.\arabic{subsubsection}.\arabic{paragraph}}
}
}
%======================================================================
% itembullet
\renewcommand{\labelitemi}{\ensuremath{\RHD}}
%======================================================================
%
\DeclareGraphicsExtensions{.pdf,.eps,.png,.jpg,.jpeg}
%======================================================================
%
\DeclareCaptionFont{kaishu}{\kaishu}
\captionsetup{format=plain,labelformat=simple,labelsep=space,justification=centering,font={small,kaishu}}
\captionsetup[sub]{font=footnotesize}
\DeclareCaptionOption{bi-first}[]{
\def\tablename{\q@tablename}
\def\figurename{\q@figurename}
}
\DeclareCaptionOption{bi-second}[]{
\def\tablename{Table}
\def\figurename{Figure}
}
\captionsetup[bi-first]{bi-first}
\captionsetup[bi-second]{bi-second}
%======================================================================
% Set fontnote font size in threeparttable
\appto\TPTnoteSettings{\footnotesize}
%======================================================================
%
\renewcommand{\textfraction}{0.15}
\renewcommand{\topfraction}{0.85}
\renewcommand{\bottomfraction}{0.65}
\renewcommand{\floatpagefraction}{0.60}
%======================================================================
% "3.1"
\numberwithin{figure}{section}
\numberwithin{table}{section}
\renewcommand{\theequation}{\arabic{chapter}.\arabic{equation}}
\renewcommand{\thefigure}{\arabic{chapter}.\arabic{section}--\arabic{figure}}
\renewcommand\p@subfigure{\thefigure}
\renewcommand{\thetable}{\arabic{chapter}.\arabic{section}--\arabic{table}}
\AtBeginDocument{\renewcommand{\thelstlisting}{\arabic{chapter}--\arabic{lstlisting}}}
%======================================================================
% 使enumitem
\setlist{nosep} %
\setlist[itemize]{label=$\bullet$}
\setlist*{leftmargin=*} %
\setlist[1]{labelindent=\parindent} % Only the level 1
%======================================================================
% listings/lstlistings
\lstset{
tabsize=4, %
frame=shadowbox, %
commentstyle=\color{red!50!green!50!blue!50}, %
rulesepcolor=\color{red!20!green!20!blue!20}, %
keywordstyle=\color{blue!90}\bfseries, %
showstringspaces=false, %
stringstyle=\ttfamily, %
keepspaces=true, %
numbers=left, %
stepnumber=1, %
numberstyle=\tiny, %
basicstyle={\footnotesize\ttfamily}, %
showspaces=false, %
flexiblecolumns=true, %
breaklines=true, %
breakautoindent=true, %
breakindent=4em, %
aboveskip=1em, %
fontadjust,
captionpos=t,
framextopmargin=2pt,framexbottommargin=2pt,abovecaptionskip=-9pt,belowcaptionskip=9pt,
xleftmargin=2em,xrightmargin=2em, % listing
texcl=true,
% listing
extendedchars=false,columns=flexible,mathescape=true
numbersep=-1em
}
%======================================================================
% Setting Package siunitx
\sisetup{detect-all} % Detecting fonts
%======================================================================
% keypoint
\tcbset{
commondef/.style={
fontupper=\kaishu,
lower separated=false,
coltitle=white,
colback=yellow!20,
fonttitle=\heiti\bfseries,
enhanced,
breakable,
top=10pt,
left=8pt,
% bottom=6pt,
before skip=8pt,
attach boxed title to top left={yshift=-0.11in,xshift=0.15in},
boxed title style={boxrule=0pt,colframe=white,arc=0pt,outer arc=0pt},
},
commonthm/.style={
fontupper=\kaishu,
lower separated=false,
coltitle=white,
colback=blue!10,
fonttitle=\heiti\bfseries,
enhanced,
breakable,
top=10pt,
% bottom=6pt,
before skip=8pt,
attach boxed title to top left={yshift=-0.11in,xshift=0.15in},
boxed title style={boxrule=0pt,colframe=white,arc=0pt,outer arc=0pt},
},
common/.style={
fontupper=\kaishu,
lower separated=false,
coltitle=white,
colback=gray!10,
fonttitle=\heiti\bfseries,
enhanced,
breakable,
top=10pt,
% bottom=6pt,
before skip=8pt,
attach boxed title to top left={yshift=-0.11in,xshift=0.15in},
boxed title style={boxrule=0pt,colframe=white,arc=0pt,outer arc=0pt},
},
defstyle/.style={
commondef,
colframe=seco,
colbacktitle=seco,
overlay unbroken and last={\node[anchor=south east, outer sep=6pt] at (\textwidth-width,0) {\textcolor{seco}{$\clubsuit$}}; },
separator sign none
},
thmstyle/.style={
common,
colframe=main,
colbacktitle=main,
overlay unbroken and last={\node[anchor=south east, outer sep=6pt] at (\textwidth-width,0) {\textcolor{main}{$\heartsuit$}}; },
separator sign none
},
propstyle/.style={
common,
colframe=thid,
colbacktitle=thid,
overlay unbroken and last={\node[anchor=south east, outer sep=6pt] at (\textwidth-width,0) {\textcolor{thid}{$\spadesuit$}}; },
separator sign none
},
}
\newenvironment{remark}
{\begin{observation}} {\end{observation}}
%======================================================================
% x.y
\newcommand{\requ}[1]{(\ref{#1})}
\newcommand{\rremark}[1]{\text{{\color{purple}{}}} \ref{#1}}
\newcommand{\rfig}[1]{\text{{\color{purple}{}}} \ref{#1}}
\newcommand{\rtab}[1]{\text{{\color{purple}{}}} \ref{#1}}
\newcommand{\rprop}[1]{\text{{\color{purple}{}}} \ref{#1}}
\newcommand{\rdef}[1]{\text{{\color{purple}{}}} \ref{#1}}
\newcommand{\rthm}[1]{\text{{\color{purple}{}}} \ref{#1}}
\newcommand{\mylem}[1]{\text{} \ref{#1}}
\newcommand{\rexa}[1]{\text{{\color{purple}{}}} \ref{#1}}
\renewcommand{\proofname}{\bfseries\q@label@proof}
%======================================================================
%
\newcommand\q@fancyhead{\small\kaishu}
\def\markboxwidth{0.75\textwidth}
\pagestyle{fancy}
\fancyhf{}
\renewcommand{\chaptername}{\zhnumber{\thechapter}}
\renewcommand{\chaptermark}[1]{\markboth{\chaptername\ #1}{}}
\fancyhead[LE,RO]{\sffamily\normalsize\thepage} %
\fancyhead[LO]{\nouppercase{\q@fancyhead\rightmark}} %
\fancyhead[RE]{\nouppercase{\q@fancyhead\leftmark}} %
\renewcommand{\headrulewidth}{0.5pt}
\addtolength{\headheight}{2.5pt}
\renewcommand{\footrulewidth}{0pt}
\fancypagestyle{plain}{\fancyhead{}\renewcommand{\headrulewidth}{0pt}}
%======================================================================
% Removes the header from odd empty pages at the end of chapters
% \makeatletter
% \renewcommand{\cleardoublepage}{
% \clearpage\ifodd\c@page\else
% \hbox{}
% \vspace*{\fill}
% \thispagestyle{empty}
% \newpage
% \fi}
%======================================================================
%
\newenvironment{pre}{
\ch\chapter{\q@pre}{}}{}
%======================================================================
%
\newenvironment{overview}{
\ch\chapter{\q@overviewname}{}}{}
%======================================================================
%
\renewcommand\tableofcontents{%
\cleardoublepage
\pdfbookmark[0]{\contentsname}{toc}
\chapter*{\centerline{\contentsname}}
\@mkboth{\MakeUppercase\contentsname}{\MakeUppercase\contentsname}%
\@starttoc{toc}%
}
\addtocontents{toc}{\let\string\CTEX@spaceChar\relax}
%======================================================================
%
\newtcblisting{code}[1][]{
center,
width=0.95\linewidth,
listing only,
breakable=true,
minted language=#1,
% frame empty,
extras={frame empty},
% minted style=colorful,
fontupper=\small,
minted options={ %4mathhe||
breaksymbol=,
autogobble,
tabsize=4,
startinline,
breaklines,
mathescape
}
}
%======================================================================
\renewcommand{\baselinestretch}{1.5}
\endinput

@ -1,128 +0,0 @@
%# -*- coding: utf-8-unix -*-
%=========================================================================
% instructions.tex for Computer Network Assigenment & Project Instructions
%=========================================================================
% 双面打印
% \documentclass[fontset=fandol]{../format/instructions}
\documentclass[]{instructions}
\addbibresource{../bib/main.bib} % 导入参考文献数据库
\begin{document}
\pagestyle{empty}
\input{../data/cover} % 载入封面
%=========================================================================
% 版本声明
\clearpage
\begin{center}
\Large{Version 1.0$\alpha$} \\ \vspace{2em}
\Large{发布日期: {\number\year\number\month\number\day}}
% \\ \vspace{1em}
\end{center}
% \vfill
% \vspace{30em}
% \begin{tabular*}{\textwidth}{ccc}
% \includegraphics{figure/by-nc.eps}
% & \begin{minipage}[b]{0.6\textwidth}
% \small\sffamily
% 本作品采用知识共享 署名-非商业性使用 4.0 国际许可协议进行许可。\\
% 访问~\href{http://creativecommons.org/licenses/by-nc/4.0/}{此链接}~查看该许可协议。
% \end{minipage}
% \end{tabular*}
%=========================================================================
% 前言
\thispagestyle{empty}
\frontmatter % 对前言和概览用罗马数字作为页码
\pagestyle{empty}
\input{../data/preface}
%=========================================================================
% 目录
\cleardoublepage
\pagestyle{empty}
\tableofcontents
\mainmatter % 对正文用阿拉伯数字作为页码
%======================================================================
% 正文内容
\pagestyle{fancy}
\setcounter{page}{1}
% “网络抓包与协议分析”
\graphicspath{{../figure/chapters/wireshark/}}
\input{../data/ch_wireshark/preface}
\input{../data/ch_wireshark/sec_arp}
\input{../data/ch_wireshark/sec_ip}
\input{../data/ch_wireshark/sec_tcp}
% “基于套接字的网络程序设计”
\graphicspath{{../figure/chapters/socket/}}
\input{../data/ch_socket/preface}
\input{../data/ch_socket/sec_udp}
\input{../data/ch_socket/sec_web}
\input{../data/ch_socket/sec_smtp}
% “组网基础”
\graphicspath{{../figure/chapters/ensp/}}
\input{../data/ch_ensp/preface}
\input{../data/ch_ensp/sec_static}
\input{../data/ch_ensp/sec_rip}
\input{../data/ch_ensp/sec_ospf}
% “路由器实现”
\graphicspath{{../figure/chapters/router-openbox/}}
\input{../data/ch_router-openbox/preface}
\input{../data/ch_router-openbox/sec_switch}
\input{../data/ch_router-openbox/sec_router}
\input{../data/ch_router-openbox/sec_networking}
% “软件定义网络与网络测量”
\graphicspath{{../figure/chapters/sdn-openbox/}}
\input{../data/ch_sdn-openbox/preface}
\input{../data/ch_sdn-openbox/sec_sdn}
\input{../data/ch_sdn-openbox/sec_topo}
\input{../data/ch_sdn-openbox/sec_ns}
%=========================================================================
% 附录
\appendix
\titleformat{\chapter}[display]{\flushleft}{
\begin{tikzpicture}
\node[anchor=south west] (chap) at (0,1.3){
\Large\heiti {附录\Alph{chapter}}};
\path [left color=c1,right color=c3] (0,-0.3) rectangle (\textwidth,-0.5);
\path(0,-0.2);
\end{tikzpicture}
}{-30mm}{\Huge\heiti}
\titlespacing{\chapter}{0pt}{0pt}{2\baselineskip}
\renewcommand{\thefigure}{\Alph{chapter}--\arabic{figure}}
\renewcommand{\thetable}{\Alph{chapter}--\arabic{table}}
\renewcommand{\chaptername}{附录\Alph{chapter}}
% 速查手册
\graphicspath{{../figure/appendixes/cheat_sheet/}}
\input{../data/appendix/cheat_sheet}
% 华为网络仿真平台eNSP简介
\graphicspath{{../figure/appendixes/ensp/}}
\input{../data/appendix/ensp}
% 可编程网络平台-操作手册
\graphicspath{{../figure/appendixes/openbox/}}
\input{../data/appendix/openbox}
% FAST软件编程入门指南
\graphicspath{{../figure/appendixes/fast/}}
\input{../data/appendix/fast}
\backmatter
%======================================================================
% 参考文献
% \printbibliography[heading=bibintoc]
% \makeatletter
% \makeatother
\end{document}

@ -0,0 +1,11 @@
@echo off
echo Compiling...
latexmk -xelatex -shell-escape --halt-on-error -silent instructions >nul 2>nul
echo Done!
echo Clean files...
latexmk -c -silent 2>nul
del instructions.listing >nul 2>nul
del instructions.xdv >nul 2>nul
rmdir /S /Q _minted-instructions >nul 2>nul
echo Done!

@ -0,0 +1,12 @@
#!/bin/bash
echo Compiling...
latexmk -xelatex -shell-escape --halt-on-error -silent instructions > /dev/null 2>&1
echo Done!
echo Clean files...
latexmk -c -silent > /dev/null 2>&1
rm instructions.listing > /dev/null 2>&1
rm instructions.xdv > /dev/null 2>&1
rm -r _minted-instructions > /dev/null 2>&1
echo Done!

@ -0,0 +1,195 @@
%# -*- coding: utf-8-unix -*-
%============================================================================
% 基本库
\usepackage{longtable}
\usepackage{multirow}
\usepackage{array}
\usepackage{caption}
\usepackage{lscape}
\usepackage{fancyhdr}
\usepackage{newtxtext}
\usepackage{amsmath,mathtools,amsthm,amsfonts,amssymb,bm}
\usepackage{titlesec}
\usepackage[colorlinks,bookmarksnumbered,urlcolor=blue,
linkcolor=purple,citecolor=red,plainpages=false]{hyperref}
\usepackage[centering,a4paper,body={16cm,22cm}]{geometry}
%============================================================================
% 配制全局字体
% \setmonofont{inconsolata} % 使用 inconsolata 等宽字体
% % 使用方正系列字体
% \setCJKmainfont[BoldFont={FZHei-B01},ItalicFont={FZKai-Z03}]{FZShuSong-Z01}
% \setCJKfamilyfont{zhsong}{FZShuSong-Z01}
% \setCJKfamilyfont{zhhei}{FZHei-B01}
% \setCJKfamilyfont{zhkai}{FZKai-Z03}
% \setCJKfamilyfont{zhfs}{FZFangSong-Z02}
% \setCJKfamilyfont{zhli}{FZLiShu-S01}
% \renewcommand*{\songti}{\CJKfamily{zhsong}} % 宋体
% \renewcommand*{\heiti}{\CJKfamily{zhhei}} % 黑体
% \renewcommand*{\kaishu}{\CJKfamily{zhkai}} % 楷体
% \renewcommand*{\fangsong}{\CJKfamily{zhfs}} % 仿宋
% \renewcommand*{\lishu}{\CJKfamily{zhli}} % 隶书
% \setCJKsansfont{FZHei-B01} % 中文无衬线字体
% \setCJKmonofont{FZHei-B01} % 中文等宽字体
%============================================================================
% 配制列表环境
\usepackage{enumitem}
\setlist{nosep} % 紧凑间距
\setlist*{leftmargin=*} % 列表和段落头对齐
\setlist[1]{labelindent=\parindent} % Only the level 1
%============================================================================
% 绘图支持
\usepackage{tikz}
\definecolor{c1}{RGB}{116, 52, 129} %清华紫
\definecolor{c2}{RGB}{130, 80, 140}
\definecolor{c3}{RGB}{230, 180, 240}
%============================================================================
% 定制代码框
\usepackage[breakable,minted]{tcolorbox}
\newtcblisting{code}[1][]{
center,
width=0.95\linewidth,
listing only,
breakable=true,
minted language=#1,
extras={frame empty},
fontupper=\linespread{1.3}\small,
% minted style=colorful,
minted options={ %自动移除前置空白、制表为4字符、mathhe和||内的不处理
fontfamily=tt,
breaksymbol=,
autogobble,
tabsize=4,
startinline,
breaklines,
mathescape
}
}
%============================================================================
% 设置 PDF 文件信息
\hypersetup{
pdfauthor = {计算机网络教案社区},
pdftitle = {实验指导书},
pdfkeywords = {计算机网络}}
%============================================================================
% 文档风格
\ctexset{today=small}
\ctexset{contentsname=目~~~~录}
\setcounter{secnumdepth}{4} % 章节编号深度 (part 对应 -1)
\setcounter{tocdepth}{1} % 目录深度 (part 对应 -1)
%============================================================================
% 每节单独起一页
\newcommand{\sectionbreak}{\clearpage}
%============================================================================
% 居中章节标题
\newenvironment{pre}{
\titleformat{\chapter}[display]{\centering}{}{-3mm}{\Huge\heiti}
\titlespacing{\chapter}{0pt}{0pt}{2\baselineskip}
\chapter{前~~~~言}{}
}{}
%============================================================================
% chapter级样式设置
\ctexset{chapter/name = {第,单元}}
\titleformat{\chapter}[display]{\flushleft}{
\begin{tikzpicture}
\node[anchor=south west] (chap) at (0,1.3){
\Large\heiti {\chaptername}};
\path[left color=c1,right color=c3]
(0,-0.3)rectangle(\textwidth,-0.5);
\end{tikzpicture}
}{-30mm}{\Huge\heiti}
\titlespacing{\chapter}{0pt}{0pt}{2\baselineskip}
%============================================================================
% section级样式设置
\ctexset{section/break = \Needspace{\textheight}}
\ctexset{section={
name={实验},
format={\Large\heiti\centering},
afterskip={1.0ex \@plus .2ex},
}
}
%============================================================================
% subection级样式设置
\ctexset{subsection={
format={\bfseries\heiti\normalsize},
indent={0\ccwd},
afterskip={1.0ex \@plus .2ex},
number={\chinese{subsection}~.}
}
}
%============================================================================
% subsubection级样式设置
\ctexset{subsubsection={
format={\bfseries\bfseries\normalsize},
indent={0\ccwd},
afterskip={1.0ex \@plus .2ex},
number={\arabic{subsection}.\arabic{subsubsection}}
}
}
%============================================================================
% paragraph级样式设置
\ctexset{paragraph={
format={\normalfont\normalsize},
indent={0\ccwd},
number={\arabic{subsection}.\arabic{subsubsection}.\arabic{paragraph}}
}
}
%============================================================================
% 设置页眉与页脚样式
\def\markboxwidth{0.75\textwidth}
\pagestyle{fancy}
\fancyhf{}
\renewcommand{\chaptername}{\zhnumber{\thechapter}单元}
\renewcommand{\chaptermark}[1]{\markboth{\chaptername\ #1}{}}
% 在奇数页的右上角显示页码,偶数页的左上角显示页码
\fancyhead[LE,RO]{\sffamily\normalsize\thepage}
\fancyhead[LO]{\nouppercase{\small\kaishu\rightmark}} % 在奇数页的左侧显示小节名
\fancyhead[RE]{\nouppercase{\small\kaishu\leftmark}} % 在偶数页的右侧显示章名
\renewcommand{\headrulewidth}{0.5pt}
\addtolength{\headheight}{2.5pt}
\renewcommand{\footrulewidth}{0pt}
\fancypagestyle{plain}{\fancyhead{}\renewcommand{\headrulewidth}{0pt}}
%============================================================================
% 设置图片的标题样式
\DeclareCaptionFont{heiti}{\heiti}
\captionsetup{format=plain,labelformat=simple,
labelsep=space,justification=centering,
font={small,heiti}}
\captionsetup[sub]{font=footnotesize}
%============================================================================
% 设置图、表的号
\numberwithin{figure}{section}
\numberwithin{table}{section}
\renewcommand{\thefigure}{\arabic{chapter}.\arabic{section}--\arabic{figure}}
\renewcommand{\thetable}{\arabic{chapter}.\arabic{section}--\arabic{table}}
%============================================================================
% 设置目录格式
\makeatletter
\renewcommand\tableofcontents{%
\cleardoublepage
\pdfbookmark[0]{\contentsname}{toc}
\chapter*{\centerline{\Huge\heiti\contentsname}}
\@mkboth{\MakeUppercase\contentsname}{\MakeUppercase\contentsname}%
\@starttoc{toc}%
}
\addtocontents{toc}{\let\string\CTEX@spaceChar\relax}
\makeatother
%============================================================================
% 行距缩放
\linespread{1.5}
\renewcommand{\arraystretch}{1}
%============================================================================
% 调整附录格式
\let\stdappendix\appendix
\renewcommand{\appendix}{
\stdappendix
\renewcommand{\thefigure}{\Alph{chapter}--\arabic{figure}}
\renewcommand{\thetable}{\Alph{chapter}--\arabic{table}}
\renewcommand{\chaptername}{附录\Alph{chapter}}
}

@ -21,8 +21,6 @@
各实验如有特殊要求,还在正文中指出了各自的细节评分标准。
\end{itemize}
\renewcommand{\arraystretch}{1.5}
\begin{table}[!ht]
\small
\centering
@ -107,18 +105,17 @@
\tabitem{了解开发简单应用程序的流程。}
& 4 & $\star\star\star$ \\ \hline
组网基础
\multirow{2}{1.5cm}{\centering 组网基础}
& 静态路由 &
\tabitem{掌握静态路由协议;} \par
\tabitem{理解路由器工作原理;} \par
\tabitem{掌握路由器相关的配置、检测操作。}
& 2 & $\star$ \\ \hline
& 2 & $\star$ \\ \cline{2-5}
\multirow{2}{1.5cm}{\centering 组网基础}
& 动态路由RIP &
\tabitem{理解动态路由协议RIP的工作原理} \par
\tabitem{掌握采用动态路由协议RIP进行网络设计的基本原则和方法。}
& 2 & $\star\star$ \\ \cline{2-5}
& 2 & $\star\star$ \\ \hline
& 动态路由OSPF &
\tabitem{理解动态路由协议OSPF的工作原理} \par
@ -157,7 +154,6 @@
\begin{landscape}
\renewcommand{\arraystretch}{1.5}
\small
\begin{longtable}{|m{1.5cm}<{\centering}
|m{2cm}<{\centering}

@ -17,7 +17,6 @@
eNSP的正常实验依赖与WinPcap、Wireshark和VirtualBox三款软件
支持的版本如下表。
\renewcommand{\arraystretch}{1.5}
\begin{table}[!ht]
\small
\centering
@ -66,7 +65,6 @@ eNSP的正常实验依赖与WinPcap、Wireshark和VirtualBox三款软件
系统的所有命令都注册在某个(或某些)命令视图下,
只有在相应的视图下才能执行该视图下的命令。
\renewcommand{\arraystretch}{1.5}
\begin{table}[!ht]
\small
\centering
@ -137,7 +135,6 @@ Tab键的功用完成一个命令的输入。在超级终端中可能不
\item 命令行错误信息
\end{itemize}
\renewcommand{\arraystretch}{1.5}
\begin{table}[!ht]
\small
\centering

@ -1,416 +1,250 @@
%# -*- coding: utf-8-unix -*-
\chapter{FAST软件编程入门指南}
\label{app:fast}
\subsection{前言}
本文档的主要阅读对象是首次使用FAST平台进行软件开发的工作人员。
文档主要描述了FAST架构软件的主要功能、如何获取软件代码、
介绍软件架构与对应代码结构、编译运行FAST代码。
详细介绍了FAST开发的主要使用函数
描述了用户如何使用开发函数进行自己代码的开发流程,
最后提供一个完整的开发示例说明,供初学者学习使用。
\subsection{FAST能做什么}
FAST平台的主要功能是软硬件配合的网络分组处理功能
硬件的主要作用是解析报文,对报文进行查表匹配,
进行指定的动作处理,然后分发报文。
报文分发可以直接转发到硬件端口也可以送到CPU端的UA进程再处理
UA处理完成后可以再通过硬件转发从端口输出。
软件的主要功能有两点:
一是对硬件的流表与对应动作进行配置指定报文从硬件端口转发或送到CPU端的UA
二是处理硬件无法处理的报文,处理完成后再转发到硬件输出。
FAST软件的编程主要包括UA编程、规则管理编程和寄存器访问控制编程。
UA编程主要处理硬件送到指定软件的分组数据
规则管理编程主要是对硬件流表的读写管理;
寄存器访问控制编程主要是对硬件各寄存器资源的访问控制。
对硬件规则的读写与对硬件其他寄存器的读写需要了解FAST架构的虚拟地址空间定义。
\subsection{FAST代码结构}
\subsubsection{目录结构}
\renewcommand{\arraystretch}{1.5}
\begin{table}[!ht]
\small
\centering
\caption{FAST代码目录结构}
\label{tab:a:fast_dir-structure}
\begin{tabular}{|c|c|c|} \hline
\heiti 序号 & \heiti 目录名称 & \heiti 说明\\ \hline
1 & include & 开发所用头文件目录\\ \hline
2 & lib & ua、寄存器读写库目录\\ \hline
4 & app & fast应用工具\\ \hline
6 & tools & 调试测试示例工具\\ \hline
7 & src & 综合示例代码测试\\ \hline
\end{tabular}
\end{table}
\subsubsection{头文件}
\chapter{FAST平台介绍与操作说明手册}
\label{app:openbox}
\begin{enumerate}
\item \textbf{fast\_vaddr.h}FAST平台硬件资源访问对应的虚拟地址空间定义
\item \textbf{fast\_type.h}FAST平台所用数据类型定义
\item \textbf{fast\_err.h}FAST平台错误号定义
\item \textbf{fast\_struct.h}FAST平台数据结构类型定义
\item \textbf{fast.h}FAST平台所有开发函数定义包含上述所有头文件
\item \textbf{其他:}不同平台的适配头文件。
\end{enumerate}
\subsection{FAST简介}
针对近年来关于工业控制网络创新技术、创新网络结构、时间敏感网络、SDN网络、FPGA硬件加速技术及下一代网络技术的研究需求由国防科大与湖南新实共同发起的开源项目——FASTFPGA Accelerated Switcing plaTform于2016年创建。截止到目前该开源项目已经服务全国多所高校和科研院所的网络教学实验建设和科研项目。
\subsubsection{库文件}
FAST开源项目的诞生与发展深受斯坦福大学Nick Mckeown教授在NetFPGA项目、OpenFlow项目和P4等项目的影响其目标是为计算机网络的科研与教学提供一个开源和开放的软硬件全功能可编程交换平台。其主要特点如下
\begin{enumerate}
\item \textbf{libreg}libreg主要是用来实现对硬件寄存器读写动作的封装底层支持标准PCIe设备的寄存器读写和NetMagic08使用NMAC方式的寄存器读写。在FAST平台所有对硬件的寄存器读写全部封装为统一的接口函数主要包括硬件资源初始化、寄存器读和寄存器写等函数。用户只需要根据此接口函数读写寄存器即可底层具体实现用户可以不用关心
\item \textbf{librule}librule主要是实现对硬件流表规则的软件抽象与具体实现该规则库实现了一种与硬件对应的流表字段序列仅是一种参考实现。用户可根据硬件查表关键字来重新定义规则字段序列但必须要求硬件字段序列与软件字段序列一一对应包括比特位宽与大小端定义。该库封装了规则的基本操作函数如初始化规则、添加规则、修改规则和删除规则;
\item \textbf{libua}libua主要是用来支持多用户对不同特征流的处理开发和同一特征流在不同用户进程段流水处理开发。该库的主要功能是使用规则配置的方式设置与用户关联的特征流属性并提供用户接收与发送该属性特征流的开发接口实现用户对特征流的接收、处理与发送操作。该库主要封装了UA的初始化函数、流处理回调函数、分组发送函数等。
\item \textbf{FPGA}FAST实现的核心载体是可编程FPGA是用Verilog语言编程实现的硬件功能。FPGA的现场可编程特性为实现用户创新的网络架构、算法、实现机制提供了极大的灵活性而且可以获得较高的性能支持在实际网络中部署运行
\item \textbf{Accelerated}PGA实现的不是网络处理的全部功能而是部分需要硬件加速的分组处理功能。FAST的核心是一套软硬件协同的分组处理模型用户可以通过Verilog编程实现的硬件功能的加速也可以在现有的FAST硬件平台的CPU上编程实现特定的分组处理功能
\item \textbf{Switching}AST面向的领域是网络交换领域支持各种新型交换技术如软件定义网络SDN、时间敏感网络TSN、网络安全一体化网络甚至是智能网卡的实现研究而不是支持以人工智能AI为代表的应用加速
\item \textbf{plaTform}与目前其他开源项目一样FAST提供的是一个硬件平台无关的支持用户通过软硬件编程实现其特定分组处理功能的环境。FAST通过提供标准的规范、开源的平台软硬件实现代码和demo应用支持用户基于平台进行创新的应用开发和设备原型的快速实现。
\end{enumerate}
\subsubsection{开发示例}
\subsection{FAST架构}
FAST平台的架构是一种通用多核CPU加FPGA形态的网络处理架构。通常对处理性能要求较高的分组处理功能由FPGA实现对处理性能要求较低实现复杂的功能可由CPU实现。用户既可通过扩展FPGA硬件流水线功能也可以通过CPU上编程实现对分组交换功能的扩充。该平台架构主要由硬件逻辑和软件逻辑两部分组成实现软硬件耦合通信与支持软硬件可编程的网络创新实验系统。其中硬件包括平台相关的数据IO和FAST硬件逻辑。软件部分包括通用操作系统与FAST软件逻辑。FAST软件逻辑包括软件开发环境和UA程序。该平台不仅支持FAST的UA编程开发同时也支持通用Socket APP的开发与运行。
FAST交换平台的实现不依赖特定的CPU与FPGA型号但为了更好地提供交换功能扩充能力保证软硬件协同分组处理的基本性能FAST的交换平台必须具有如下两个特点
\begin{enumerate}
\item \textbf{所有网络接口均与FPGA相连}
进入交换平台的分组首先送FPGA处理离开交换平台的分组最后由FPGA发出。这样有两个优点。一是交换平台可精确获取分组接收时间以及控制发送时间实现类似1588透明时钟的控制支持时间敏感交换二是平台可以支持各种新型的分组格式支持内容中心网络ICN等非IP交换。
\item \textbf{FPGA通过高带宽总线与CPU连接。}
与传统交换芯片通过低带宽的SPI总线、以太网或是单Lane的PCIE总线与控制CPU连接不同FAST平台中FPGA通过高带宽的总线与CPU连接提升软硬件协同分组处理的性能支持通过CPU软件对数据平面处理功能进行扩展。
\end{enumerate}
开发示例提供了一个基于FAST架构的二层交换机实例
综合使用了libreg和libua两个库实现了一个全软件的二层交换机功能。
FAST交换平台的实现架构如图\ref{fig:a:ob_FAST-Ac}所示。
\begin{figure}[!ht]
\centering
\includegraphics[width=11cm]{FAST-Ac}
\caption{FAST平台实现架构图}
\label{fig:a:ob_FAST-Ac}
\end{figure}
平台硬件逻辑分为两部分一部分是平台相关的外围接口和与平台CPU互联的高速总线接口逻辑统称为FPGA OS。其主要实现平台相关,交换功能无关的分组处理如网络接口的接收与发送、CPU的DMA引擎以及FPGA片外或片内实现的TCAM查表功能等另一部分是用户模块逻辑UM其主要实现交换相关的网络功能每一个小的流水线模块称为硬件应用HA如分组解析、关键字提取、转发查表、动作执行和输出控制等。用户可在UM模块中扩展HA流水线实现不同的分组处理功能。
平台软件逻辑分为三部分一是平台相关驱动由厂商实现其具体平台的硬件数据IO驱动一般包含PCIe驱动、DMA驱动和以太网驱动二是FAST分组分派模块主要实现内核应用模块、协议栈模块和用户应用UA和底层驱动的数据分派功能三是FAST分组应用主要包括在通过标准内核协议栈支持的通用SOCKET应用CA、内核编程开发的内核应用KA和基于FAST快速IO编程开发的用户应用。
FAST平台的分组处理功能分布在硬件HA和软件的KA、CA及UA各功能模块之间的转发和连接关系可由模块的ID号与下一组模块ID号关联配置实现分组数据在FAST平台的处理流水线模块排列如图\ref{fig:a:ob_FAST-Pkt-Proc}所示效果。
\begin{figure}[!ht]
\centering
\includegraphics[width=11cm]{FAST-Pkt-Proc}
\caption{FAST分组处理流水线排列图}
\label{fig:a:ob_FAST-Pkt-Proc}
\end{figure}
\subsection{平台应用}
由于FAST平台架构的特征其应用开发可以是软件开发、硬件开发或软硬件结合开发具体根据平台应用场景和用户具体需求而定。
FAST项目自创立至今已经在传统网络应用、工业互联网和创新网络架构设计等方面得到了广泛应用。通过在不同领域的应用积累了大量网络教学实验案例如网络协议分析与编程、协议攻击与防护、路由器系统设计与实现、SDN交换机设计与实现、网络高精度测量、时间敏感网络设计与实现、高性能网络IO和网络应用的硬件卸载加速等。
\subsection{平台使用}
FAST是一个与平台无关的开源架构根据FAST原理和规范实现的CPUFPGA异构网络设备形态都属于FAST平台。FAST平台的CPU支持国产与非国产多种型号FPGA也可以支持国产和非国产的多种型号。下面以下湖南新实的一款专业网络实验教学设备型号OpenBox-S4为例说明如何使用FAST平台。
\subsubsection{搭建环境}
使用FAST平台开发和验证网络功能需要搭建FAST环境。FAST环境包括以下三个部分
\begin{enumerate}
\item l2switch
l2switch是基于FAST架构开发一个2层以太网交换机原型
通过对流表默认规则的设置将硬件所有的分组重定向到UA程序
然后在UA的分组处理回调函数中实现对分组的2层交换
然后将分组从指定端口发送或泛洪发送。
该示例主要演示了UA编程开发的主要方法与流程、使用的相关函数
硬件寄存器地址的操作以及2层交换机的实现原理。
\item xofp
xofp是基于FAST架构开发一个SDN交换机原型
通过OpenFlow协议连接SDN控制器SDN交换机默认规则是送往SDN控制器
SDN控制器根据报文数据配置流表转发下发给硬件下次进来的报文直接转发输出。
该示例主要演示了SDN交换机OpenFLow协议、处理OpenFLow消息、
使用的相关函数硬件寄存器地址的操作以及SDN交换机的实现原理。
\item \textbf{用户操作设备:}一般是一台标准的电脑可以是台式机或笔记本除了基本操作IO设备外电脑还要求至少拥有一个网口或一个USB口。该设备供用户编辑和编译软硬件逻辑代码通过网口或串口上传和下载逻辑程序和运行结果
\item \textbf{FAST平台设备}一台符合FAST规范的可编程网络开发平台。平台支持FAST开源示例应用可供用户基于平台进行软硬件逻辑功能的二次开发。平台至少提供一个串口和一个管理网口用于支持用户网络远程或本地串口线登录平台进行操作
\item \textbf{网络测试主机:}测试主机一般为支持网络功能的主机或嵌入式小型设备,如笔记本或树莓派。根据实验内容的不同,需要的网络测试主机数量及主机网络配置各不相同,具体参考相应的实验案例内容要求。
\end{enumerate}
\subsubsection{工具}
\subsubsection{FAST平台设备}
OpenBox-S4设备是一款严格遵照FAST原理与架构设计的通用多核CPUFPGA的软硬件全功能可编程网络开发平台。适合本科和研究生的计算机网络教学和新型网络交换机制的验证。
示例程序的另一种表现就是FAST提供的一些小工具包括单独的寄存器读写命令、规则输出命令、端口状态显示命令和端口分组计数命令。
该设备采用Zynq-7000 SOC芯片内嵌双核Cortex-A9 处理器512MB DDR3内存支持4个千兆以太网数据接口1个千兆管理以太网接口和一个管理串口。设备外观与接口说明如图\ref{fig:a:ob_f01}和图\ref{fig:a:ob_f02}所示:
\begin{enumerate}
\item reg\_rw
\begin{figure}[!ht]
\centering
\includegraphics[width=11cm]{f01}
\caption{OpenBox-S4设备前端图}
\label{fig:a:ob_f01}
\end{figure}
该工具主要是使用libreg库实现一个对用户指定的寄存器进行读写访问操作展示了用户如何调用libreg的相关库函数进行寄存器访问操作的方法。
\item rule\_hw
\begin{figure}[!ht]
\centering
\includegraphics[width=11cm]{f02}
\caption{OpenBox-S4设备后端图}
\label{fig:a:ob_f02}
\end{figure}
该工具主要是使用libreg库和librule库实现对硬件流表的获取并分组输出操作展示了用户如何调用librule库的相关库函数进行规则操作。该工具目前只使用了硬件规则的读取操作更多规则的功能操作可参考综合测试程序。
\item port\_status
在实验过程中,测试主机设备通常连接在设备的数据接口位置,用户操作管理设备时通过管理网口或串口连接。
该工具主要使用libreg库实现了对各端口的协商状态、链路状态等寄存器的访问并进行各状态值的解释。主要展示了不同端口状态的寄存器地址如何计算各状态寄存器值返回如何解释示例代码中包含了目前支持的所有状态寄存器及对应功能说明。
\item port\_counts
\subsubsection{登录设备平台}
\begin{enumerate}
\item 串口方式
\begin{enumerate}
\item 连接串口线;
设备使用标准USB口和Micro USB接口的线作为串口连接线标准USB口连接在用户操作设备上Mirco USB接口与设备对应串口连接。
\item 打开并配置串口工具。
在用户操作设备上打开串口工具配置好相应串口参数后打开串口即可通过串口管理设备。以putty为例其配置参数如图\ref{fig:a:ob_f11}所示:
\begin{figure}[!ht]
\centering
\includegraphics[width=11cm]{f11}
\caption{串口工具参数配置图}
\label{fig:a:ob_f11}
\end{figure}
\end{enumerate}
该工具主要使用libreg库实现了对各端口分组计数的统计显示主要展示了不同功能计数统计的寄存器虚拟地址空间定义各端口对应功能寄存器的计算方法。示例代码中包含了目前支持的所有功能计数统计寄存器定义与说明。
\item 管理网口方式
\begin{enumerate}
\item 连接网线;
使用一根RJ45端口的网线分别连接在用户操作主机端与设备的管理网口MGMT网口出现指示灯闪烁说明连接正常。
\item 配置主机端IP信息。
通过网连接连接设备必须确保用户操作主机与设备管理网口在相同的网段如不记得管理网口的IP可以通过串口方式查看。设备默认网段为192.168.50.0网段故用户操作主机的IP地址配置信息参考如图\ref{fig:a:ob_f12}所示:
\begin{figure}[!ht]
\centering
\includegraphics[width=11cm]{f12}
\caption{网口连接的主机IP配置图}
\label{fig:a:ob_f12}
\end{figure}
\end{enumerate}
\end{enumerate}
\subsubsection{综合测试}
\subsubsection{测试二层交换功能}
\begin{enumerate}
\item 搭建二层交换拓扑
综合测试程序包含了libreg、librule和libua库的综合开发示例功能。
首先,用户可以通过此程序了解各功能库的主要使用函数及调用顺序;
其次,用户可以通过此程序的编译参数了解不同功能库如何添加对应库功能支持。
\subsection{FAST代码运行}
二层交换实验的两台测试主机可以随意连接到设备的数据接口位置网口0到网口4均可。测试主机的IP地址配置及连接拓扑如图\ref{fig:c:router-ob_switch-topo}所示。
\subsubsection{软硬件环境}
该平台可通过采购或免费申请试用获取用户拿到FAST平台后
默认系统环境均已支持FAST硬件基础版本与FAST软件基础版本。
FAST硬件基础版本是指基于FAST的标准5级流水线功能
FAST软件基础版本是指FASTXXX软件版本。
\item 在OpenBox-S4上运行二层交换程序
如果用户只需要了解软件功能可以不用FAST设备
FAST软件可在通用Linux系统中进行编译与测试
没有硬件平台的软件代码,不能进行硬件寄存器读写、规则配置与报文收发功能。
 用串口或网线连接用户操作主机与设备通过串口登录界面或网络登录界面控制设备在界面终端输入命令l2switch如图\ref{fig:a:ob_f16}所示:
\begin{figure}[!ht]
\centering
\includegraphics[width=11cm]{f16}
\caption{二层交换命令启动输出图}
\label{fig:a:ob_f16}
\end{figure}
\subsubsection{代码编译}
\begin{enumerate}
\item 解压代码
\begin{code}[console]
openbox@OpenBox~/hnxs$ tar zxf fast-0.4.5.tar.gz
\end{code}
\item 配置环境
\begin{code}[console]
openbox@OpenBox~/hnxs/fast-0.4.5$ ./configure
\end{code}
\item 编译
\begin{code}[console]
openbox@OpenBox~/hnxs/fast-0.4.5$ make
\end{code}
\end{enumerate}
\item 在PC两端进行PING测试
\subsubsection{代码执行}
\begin{enumerate}
\item 读硬件版本号
\begin{code}[console]
openbox@OpenBox~/hnxs/fast-0.4.5$ reg_rw rd 0
\end{code}
\end{enumerate}
在主机B的CMD (命令提示符) 程序中。输入并执行命令ping 192.168.1.111 即可测试两台主机之间的联通性。测试结果如图\ref{fig:a:ob_f17}所示:
\begin{figure}[!ht]
\centering
\includegraphics[width=11cm]{f17}
\caption{二端主机PING通结果图二层交换}
\label{fig:a:ob_f17}
\end{figure}
\subsection{FAST数据结构}
\subsubsection{UM数据结构}
\begin{code}[c]
struct um_metadata{
u64 ts:32, /**< @brief 时间戳*/
reserve:17, /**< @brief 保留*/
pktsrc:1, /**< @brief 分组的来源0为网络接口输入1为CPU输入*/
flowID:14; /**< @brief 流ID*/
u64 seq:8, /**< @brief 分组接收序列号*/
pst:8, /**< @brief 标准协议类型(参考硬件定义)*/
dstmid:8, /**< @brief 下一个处理分组的模块ID*/
srcmid:8, /**< @brief 最近一次处理分组的模块ID*/
len:12, /**< @brief 报文长度*/
discard:1, /**< @brief 丢弃位*/
priority:3, /**< @brief 分组优先级*/
outport:6, /**< @brief 单播分组输出端口ID组播/泛洪:组播/泛洪表地址索引*/
outtype:2, /**< @brief 输出类型00单播01组播10泛洪11从输入接口输出*/
inport:6, /**< @brief 分组的输入端口号*/
pktdst:1, /**< @brief 分组目的0为网络接口输出1为送CPU*/
pkttype:1; /**< @brief 报文类型0数据报文1控制报文。硬件识别报文类别后会将pktsrc位交换到此恢复硬件数据格式*/
u64 user[2]; /**< @brief 用户自定义metadata数据格式与内容 @remarks 此字段由可用户改写但需要保证数据大小严格限定在16字节*/
};
\end{code}
\subsubsection{FAST报文数据结构}
\begin{code}[c]
struct fast_packet
{
union
{
struct um_metadata um; /**< @brief UM模块数据格式定义 @see ::um_metadata */
struct ctl_metadata cm; /**< 控制报文格式定义*/
struct common_metadata md; /**< 公共控制信息报文类型0数据1控制*/
};
#ifdef OPENBOX_S28
u16 flag; /**< @brief 2字节对齐标志主要是为了IP地址的对齐*/
#endif
u8 data[1514]; /**< @brief 完整以太网报文数据暂时不含CRC数据*/
};
\end{code}
\subsection{FAST开发函数}
\subsubsection{硬件资源与寄存器}
\begin{enumerate}
\item int fast\_init\_hw(u64 addr,u64 len);
硬件资源初始化。所有涉及到需要操作硬件寄存器、流表和动作等均需要先调用此函数,
实例化硬件资源,使软件具体访问硬件的能力。
参数addr在PCIe标准设备中表示硬件资源的内存映射地址
通常情况下用户可以直接填写0。
参数len在PCIe标准调和中表示硬件资源的内存地址空间大小
通常情况下用户可以直接填写0。
返回值0表示硬件资源实例化正常非零表示失败
如果失败将无法对硬件进行任何操作,程序将自动退出。
\item void fast\_distroy\_hw(void);
硬件资源销毁。PCIe设备主要是撤销对硬件资源的映射
OpenBox-S4主要是对设备发送关闭报文。
一般情况下,用户程序退出时应该调用此函数,释放资源。
但是我们内部并没有做特殊的资源处理,均为系统可自动回收功能,
即使用户不调用此函数,当程序正常退出时,系统也能正常回收资源,
不影响程序再次运行使用。
\item u64 fast\_reg\_rd(u64 regaddr);
寄存器读函数。读取用户指定寄存器位置的值返回。
该函数内部会根据平台的不同使用不同的方法去访问硬件寄存器。
PCIe的平台以正常寄存器方式访问而NetMagic~08需要使用NMAC报文进行交互获取。
这些不同的操作方式均已对用户屏蔽,用户无需关心该函数底层如何交互与实现,
仅需调用此函数接口来操作寄存器读操作即可。
参数regaddr表示用户将要读取的寄存器地址
该地址即FAST平台所定义的虚拟地址空间该值均使用相对偏移值的方式使用
即FAST平台定义的值对PCIe平台设备访问需要使用绝对地址访问才可以正常访问寄存器
相对地址转绝对地址已经封装在函数内部,
用户对所有寄存器的操作均可只用相对值访问即可。
返回值返回该寄存器对应的值。该值的位宽是64位
在所有FAST平台寄存器的位宽均为64位。
\item void fast\_reg\_wr(u64 regaddr,u64 regvalue)。
寄存器写函数。将指定值写对硬件对应的寄存器位置。
该函数内部会根据平台的不同使用不同的方法去操作硬件寄存器。
PCIe的平台以正常寄存器方式访问而NetMagic~08需要使用NMAC报文进行交互获取。
这些不同的操作方式均已对用户屏蔽,用户无需关心该函数底层如何交互与实现,
仅需调用此函数接口来操作寄存器写操作即可。
参数regaddr表示用户将要写入的寄存器地址
该地址即FAST平台所定义的虚拟地址空间该值均使用相对偏移值的方式使用
即FAST平台定义的值
对PCIe平台设备访问需要使用绝对地址访问才可以正常访问寄存器
相对地址转绝对地址已经封装在函数内部,
用户对所有寄存器的操作均可只用相对值访问即可。
参数regvalue表示要写入上述参数寄存器位置的值。该值的位宽为64位。
\end{enumerate}
\subsubsection{流表操作}
\subsubsection{测试三层路由功能}
\begin{enumerate}
\item void init\_rule(u32 default\_action);
初始化规则。初始化规则函数的主要功能是在软件分配软件规则空间,
将硬件规则空间清零,设置硬件规则的默认动作。
该函数只在进行流表操作的应用中进行调用,而且只能被调用一次。
如果有多个应用需要操作规则,
整个系统在关机或重启前所有的应用中也只能由一个应用来调用一次。
主要是该函数会将硬件所有存在流表清空。用户需要自己非常清楚对流表的操作,
在一次流表清空后才可以对流表进行其他操作。
参数default\_action默认动作。当所有的流表均不能匹配时
硬件需要执行一个默认的动作来完成这个分组的处理,
流表可以为空,但默认动作必须要有。详细的动作含义可以参考动作说明。
\item int fast\_add\_rule(struct fast\_rule *rule);
添加一条规则。添加规则函数,先将用户的规则添加在软件流表中,
经过各种比较判断后,看是否能正常添加,有无冲突或是否存在,
如果可以正常添加,则先将规则存储在软件,
然后将此条软件规则数据通过寄存器方式下发到硬件对应规则的存储位置。
参数rule规则对象内部具体字段参考流规则数据结构定义。
返回值:返回当前添加规则成功后此条规则所在的索引号。
\item int fast\_modify\_rule(struct fast\_rule *rule,int idx);
修改一条已经存在的规则。此函数主要是用来修改已经存在的规则,
对其关键字、掩码、动作和优先级等进行修改。
该函数的索引值参数如果指向一条空规则,其操作流程将类似于添加规则函数。
参数rule新规则对象内部具体字段参考流规则数据结构定义。
参数idx旧规则所在索引号。
返回值返回输入参数的idx值说明操作成功其他值说明操作失败
\item int fast\_del\_rule(int idx);
删除一条已经存储的规则,或将一条规则置为无效。
只需要提供规则所在的索引号,软件可通过索引号定位到对应硬件存储规则位置,
将规则的有效位置为无效,实现一条规则的删除。
删除硬件成功后,将其对应的软件规则进行清除。
参数idx删除规则所在索引号。
返回值返回输入参数的idx值说明操作成功其他值说明操作失败。
\item int read\_hw\_rule(struct fast\_rule *rule,int index);
读取一条硬件规则。将存储在硬件规则内对应索引的数据读取出来,
还原为一条软件规则数据,存储在用户提供的指针位置。
参数rule将要存储规则的内存指针。
参数idx将要读取规则所在硬件的索引号。
返回值返回输入参数的idx值说明操作成功其他值说明操作失败。
\item void print\_hw\_rule(void)。
打印硬件所有规则信息。此函数是上一个读取硬件规则条目信息的集合操作,
将所有硬件流规则信息一一读出,并打印输出在屏幕上。
\item 搭建三层路由拓扑
三层路由实验的两台测试主机要根据主机端IP地址配置和网关配置分别连接到主机对应网关的接口上。连错线会导致实现失败。测试主机的IP地址配置及连接拓扑如图\ref{fig:c:router-ob_router-topo}所示。
\item OpenBox-S4上运行三层路由程序
 用串口或网线连接用户操作主机与设备通过串口登录界面或网络登录界面控制设备在界面终端输入命令l3router如图\ref{fig:a:ob_f19}所示:
\begin{figure}[!ht]
\centering
\includegraphics[width=11cm]{f19}
\caption{运行三层路由程序}
\label{fig:a:ob_f19}
\end{figure}
\item 在PC两端进行PING测试
在主机A的CMD (命令提示符) 程序中。输入并执行命令ping 192.168.2.119 即可测试跨路由功能。测试结果如图\ref{fig:a:ob_f20}所示:
\begin{figure}[!ht]
\centering
\includegraphics[width=11cm]{f20}
\caption{端主机PING通结果图三层路由}
\label{fig:a:ob_f20}
\end{figure}
\end{enumerate}
\subsubsection{UA编程}
\subsubsection{测试SDN交换功能}
\begin{enumerate}
\item int fast\_ua\_init(int mid,fast\_ua\_recv\_callback callback);
UA编程初始化函数。
\item void fast\_ua\_destroy(void);
UA编程注销函数。
\item int fast\_ua\_send(struct fast\_packet *pkt,int pkt\_len);
UA程序发送报文函数
\item void fast\_ua\_recv()。
启动UA接收用户特征流程序函数
\end{enumerate}
\item 搭建SDN交换拓扑
\subsection{FAST开发流程}
基于FAST的软件代码开发有三种方式
第一种是基于FAST的源代码进行修改整个代码结构不变
可以直接使用原工程中的所有Makefile文件
修改完成后直接make即可得到用户所需要的可执行文件
第二种是用户根据自己需要,选择需要的开发库与头文件,
自己重新组织新的代码目录与结构进行开发,
原工程中的Makefile文件均不可再用需要自己重写Makefile文件。
\subsubsection{修改源码开发}
SDN交换实验的两台测试主机可以随意连接到设备的数据接口位置网口0到网口4均可SDN控制器主机的网线一定要连接在设备的管理网口MGMT。控制器主机和测试主机的IP地址配置及连接拓扑如图\ref{fig:c:sdn-ob_sdn-topo}所示。
\begin{enumerate}
\item 以FAST的rule\_rw工具作为修改示例
修改fast/tools/rule\_rw/目录下main\_rule.c文件
\item 修改main\_rule\_test函数
将两个端口互转硬件规则改为根据以太网类型来转发。
\begin{code}[c]
void main_rule_test(int argc,char *argv[])
{
int i = 0,p1 = 1,p2 = 2,idx1 = 0,idx2 = 1;
struct fast_rule rule[2] = {{0},{0}};//初始化两条全空的规则
if(argc == 3)
{
p1 = atoi(argv[1]);
p2 = atoi(argv[2]);
}
//给规则的各字段赋值
rule[i].key.type = htole16(0x0800); //以太网类型
rule[i].key.port = p1;
rule[i].priority =0xA;
rule[i].action = ACTION_PORT<<28|p2;//动作字段的涵义请参考fast_type.h
rule[i].md5[0] = i+1;
//给规则对应字段设置掩码掩码为1表示使用为0表示忽略
rule[i].mask.type = 0xFFFF;
rule[i].mask.port = 0x3F;/*6bit*/
i++;
rule[i].key.type = htole16(0x0800);
rule[i].key.port = p2;
rule[i].priority =0xB;
rule[i].action = ACTION_PORT<<28|p1;//动作字段的涵义请参考fast_type.h
rule[i].md5[0] = i+1;
//给规则对应字段设置掩码掩码为1表示使用为0表示忽略
rule[i].mask.type = 0xFFFF;
rule[i].mask.port = 0x3F;
if(argc == 3)
{
fast_modify_rule(&rule[i-1],idx1);
fast_modify_rule(&rule[i],idx2);
printf("Row[%d],Port[%d]----->Port[%d]\n",idx1,p1,p2);
printf("Row[%d],Port[%d]----->Port[%d]\n",idx2,p2,p1);
}
}
\end{code}
修改保存退出打开命令终端跳到fast目录下执行交叉编译。
\begin{code}[console]
# cd fast-0.4.5
# make
\end{code}
编译完成后将把tools/rule\_hw目录下rule\_hw工具放到OpenBox-S4设备
执行修改过的rule\_hw工具。
\begin{code}[console]
# ./rule_hw 0 1
\end{code}
\item 在SDN控制器主机中启动SDN控制器
\end{enumerate}
 在终端命令行下输入 java jar target/floodlight.jar即启动floodlight控制器。如图\ref{fig:a:ob_f22}所示:
\begin{figure}[!ht]
\centering
\includegraphics[width=11cm]{f22}
\caption{启动floodlight控制器}
\label{fig:a:ob_f22}
\end{figure}
\item 在设备平台上运行SDN交换程序
 在串口登录界面或网络登录界面输入命令xofp -4 192.168.1.3 i obx0,obx1,obx2,obx3 连接Floodlight控制器。如图\ref{fig:a:ob_f23}所示:
\begin{figure}[!ht]
\centering
\includegraphics[width=11cm]{f23}
\caption{运行SDN交换程序}
\label{fig:a:ob_f23}
\end{figure}
\item 访问floodlight控制器首页
 在控制器主机打开浏览器在浏览器地址栏输入127.0.0.1:8080/ui/index.html 访问floodlight控制器首页。界面如图\ref{fig:a:ob_f24}所示:
\begin{figure}[!ht]
\centering
\includegraphics[width=11cm]{f24}
\caption{访问floodlight控制器首页}
\label{fig:a:ob_f24}
\end{figure}
\item 在PC两端进行PING测试
在主机A的CMD (命令提示符) 程序中。输入并执行命令ping 192.168.2.119 即可测试两台主机之间的联通性。测试结果如图\ref{fig:a:ob_f25}所示:
\begin{figure}[!ht]
\centering
\includegraphics[width=11cm]{f25}
\caption{端主机PING通结果图SDN交换}
\label{fig:a:ob_f25}
\end{figure}
\end{enumerate}
\subsubsection{编译代码}
在fast代码的根目录执行编译命令。
\begin{code}[console]
# make clean
# make
\end{code}
\subsection{FAST开源社区}
由于FAST架构设计的独特优势用户无需关心平台的分组网络IO、存储和加速方法只专注于创新架构的设计和核心技术研究极大的加快网络创新技术的落地与应用。来自全国的近100家的高校、科研院所和设备厂商单位都加入的FAST开源社区。FAST开源社区致力于网络领域的基础网络技术分析与实现热门网络技术跟踪研究与原型实现和未来网络技术探索与研究。更多的网络前沿技术及FAST的实现方法以及FAST的编程开发方法请关注FAST社区公众号及相关服务网站。
\begin{figure}[ht!]
\centering
\includegraphics[width=5cm]{fast-w}
\caption{FAST公众号}
\label{fig:a:ob_fast-w}
\end{figure}
FAST官网http://www.fastswitch.org

@ -1,328 +0,0 @@
%# -*- coding: utf-8-unix -*-
\chapter{可编程网络平台-操作手册}
\label{app:openbox}
\subsection{FAST简介}
针对近年来关于工业控制网络创新技术、创新网络结构、时间敏感网络、SDN网络、FPGA硬件加速技术及下一代网络技术的研究需求由国防科大与湖南新实共同发起的开源项目——FASTFPGA Accelerated Switcing plaTform于2016年创建。截止到目前该开源项目已经服务全国多所高校和科研院所的网络实验建设和科研项目。
FAST平台的架构是一种通用多核CPU加FPGA形态的网络处理架构该平台架构主要由硬件逻辑和软件逻辑两部分组成实现软硬件耦合通信与支持软硬件可编程的网络创新实验系统。其中硬件包括平台相关的数据IO和FAST硬件逻辑。软件部分包括通用操作系统与FAST软件逻辑。FAST软件逻辑包括软件开发环境和UA程序。该平台不仅支持FAST的UA编程开发同时也支持通用APP的开发与运行。
\subsection{设备简介}
OpenBox-S4是一款软硬件全功能可编程网络实验平台的具体型号产品该产品基于多核CPU加FPGA异构模型的FAST处理架构实现软件在CPU上使用C语言编程硬件在FPGA芯片上使用Verilog语言编程。全系统根据FAST架构搭建其软硬件基础运行环境内部软硬件用户逻辑支持所有FAST架构开发的应用、标准的网络协议栈与通用网络应用。平台软硬件逻辑代码开源免费支持用户二次开发。
\subsection{设备上电检测}
用户拿到设备后,首先做个简单的上电测试,以确保硬件平台可以正常工作。
\subsubsection{设备外部接口及其配件说明}
\begin{enumerate}
\item 设备外观与接口,正面如下图所示:
\begin{figure}[!htp]
\centering
\includegraphics[width=11cm]{f01}
\caption{正面外部接口}
\label{fig:a:ob_f01}
\end{figure}
\item 设备外观与接口,背面如下图所示:
\begin{figure}[!htp]
\centering
\includegraphics[width=11cm]{f02}
\caption{背面外部接口}
\label{fig:a:ob_f02}
\end{figure}
\item 12V-1A电源线如下图所示
\begin{figure}[!htp]
\centering
\includegraphics[width=11cm]{f03}
\caption{设备电源线}
\label{fig:a:ob_f03}
\end{figure}
\item 串口线,如下图所示:
\begin{figure}[!htp]
\centering
\includegraphics[width=11cm]{f04}
\caption{设备串口线}
\label{fig:a:ob_f04}
\end{figure}
\item 设备烧录线,如下图所示:
\begin{figure}[!htp]
\centering
\includegraphics[width=11cm]{f05}
\caption{设备烧录线}
\label{fig:a:ob_f05}
\end{figure}
\end{enumerate}
\subsubsection{检测准备}
\begin{enumerate}
\item 物品准备
\begin{table}[!htp]
\small
\centering
\caption{所需物品列表}
\label{tab:a:openbox_items}
\begin{tabular}{|c|c|} \hline
\heiti 测试项 & \heiti 所需物品 \\ \hline
上电检测 & 一台设备及电源\\ \hline
串口检测 & 一台设备及电源、一台电脑、一个micro usb 串口线\\ \hline
管理网口MGMT & 一台设备及电源、一台电脑、一个网线\\ \hline
\end{tabular}
\end{table}
\end{enumerate}
\subsubsection{上电检测}
\begin{enumerate}
\item 连接电源将电源开关拨到ON向右
\item 观察电源指示灯变化情况;
\item 电源开关拨到ON向右CFG电源指示灯会亮一下
\begin{figure}[!htp]
\centering
\includegraphics[width=11cm]{f06}
\caption{电源指示灯(刚接入电源)}
\label{fig:a:ob_f06}
\end{figure}
\item CFG电源指示灯过几秒后就灭了
\begin{figure}[!htp]
\centering
\includegraphics[width=11cm]{f07}
\caption{电源指示灯(系统配置)}
\label{fig:a:ob_f07}
\end{figure}
\item 等待15秒左右RUN电源指示灯常亮。
\begin{figure}[!htp]
\centering
\includegraphics[width=11cm]{f08}
\caption{电源指示灯(系统运行)}
\label{fig:a:ob_f08}
\end{figure}
\end{enumerate}
\subsubsection{串口检测}
\begin{enumerate}
\item 确保micro usb串口线连接到设备上并且设备已上电
\item 确保调试电脑已安装了PUTTY串口终端工具PUTTY软件包以及详细安装教程请自行搜索
\item 确保调试电脑已安装了CP2102驱动CP2102驱动包以及详细安装教程请自行搜索
\item 电脑的设备管理器查看设备的COM口数值。如下图设备的COM口数值为COM3不同的电脑显示的COM口数值会不同
\begin{figure}[!htp]
\centering
\includegraphics[width=11cm]{f09}
\caption{查看设备的COM口数值}
\label{fig:a:ob_f09}
\end{figure}
\item 打开PUTTY工具界面
\begin{enumerate}
\item 先点击右边Connection type位置的serial选项
\begin{figure}[!htp]
\centering
\includegraphics[width=11cm]{f10}
\caption{putty软件界面}
\label{fig:a:ob_f10}
\end{figure}
\item 点击左边category栏的 serial标签
\item 在Serial line to connect to 栏填写设备管理器中看到的COM数值
\item 在Speed栏填写串口的波特率为115200
\item 在 Data bits栏。填写数据位宽为8
\item 在Flow control栏选择None。
\item 如下所示调试电脑的COM数值为COM3所以serial line栏填写为COM3。
不同电脑的COM数值可能不同请填写实际的COM数值
\begin{figure}[!htp]
\centering
\includegraphics[width=11cm]{f11}
\caption{putty软件串口配置参数}
\label{fig:a:ob_f11}
\end{figure}
\end{enumerate}
\item 点击 open 进入设备系统则串口测试OK。
\end{enumerate}
\subsubsection{管理网口检测}
\begin{enumerate}
\item 使用一根网线,将调试电脑与设备的管理网口连接;
\item 设备管理网口的默认ip地址为192.168.50.5所以需要将调试电脑的ip地址设置成与设备管理网口的ip地址在同一个网段下也就是192.168.50.0网段);
\item 在调试电脑的 控制面板->网络和Internet->网络设备中。点击以太网->属性->internet协议版本4TCP/IPV4进行ip地址的配置。如下所示:
\begin{figure}[!htp]
\centering
\includegraphics[width=11cm]{f12}
\caption{配置以太网的IP地址}
\label{fig:a:ob_f12}
\end{figure}
\item 在调试电脑的 控制面板>系统和安全>Windows Defender 防火墙>自定义设置中。关闭调试电脑的防火墙功能;
\begin{figure}[!htp]
\centering
\includegraphics[width=11cm]{f13}
\caption{关闭防火墙功能}
\label{fig:a:ob_f13}
\end{figure}
\item 在调试电脑的CMD终端下使用ping命令能正常与管理网口通讯则说明管理网络工作正常。
\begin{figure}[!htp]
\centering
\includegraphics[width=11cm]{f14}
\caption{ping命令测试网络连通性}
\label{fig:a:ob_f14}
\end{figure}
\end{enumerate}
\subsection{搭建环境}
\subsubsection{测试二层交换功能}
\begin{enumerate}
\item 搭建二层交换拓扑
\begin{figure}[!htp]
\centering
\includegraphics[width=11cm]{f15}
\caption{二层交换连接拓扑示意图}
\label{fig:a:ob_f15}
\end{figure}
其中主机A的IP地址设置为192.168.1.111主机B的IP地址设置为192.168.1.119。
\item 在OpenBox-S4上运行二层交换程序
 在串口登录界面或网络登录界面输入命令l2switch如下图所示
\begin{figure}[!htp]
\centering
\includegraphics[width=11cm]{f16}
\caption{二层交换命令启动输出图}
\label{fig:a:ob_f16}
\end{figure}
\item 在PC两端进行PING测试
在主机B的CMD (命令提示符) 程序中。输入并执行命令ping 192.168.1.111 即可测试两台主机之间的联通性。测试结果如下所示:
\begin{figure}[!htp]
\centering
\includegraphics[width=11cm]{f17}
\caption{二端主机PING通结果图二层交换}
\label{fig:a:ob_f17}
\end{figure}
\end{enumerate}
\subsubsection{测试三层路由功能}
\begin{enumerate}
\item 搭建三层路由拓扑
\begin{figure}[!htp]
\centering
\includegraphics[width=11cm]{f18}
\caption{三层路由拓扑}
\label{fig:a:ob_f18}
\end{figure}
其中主机A的IP地址设置为192.168.0.111主机B的IP地址设置为192.168.2.119。
\item OpenBox-S4上运行三层路由程序
 在串口登录界面或网络登录界面输入命令l3router如下图所示
\begin{figure}[!htp]
\centering
\includegraphics[width=11cm]{f19}
\caption{运行三层路由程序}
\label{fig:a:ob_f19}
\end{figure}
\item 在PC两端进行PING测试
在主机A的CMD (命令提示符) 程序中。输入并执行命令ping 192.168.2.119 即可测试跨路由功能。测试结果如下所示:
\begin{figure}[!htp]
\centering
\includegraphics[width=11cm]{f20}
\caption{端主机PING通结果图三层路由}
\label{fig:a:ob_f20}
\end{figure}
\end{enumerate}
\subsubsection{测试SDN交换功能}
\begin{enumerate}
\item 搭建SDN交换拓扑
\begin{figure}[!htp]
\centering
\includegraphics[width=11cm]{f21}
\caption{SDN交换拓扑}
\label{fig:a:ob_f21}
\end{figure}
其中主机A的IP地址设置为192.168.2.111主机B的IP地址设置为192.168.2.119。
\item 在192.168.1.3的主机中启动SDN控制器
 在终端命令行下输入 java jar target/floodlight.jar即启动floodlight控制器。如下所示
\begin{figure}[!htp]
\centering
\includegraphics[width=11cm]{f22}
\caption{启动floodlight控制器}
\label{fig:a:ob_f22}
\end{figure}
\item 在可编程网络平台上运行SDN交换程序
 在串口登录界面或网络登录界面输入命令xofp -4 192.168.1.3 i obx0,obx1,obx2,obx3 连接Floodlight控制器。如下所示
\begin{figure}[!htp]
\centering
\includegraphics[width=11cm]{f23}
\caption{运行SDN交换程序}
\label{fig:a:ob_f23}
\end{figure}
\item 访问floodlight控制器首页
 在控制器主机打开浏览器在浏览器地址栏输入127.0.0.1:8080/ui/index.html 访问floodlight控制器首页。界面如下所示
\begin{figure}[!htp]
\centering
\includegraphics[width=11cm]{f24}
\caption{访问floodlight控制器首页}
\label{fig:a:ob_f24}
\end{figure}
\item 在PC两端进行PING测试
在主机A的CMD (命令提示符) 程序中。输入并执行命令ping 192.168.2.119 即可测试两台主机之间的联通性。测试结果如下所示:
\begin{figure}[!htp]
\centering
\includegraphics[width=11cm]{f25}
\caption{端主机PING通结果图SDN交换}
\label{fig:a:ob_f25}
\end{figure}
\end{enumerate}

@ -5,7 +5,7 @@
掌握静态路由、动态路由RIP和OSPF协议的配置并理解分析静态与动态路由的区别
两种动态路由协议各自的适用环境,理解网络收敛的概念。
推荐使用华为ENSP模拟器
在附录\ref{app:eNSP}:《华为网络仿真平台 ENSP 简介》中有该软件的安装、操作和使用,
推荐使用华为eNSP模拟器
在附录\ref{app:eNSP}:《华为网络仿真平台 eNSP 简介》中有该软件的安装、操作和使用,
以熟悉华为模拟设备的基本配置及其配置命令,
掌握软件安装常见问题的解决方法。

@ -42,7 +42,7 @@
\label{subsec:c:ensp:s:ospf_requirement}
\begin{itemize}
\item 华为ENSP仿真平台中2台PC3台路由器
\item 华为eNSP仿真平台中2台PC3台路由器
\item 双绞线若干。
\end{itemize}

@ -40,7 +40,7 @@
\label{subsec:c:ensp:s:rip_requirement}
\begin{itemize}
\item 华为ENSP仿真平台中2台PC3台路由器
\item 华为eNSP仿真平台中2台PC3台路由器
\item 双绞线若干。
\end{itemize}
@ -124,30 +124,30 @@
\item 为路由器R1的 GE1接口配置IP地址。
\begin{code}[text]
[zhangsanR1]interface GigabitEthernet 0/0/1
[zhangsanR1-GigabitEthernet0/0/1]ip address 192.168.2.1 255.255.255.0
[zhangsanR1-GigabitEthernet0/0/1]quit
\end{code}
\item 为路由器R2的GE0、GE1接口配置IP地址。
配置完成后路由器R1和R2应该可以互相Ping通。
要求记录输入的命令和输出(截屏)
[zhangsanR1-GigabitEthernet0/0/1]ip address 192.168.2.1 255.255.255.0
[zhangsanR1-GigabitEthernet0/0/1]quit
\end{code}
\item 为路由器R2的GE0、GE1接口配置IP地址。
配置完成后路由器R1和R2应该可以互相Ping通。
要求记录输入的命令和输出(截屏)
\begin{code}[text]
[zhangsanR2]interface GigabitEthernet 0/0/0
[zhangsanR2-GigabitEthernet0/0/0]ip address 192.168.2.2 255.255.255.0
[zhangsanR2-GigabitEthernet0/0/0]quit
\end{code}
[zhangsanR2-GigabitEthernet0/0/0]ip address 192.168.2.2 255.255.255.0
[zhangsanR2-GigabitEthernet0/0/0]quit
\end{code}
\begin{code}[text]
[zhangsanR2]interface GigabitEthernet 0/0/1
[zhangsanR2-GigabitEthernet0/0/1]ip address 192.168.3.1 255.255.255.0
[zhangsanR2-GigabitEthernet0/0/1]quit
\end{code}
\item 为路由器R3的GE0、GE1接口配置IP地址。配置完成后
直连路由应可相互Ping通如PC2应可Ping通R3的GE1口的地址。
[zhangsanR2-GigabitEthernet0/0/1]ip address 192.168.3.1 255.255.255.0
[zhangsanR2-GigabitEthernet0/0/1]quit
\end{code}
\item 为路由器R3的GE0、GE1接口配置IP地址。配置完成后
直连路由应可相互Ping通如PC2应可Ping通R3的GE1口的地址。
\begin{code}[text]
[zhangsanR3]interface GigabitEthernet 0/0/0
[zhangsanR3-GigabitEthernet0/0/0]ip address 192.168.3.2 255.255.255.0
[zhangsanR3-GigabitEthernet0/0/0]quit
\end{code}
[zhangsanR3-GigabitEthernet0/0/0]ip address 192.168.3.2 255.255.255.0
[zhangsanR3-GigabitEthernet0/0/0]quit
\end{code}
\begin{code}[text]
[zhangsanR3]interface GigabitEthernet 0/0/1

@ -13,7 +13,7 @@
\begin{itemize}
\item 华为网络设备常用配置命令;
\item 华为网络模拟器ENSP的安装
\item 华为网络模拟器eNSP的安装
\item IP地址的配置
\item 静态路由的配置;
\item 路由规划;
@ -43,7 +43,7 @@
\label{subsec:c:ensp:s:static_requirement}
\begin{itemize}
\item 华为ENSP仿真平台中2台PC三台路由器
\item 华为eNSP仿真平台中2台PC三台路由器
\item 双绞线若干。
\end{itemize}

@ -5,7 +5,6 @@
本单元实验使学生能初步使用可编程网络设备开发平台进行路由器基本功能的设计与实现,通过程序来实现路由器中最基本的三个功能:包括二层交换功能、三层路由功能及组网功能。深入理解路由器的基本工作原理与分组处理流程,从而培养学生对网络设备使用和研发的能力。
可编程网络设备开发平台是一款基于FAST架构的软硬件软件在CPU上使用C语言编程硬件在FPGA芯片上使用Verilog语言编程全可编程的网络实验教学平台平台的软硬件逻辑代码开源免费支持用户二次开发。其基本使用方法与编程开发方法见附录\ref{app:openbox}:《可编程网络平台-操作手册》
和附录\ref{app:fast}《FAST编程入门指南》。
可编程网络设备开发平台的具体设备型号为OpenBox-S4在案例文档中简称为“可编程网络平台”在实验图中的图标LOGO为FAST节点名称为OpenBox-S4。
可编程网络设备开发平台是一款基于FAST架构的软硬件软件在CPU上使用C语言编程硬件在FPGA芯片上使用Verilog语言编程全可编程的网络实验教学平台平台的软硬件逻辑代码开源免费支持用户二次开发。其基本使用方法见附录\ref{app:openbox}《FAST平台介绍与操作说明手册》。
基于FAST架构的可编程网络设备开发平台的具体设备型号为OpenBox-S4在案例文档中简称为“可编程网络平台”在实验图中的图标LOGO为FAST节点名称为OpenBox-S4。

@ -64,8 +64,9 @@
\end{code}
\item Quagga启动配置
\begin{code}[console]
root@HNXS-FAST:/home/hnxs# vim /etc/quagga/daemons
修改Quagga的启动模块配置文件/etc/quagga/daemons主要内容如下
\begin{code}[text]
zebra=yes
bgpd=no
ospfd= yes
@ -79,93 +80,43 @@
将上述文件内容中的3个no修改为yes表示启动该功能模块。
\item RIP协议启动配置
\begin{code}[console]
root@HNXS:/home/hnxs# vim /etc/quagga/ripd.conf
\end{code}
ripd.conf配置文件示例如下
修改RIP协议模块配置文件/etc/quagga/ripd.conf在空行处添加网段信息与邻居信息。原文件其他所有内容均无需修改。ripd.conf添加内容如下
\begin{code}[text]
! -*- rip -*-
!
! RIPd sample configuration file
!
! $Id: ripd.conf.sample,v 1.1 2002/12/13 20:15:30 paul Exp $
!
hostname ripd
password zebra
!
! debug rip events
! debug rip packet
!
router rip
! network 11.0.0.0/8
! network eth0
! route 10.0.0.0/8
! distribute-list private-only in eth0
network obx0
network obx1
network obx2
network obx3
neighbor 192.168.3.1
!
!access-list private-only permit 10.0.0.0/8
!access-list private-only deny any
!
!log file /var/log/quagga/ripd.log
!
log stdout
\end{code}
上述文件是S4-A路由器的rip配置文件另一台配置文件与上述基本相同只是其neighbor的地址是192.168.3.2。这两台路由器是通过S4-A的一个端口IP为192.168.3.1故其neighbor为192.168.3.2和S4-B的一个端口IP为192.168.3.2)连接。
\item OSPF协议启动配置
\begin{code}[console]
root@HNXS:/home/hnxs# vim /etc/quagga/ospfd.conf
\end{code}
ospfd.conf配置文件示例如下
修改OSPF协议模块配置文件/etc/quagga/ospfd.conf添加网段与ID信息。原文件其他所有内容均无需修改。ospfd.conf添加内容如下
\begin{code}[text]
! -*- ospf -*-
!
! OSPFd sample configuration file
!
!
hostname ospfd
password zebra
!enable password please-set-at-here
!
!router ospf
! network 192.168.1.0/24 area 0
!
ospf router-id 192.168.3.1
network 192.168.0.0/24 area 0
network 192.168.1.0/24 area 0
network 192.168.2.0/24 area 0
network 192.168.3.0/24 area 0
log stdout
\end{code}
上述为S4-A路由器的配置文件另一台路由器配置文件
上述为S4-A路由器的配置文件另一台路由器配置文件添加内容如下
\begin{code}[text]
! -*- ospf -*-
!
! OSPFd sample configuration file
!
!
hostname ospfd
password zebra
!enable password please-set-at-here
!
!router ospf
! network 192.168.1.0/24 area 0
!
ospf router-id 192.168.3.2
network 192.168.4.0/24 area 0
network 192.168.5.0/24 area 0
network 192.168.6.0/24 area 0
network 192.168.3.0/24 area 0
log stdout
\end{code}
\end{itemize}
@ -182,6 +133,8 @@
\begin{code}[console]
root@HNXS-FAST:/mnt/openbox# route -n
\end{code}
\begin{code}[text]
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
192.168.0.0 0.0.0.0 255.255.255.0 U 0 0 0 obx0

@ -24,7 +24,7 @@
\subsubsection{系统路由验证}
请参考附录\ref{app:openbox}:《可编程网络平台-操作手册》完成。
请参考附录\ref{app:openbox}:《FAST平台介绍与操作说明手册》完成。
\subsubsection{三层路由器工作原理}
三层路由器工作于OSI模型的第3层网络层根据网络层中的目的IP地址进行查表获得分组转发的下一跳输出端口及下一跳的IP地址。更新IP层的ttl值与checksum值并在输出端口对二层数据进行重新封装二层数据后转发。路由器还具备ARP响应与请求功能支持响应请求自己IP的MAC信息与请求路由下一跳IP的MAC信息。
@ -64,11 +64,12 @@
\subsubsection{系统路由验证}
\begin{enumerate}
\item 登录可编程网络平台,启动系统自带三层路由器命令,系统输出如下信息说明已正常启动且进入工作模式。
\item 登录可编程网络平台,启动系统自带三层路由器命令,系统输出如下信息说明已正常启动且进入工作模式,已省略部分模块输出信息
\begin{code}[console]
root@HNXS-FAST:/mnt/openbox# l3router
部分模块输出信息省略…
\end{code}
\begin{code}[text]
fastU->REG Version:20180827,OpenBox HW Version:2030200722
FAST UA REG->from pid:907,state:21,mid:132
fastU->Register UA to FAST Kernel! Wait Reply......

@ -24,7 +24,7 @@
\subsubsection{平台基本使用}
请参考附录\ref{app:openbox}:《可编程网络平台-操作手册》完成。
请参考附录\ref{app:openbox}:《FAST平台介绍与操作说明手册》完成。
\subsubsection{二层交换工作原理}
@ -66,10 +66,12 @@
\subsubsection{平台搭建与系统交换验证}
\begin{enumerate}
\item 请参考附录\ref{app:openbox}:《可编程网络平台-操作手册》完成;
\item 请参考附录\ref{app:openbox}:《FAST平台介绍与操作说明手册》完成;
\item 在串口登录界面输入如下命令,启动系统自带二层交换机命令。系统输出如下信息说明已正常启动且进入工作模式。
\begin{code}[console]
root@HNXS-FAST:/mnt/openbox# l2switch
\end{code}
\begin{code}[text]
fastU->REG Version:20180827,OpenBox HW Version:2030200722
FAST UA REG->from pid:902,state:21,mid:129
fastU->Register UA to FAST Kernel! Wait Reply......
@ -127,7 +129,7 @@
\begin{enumerate}
\item 运行自己的二层交换机程序,验证交换机的功能;
\begin{code}[console]
\begin{code}[text]
root@HNXS-FAST:/home/hnxs/l2switch# ./user_l2switch
fastU->REG Version:20180827,OpenBox HW Version:2030200722
FAST UA REG->from pid:902,state:21,mid:129
@ -137,12 +139,12 @@
Create nm08_mac_aging thread OK!
aging[0]->invalid mac:0
fastU->fast_ua_recv......
后面打印以学生代码为准……
// 后面打印以学生代码为准……
\end{code}
运行当前目录下用户的可执行文件,必须在前面加上”./”
\item 二层交换机正常工作后,显示如下信息;
\begin{code}[console]
\begin{code}[text]
root@HNXS-FAST:/mnt/openbox# l2switch
fastU->REG Version:20180827,OpenBox HW Version:2030200722
FAST UA REG->from pid:902,state:21,mid:129

@ -92,6 +92,8 @@
\item 测试测量平台与被测量主机间的连接性,在测量平台\texttt{ping 192.168.1.111}
\begin{code}[console]
root@HNXS-FAST:/home/hnxs/ams# ping 192.168.1.111
\end{code}
\begin{code}[text]
PING 192.168.1.111 (192.168.1.111) 56(84) bytes of data.
64 bytes from 192.168.1.111: icmp_seq=1 ttl=64 time=1.57 ms
64 bytes from 192.168.1.111: icmp_seq=2 ttl=64 time=1.60 ms
@ -105,6 +107,8 @@
\item 运行AMS测量命令测量服务器RTT的命令如下
\begin{code}[console]
root@HNXS-FAST:/home/hnxs/ams# ams 192.168.1.111 5 70 1000000000
\end{code}
\begin{code}[text]
fastU->REG Version:20180827,OpenBox HW Version:2030200722
FAST UA REG->from pid:1068,state:21,mid:131
fastU->Register UA to FAST Kernel! Wait Reply......
@ -129,6 +133,8 @@
\item 测试两个测量平台之间的实时网络带宽;
\begin{code}[console]
root@HNXS-FAST:/home/hnxs/ams# ams 192.168.1.111 5 100 0
\end{code}
\begin{code}[text]
fastU->REG Version:20180827,OpenBox HW Version:2030200722
FAST UA REG->from pid:1068,state:21,mid:131
fastU->Register UA to FAST Kernel! Wait Reply......
@ -141,7 +147,6 @@
测试之前要在此链路中间增加一个背景流使用iperf的UDP流大小为600Mbps
系统给测试主机发送5个100字节大小的ping报文出去默认间隔为1秒。
\item 观察带宽测试结果;
\begin{code}[text]
AMS ID PKT_SIZE BW(bps)
@ -155,6 +160,8 @@
\item 测量网线传输延时;
\begin{code}[console]
root@HNXS-FAST:/home/hnxs/ams# ams
\end{code}
\begin{code}[text]
fastU->REG Version:20180827,OpenBox HW Version:2030200722
FAST UA REG->from pid:1068,state:21,mid:131
fastU->Register UA to FAST Kernel! Wait Reply......

@ -53,8 +53,7 @@ SDN将传统的紧耦合网络设备拆分成了应用、控制和转发三层
并发送OFP\_HELLO消息用以确认双方都支持的OFP协议版本信息
\item \textbf{查询或设置数据:}
控制器通过OpenFlow的具体消息协议查询或设置交换机其他相关功能的数据
如OFPT\_HELLO、OFPT\_ECHO\_REQUEST、OFPT\_PACKET\_IN、OFPT\_PACKET\_OUT、
OFPT\_FLOW\_MOD、OFPT\_PORT\_MOD、OFPMP\_DESC、OFPMP\_FLOW、OFPMP\_PORT\_STATS等
如OFPT\_HELLO、OFPT\_ECHO\_REQUEST、OFPT\_PACKET\_IN、OFPMP\_DESC、OFPT\_PACKET\_OUT、OFPT\_FLOW\_MOD、OFPT\_PORT\_MOD、OFPMP\_FLOW、OFPMP\_PORT\_STATS等
\item \textbf{处理转发分组:}当交换机接收到一个数据转发分组时,
提取分组数据中的相关字段组成查表关键字,然后在本地进行流表匹配。
如果匹配成功,则根据流表的动作处理该分组,如从其他端口转发出去;
@ -78,8 +77,8 @@ SDN将传统的紧耦合网络设备拆分成了应用、控制和转发三层
\begin{itemize}
\item 可编程网络平台一个,测试主机两台,
SDN控制器安装SDN控制器软件Floodlight一台。
网络配置及连接拓扑如图\ref{fig:c:sdn-ob_sdn-topo}所示;
SDN控制器安装SDN控制器软件Floodlight一台。控制器主机没有两个网口时,中间加一个普通交换机;
\item 测试主机与控制器主机的网络配置及连接拓扑如图\ref{fig:c:sdn-ob_sdn-topo}所示;
\item 串口线一根,网线三根;
\item SDN交换机框架开发源代码、流表配置Python脚本。
\end{itemize}
@ -96,7 +95,7 @@ SDN将传统的紧耦合网络设备拆分成了应用、控制和转发三层
\subsubsection{编译运行SDN交换机验证交换机基本功能}
请参考附录\ref{app:openbox}:《可编程网络平台-操作手册》完成。
请参考附录\ref{app:openbox}:《FAST平台介绍与操作说明手册》完成。
\subsubsection{基于SDN交换机源码选择实现自己的协议功能}
@ -107,7 +106,6 @@ SDN将传统的紧耦合网络设备拆分成了应用、控制和转发三层
{
int oftype = ofpbuf->header.type;
SHOW_FUN(0);
LOG_DBG("ofpbuf->header.type=%d\n",ofpbuf->header.type);
switch(oftype)
{
@ -141,6 +139,8 @@ SDN将传统的紧耦合网络设备拆分成了应用、控制和转发三层
\item 运行SDN交换机交换机正常工作后输出如下
\begin{code}[console]
root@HNXS-FAST:/home/hnxs/sdn# ./ user_openflow -4 192.168.1.3 -i obx0,obx1,obx2,obx3
\end{code}
\begin{code}[text]
fastU->REG Version:20180827,OpenBox HW Version:2030200722
port_name:eth0,port:0
port_name:obx0,port:0
@ -163,7 +163,7 @@ SDN将传统的紧耦合网络设备拆分成了应用、控制和转发三层
\end{code}
\item 查看控制器界面基本信息在浏览器打开控制器WEB网站http://192.168.1.3/ui/index.html控制界面如图\ref{fig:c:sdn-ob_sdn-main}所示:
\begin{figure}[!htp]
\begin{figure}[ht!]
\centering
\includegraphics[width=12cm]{sdn-main}
\caption{SDN主界面信息}
@ -171,7 +171,7 @@ SDN将传统的紧耦合网络设备拆分成了应用、控制和转发三层
\end{figure}
\item 查看连接交换机信息,如图\ref{fig:c:sdn-ob_sdn-switch}所示:
\begin{figure}[!htp]
\begin{figure}[ht!]
\centering
\includegraphics[width=12cm]{sdn-switch}
\caption{SDN交换机信息}
@ -179,7 +179,7 @@ SDN将传统的紧耦合网络设备拆分成了应用、控制和转发三层
\end{figure}
\item 查看连接测试主机信息SDN主机及连接信息如图\ref{fig:c:sdn-ob_sdn-host}所示:
\begin{figure}[!htp]
\begin{figure}[ht!]
\centering
\includegraphics[width=12cm]{sdn-host}
\caption{SDN主机信息}
@ -187,7 +187,7 @@ SDN将传统的紧耦合网络设备拆分成了应用、控制和转发三层
\end{figure}
\item 查看端口状态与计数信息与流表信息,端口与流表信息如图\ref{fig:c:sdn-ob_port-flowtable}所示:
\begin{figure}[!htp]
\begin{figure}[ht!]
\centering
\includegraphics[width=12cm]{port-flowtable}
\caption{端口状态与流表计数信息}
@ -195,7 +195,7 @@ SDN将传统的紧耦合网络设备拆分成了应用、控制和转发三层
\end{figure}
\item 查看网络拓扑信息,网络拓扑信息如图\ref{fig:c:sdn-ob_sdn-test-topo}所示:
\begin{figure}[!htp]
\begin{figure}[ht!]
\centering
\includegraphics[width=12cm]{sdn-test-topo}
\caption{SDN网络拓扑信息}
@ -206,7 +206,7 @@ SDN将传统的紧耦合网络设备拆分成了应用、控制和转发三层
\subsubsection{在测试主机ping的前后分别观察流表变化}
\begin{enumerate}
\item ping之前的流表信息为空如图\ref{fig:c:sdn-ob_empty-flowtable}所示:
\begin{figure}[!htp]
\begin{figure}[ht!]
\centering
\includegraphics[width=12cm]{empty-flowtable}
\caption{空流表信息}
@ -214,7 +214,7 @@ SDN将传统的紧耦合网络设备拆分成了应用、控制和转发三层
\end{figure}
\item ping之后的流表信息如图\ref{fig:c:sdn-ob_flowtable-ping}所示:
\begin{figure}[!htp]
\begin{figure}[ht!]
\centering
\includegraphics[width=12cm]{flowtable-ping}
\caption{ping通后流表信息}
@ -227,8 +227,10 @@ SDN将传统的紧耦合网络设备拆分成了应用、控制和转发三层
\subsubsection{使用REST API接口查询交换机的相关功能数据}
\begin{enumerate}
\item 查询交换机基本信息
使用curl命令和对应的REST API地址查询交换机的对应信息。在命令行终端输入如下命令即可查询返回交换机的基本信息数据内容。
\begin{code}[console]
# curl http://192.168.1.3:8080/wm/core/switch/00:00:00:0a:00:00:08:01/desc/json
# curl http://192.168.1.3:8080/wm/core/switch/all/desc/json
\end{code}
\begin{code}[json]
{
@ -244,9 +246,9 @@ SDN将传统的紧耦合网络设备拆分成了应用、控制和转发三层
\end{code}
\item 查询端口计数信息
\begin{code}[console]
# curl http://192.168.1.3:8080/wm/core/switch/00:00:00:0a:00:00:08:01/port/json
# curl http://192.168.1.3:8080/wm/core/switch/all/port/json
\end{code}
\begin{code}[javascript]
\begin{code}[json]
{
"port_reply": [{
"version": "OF_13",
@ -267,41 +269,20 @@ SDN将传统的紧耦合网络设备拆分成了应用、控制和转发三层
"duration_sec": "4294966827",
"duration_nsec": "573987"
},
// 此处省略其他多个类似端口的统计信息
]
}]
}
}
\end{code}
端口计数统计信息返回的内容中只摘取显示了一个端口的数据显示,其他端口数据内容已经省略。
\item 查询交换机流表信息
\begin{code}[console]
# curl http://192.168.1.3:8080/wm/core/switch/00:00:00:0a:00:00:08:01/flow/json
# curl http://192.168.1.3:8080/wm/core/switch/all/flow/json
\end{code}
\begin{code}[javascript]
\begin{code}[json]
{
"flows": [{
"version": "OF_13",
"cookie": "9007199254740992",
"table_id": "0x0",
"packet_count": "5",
"byte_count": "571392",
"duration_sec": "0",
"duration_nsec": "0",
"priority": "1",
"idle_timeout_s": "5",
"hard_timeout_s": "0",
"flags": [],
"match": {
"in_port": "1",
"eth_dst": "b8:27:eb:c1:d1:39",
"eth_src": "b8:27:eb:d8:83:20",
"eth_type": "0x806"
},
"instructions": {
"instruction_apply_actions": {
"actions": "output=3"
}
}
}, {
"version": "OF_13",
"cookie": "9007199271518208",
"table_id": "0x0",
@ -326,57 +307,21 @@ SDN将传统的紧耦合网络设备拆分成了应用、控制和转发三层
"actions": "output=1"
}
}
},
// 此处省略其他几条流表的信息
},
]
}
\end{code}
交换机流表信息返回的内容中只摘取显示了一条流表的数据显示,其他流表数据内容已经省略。
\end{enumerate}
\subsubsection{修改Python脚本手动配置流表观察测试主机的通信变化}
\begin{enumerate}
\item 修改流表脚本,使其转发端口错误;
\begin{code}[console]
#vim openflow_flow-test.py
\end{code}
\begin{code}[python]
import httplib
import json
class StaticFlowPusher(object):
def __init__(self, server):
self.server = server
def get(self, data):
ret = self.rest_call({}, 'GET')
return json.loads(ret[2])
def set(self, data):
ret = self.rest_call(data, 'POST')
return ret[0] == 200
def remove(self, objtype, data):
ret = self.rest_call(data, 'DELETE')
return ret[0] == 200
def rest_call(self, data, action):
path = '/wm/staticflowpusher/json'
headers = {
'Content-type': 'application/json',
'Accept': 'application/json',
}
body = json.dumps(data)
conn = httplib.HTTPConnection(self.server, 8080)
conn.request(action, path, body, headers)
response = conn.getresponse()
ret = (response.status, response.reason, response.read())
print ret
conn.close()
return ret
pusher = StaticFlowPusher('192.168.1.3')
修改openflow\_flow-test.py主要修改其流表定义内容其他位置代码无需修改。流表定义内容如下
\begin{code}[python]
flowbe0 = {
'switch':"00:00:00:0a:00:00:08:01",
"table":"0",
@ -406,10 +351,7 @@ SDN将传统的紧耦合网络设备拆分成了应用、控制和转发三层
"ipv4_src":"192.168.2.119", #sip
"ipv4_dst":"192.168.2.111", #dip
"actions":"output=2" #执行动作输出端口为2
}
pusher.set(flowbe0)
pusher.set(flowbe1)
}
\end{code}
\item 重启SDN控制器并停止测试主机的ping操作
\item 配置用户流表,脚本执行命令如下:

@ -61,6 +61,13 @@ SDN交换机使用LLDP链路探测协议主要是通过PACKET\_OUT消息发送LL
交换机之间的链路信息加上交换机与主机之间的链路信息就完整的构成了全网的拓扑连接关系。
\end{enumerate}
\begin{figure}[h!]
\centering
\includegraphics[width=10cm]{openflow-topo}
\caption{OpenFlow拓扑测量实验拓扑图}
\label{fig:c:sdn-ob_openflow-topo}
\end{figure}
\subsection{实验条件}
\label{subsec:c:sdn-ob:s:topo_requirement}
@ -71,20 +78,13 @@ SDN交换机使用LLDP链路探测协议主要是通过PACKET\_OUT消息发送LL
\item SDN交换机框架源码。
\end{itemize}
\begin{figure}[!ht]
\centering
\includegraphics[width=10cm]{openflow-topo}
\caption{OpenFlow拓扑测量实验拓扑图}
\label{fig:c:sdn-ob_openflow-topo}
\end{figure}
\subsection{实验步骤}
\label{subsec:c:sdn-ob:s:topo_procedure}
\begin{enumerate}
\item 运行SDN交换机
请参考附录\ref{app:openbox}:《可编程网络平台-操作手册》完成。
请参考附录\ref{app:openbox}《FAST平台介绍与操作说明手册》完成。
\item 基于SDN交换机开源代码在端口分组接收回调函数中添加相应逻辑
\begin{code}[c]
int port_recv_callback(int inport,struct fast_packet *pkt,int pkt_len)
@ -122,8 +122,10 @@ SDN交换机使用LLDP链路探测协议主要是通过PACKET\_OUT消息发送LL
\item 断开一台测试主机,刷新拓扑界面,查看其对应的主机从界面消失。
\end{enumerate}
\item 使用控制器的北向REST API接口查询网络的所有链路连接关系数据
API接口为\texttt{/wm/topology/links/json}
\item 使用控制器的北向REST API接口查询全网所有设备节点信息
API接口为\texttt{/wm/device/}
\item 自己开发网络拓扑展示效果图;
\item 修改网络拓扑后验证自己开发程序的效果。

@ -55,7 +55,6 @@ Wireshark可以在Windows、Linux和macOS操作系统中运行
它由IEEE分配
而后3个字节的16进制数AE-3C-40代表该制造商所生产的某个网络产品(如网卡)的系列号。
\renewcommand{\arraystretch}{1.5}
\begin{table}[!ht]
\small
\centering
@ -241,19 +240,6 @@ IP地址长度为4字节。每个字段的含义如下
\label{fig:c:wireshark_eth-frame-detail}
\end{figure}
\subsubsection{差错检测FCS计算检验}
计算以太网帧的尾部校验和并与Wireshark显示数值进行比较验证。
\subsubsection{ARP协议分析}
\begin{enumerate}
\item 使用\texttt{arp d}命令(其语法见图\ref{fig:arp-cmd})
清空本机已有的ARP缓存
开启Wiresharkping本机的同网段地址在显示过滤器条框中输入“\texttt{arp}”,
观察捕获的ARP报文的各个字段分析请求/响应的过程。
\item 使用\texttt{arp d}命令清空本机已有的ARP缓存。开启Wireshark
ping本机的不同网段地址或域名观察捕获的ARP报文的各个字段
分析请求/响应的过程。
\end{enumerate}
\begin{figure}[!ht]
\centering
\begin{code}[text]
@ -269,6 +255,19 @@ IP地址长度为4字节。每个字段的含义如下
\label{fig:arp-cmd}
\end{figure}
\subsubsection{差错检测FCS计算检验}
计算以太网帧的尾部校验和并与Wireshark显示数值进行比较验证。
\subsubsection{ARP协议分析}
\begin{enumerate}
\item 使用\texttt{arp d}命令(其语法见图\ref{fig:arp-cmd})
清空本机已有的ARP缓存
开启Wiresharkping本机的同网段地址在显示过滤器条框中输入“\texttt{arp}”,
观察捕获的ARP报文的各个字段分析请求/响应的过程。
\item 使用\texttt{arp d}命令清空本机已有的ARP缓存。开启Wireshark
ping本机的不同网段地址或域名观察捕获的ARP报文的各个字段
分析请求/响应的过程。
\end{enumerate}
\subsection{思考题}
\label{subsec:c:wireshark:s:arp_rethink}

@ -118,7 +118,6 @@ ICMP询问报文有回送请求和应答、时间戳请求和应答、
\label{c:wireshark_icmp-structure}
\end{figure}
\renewcommand{\arraystretch}{1.5}
\begin{table}[!ht]
\small
\centering

@ -53,29 +53,8 @@ TCP 报文段结构如图\ref{fig:c:wireshark_TCP-structure}所示,
\small
\begin{figure}[!ht]
\centering
\begin{code}[text]
0 1 2 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Source Port | Destination Port |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Sequence Number |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Acknowledgment Number |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Data | |U|A|P|R|S|F| |
| Offset| Reserved |R|C|S|S|Y|I| Window |
| | |G|K|H|T|N|N| |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Checksum | Urgent Pointer |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Options | Padding |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| data |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
\end{code}
% \includegraphics[width=10cm]{TCP-structure}
\caption{TCP报文段结构标意图}
\includegraphics[width=10cm]{TCP-structure}
\caption{TCP报文段结构示意图}
\label{fig:c:wireshark_TCP-structure}
\end{figure}
@ -241,7 +220,6 @@ BBR\footnote{\href{https://queue.acm.org/detail.cfm?id=3022184}{BBR: Congestion-
\label{fig:c:wireshark_VM-advance-setup}
\end{figure}
\renewcommand{\arraystretch}{1.5}
\begin{table}[!ht]
\small
\centering

@ -0,0 +1,20 @@
%=========================================================================
% 版本声明
\clearpage
\begin{center}
\Large{Version 1.0$\alpha$} \\ \vspace{2em}
\Large{发布日期: \today}%{\number\year\number\month\number\day}}
% \\ \vspace{1em}
\end{center}
% \vfill
% \vspace{30em}
% \begin{tabular*}{\textwidth}{ccc}
% \includegraphics{figure/by-nc.eps}
% & \begin{minipage}[b]{0.6\textwidth}
% \small\sffamily
% 本作品采用知识共享 署名-非商业性使用 4.0 国际许可协议进行许可。\\
% 访问~\href{http://creativecommons.org/licenses/by-nc/4.0/}{此链接}~查看该许可协议。
% \end{minipage}
% \end{tabular*}

@ -1,48 +1,11 @@
%# -*- coding: utf-8-unix -*-
\thispagestyle{empty}
\begin{tikzpicture}[overlay,remember picture,font=\sffamily\bfseries]
% \draw[ultra thick,c4,name path=big arc] ([xshift=-2mm]current page.north) arc(150:285:11)
% coordinate[pos=0.225] (x0);
% \begin{scope}
% \clip ([xshift=-2mm]current page.north) arc(150:285:11) --(current page.north
% east);
% \fill[c4!50,opacity=0.25] ([xshift=4.55cm]x0) circle (4.55);
% \fill[c4!50,opacity=0.25] ([xshift=3.4cm]x0) circle (3.4);
% \fill[c4!50,opacity=0.25] ([xshift=2.25cm]x0) circle (2.25);
% \draw[ultra thick,c4!50] (x0) arc(-90:30:6.5);
% \draw[ultra thick,c4] (x0) arc(90:-30:8.75);
% \draw[ultra thick,c4!50,name path=arc1] (x0) arc(90:-90:4.675);
% \draw[ultra thick,c4!50] (x0) arc(90:-90:2.875);
% \path[name intersections={of=big arc and arc1,by=x1}];
% \draw[ultra thick,c4,name path=arc2] (x1) arc(135:-20:4.75);
% \draw[ultra thick,c4!50] (x1) arc(135:-20:8.75);
% \path[name intersections={of=big arc and arc2,by={aux,x2}}];
% \draw[ultra thick,c4!50] (x2) arc(180:50:2.25);
% \end{scope}
% \path[decoration={text along path,text color=c4,
% raise = -2.8ex,
% text along path,
% text = {|\sffamily\bfseries|计算机网络教案社区},
% text align = center,
% },
% decorate
% ] ([xshift=-2mm]current page.north) arc(150:245:11);
\begin{scope}
\path[clip,postaction={fill=c2}]
([xshift=2cm,yshift=2cm]current page.center) rectangle ++ (4.2,7.7);
% \fill[c2] ([xshift=0.5cm,yshift=2cm]current page.center)
% ([xshift=0.5cm,yshift=2cm]current page.center) arc(180:60:2)
% |- ++ (-3,6) --cycle;
% \draw[ultra thick,c4] ([xshift=-1.5cm,yshift=2cm]current page.center)
% arc(180:0:2);
% \draw[ultra thick,c4] ([xshift=0.5cm,yshift=2cm]current page.center)
% arc(180:0:2);
% \draw[ultra thick,c4] ([xshift=2.5cm,yshift=2cm]current page.center)
% arc(180:0:2);
% \draw[ultra thick,c4] ([xshift=4.5cm,yshift=2cm]current page.center)
% arc(180:0:2);
% \fill[red] ([xshift=2.5cm,yshift=-8cm]current page.center) +(60:2) circle(1.5mm);
\path[clip,postaction={fill=c2}]
([xshift=2cm,yshift=2cm]current page.center) rectangle ++ (4.2,7.7);
\end{scope}
\fill[c1] ([xshift=2cm,yshift=2cm]current page.center) rectangle ++ (-13.7,7.7);

@ -30,7 +30,7 @@
\begin{itemize}
\item 第一单元:谢怡、陈建发、洪劼超、雷蕴奇,厦门大学
\item 第二单元:吴荻、周丽涛,国防科技大学
\item 第二单元:吴荻、夏竟,国防科技大学
\item 第三单元:张晓丽,昆明理工大学
\item 第四单元:胡罡、孙志刚,国防科技大学
\item 第五单元:夏竟、蔡志平、徐明,国防科技大学

Binary file not shown.

After

Width:  |  Height:  |  Size: 67 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Before

Width:  |  Height:  |  Size: 255 KiB

After

Width:  |  Height:  |  Size: 255 KiB

Before

Width:  |  Height:  |  Size: 226 KiB

After

Width:  |  Height:  |  Size: 226 KiB

Before

Width:  |  Height:  |  Size: 50 KiB

After

Width:  |  Height:  |  Size: 50 KiB

Before

Width:  |  Height:  |  Size: 241 KiB

After

Width:  |  Height:  |  Size: 241 KiB

Before

Width:  |  Height:  |  Size: 290 KiB

After

Width:  |  Height:  |  Size: 290 KiB

Before

Width:  |  Height:  |  Size: 167 KiB

After

Width:  |  Height:  |  Size: 167 KiB

Before

Width:  |  Height:  |  Size: 347 KiB

After

Width:  |  Height:  |  Size: 347 KiB

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 11 KiB

Before

Width:  |  Height:  |  Size: 125 KiB

After

Width:  |  Height:  |  Size: 125 KiB

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 14 KiB

Before

Width:  |  Height:  |  Size: 146 KiB

After

Width:  |  Height:  |  Size: 146 KiB

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 49 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 223 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 39 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 58 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 92 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 33 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 53 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 61 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 68 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 79 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 60 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 34 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.8 KiB

@ -0,0 +1,83 @@
%# -*- coding: utf-8-unix -*-
\documentclass[zihao=-4]{ctexbook}
\input{config/main}
\begin{document}
\pagestyle{empty} % 前导页无页眉页脚
%============================================================
% 封面
\input{data/cover}
%============================================================
% 版权页
\input{data/copyright}
\frontmatter % 从前言开始用罗马数字作为页码
%============================================================
% 前言
\input{data/preface}
%============================================================
% 目录
\cleardoublepage
\tableofcontents
\mainmatter % 从正文开始用阿拉伯数字作为页码
\pagestyle{fancy} % 正文有页眉页脚
\setcounter{page}{1} % 正文页码从1开始
%============================================================
% 正文内容
% “网络抓包与协议分析”
\graphicspath{{figure/chapters/wireshark/}}
\input{data/ch_wireshark/preface}
\input{data/ch_wireshark/sec_arp}
\input{data/ch_wireshark/sec_ip}
\input{data/ch_wireshark/sec_tcp}
% “基于套接字的网络程序设计”
\graphicspath{{figure/chapters/socket/}}
\input{data/ch_socket/preface}
\input{data/ch_socket/sec_udp}
\input{data/ch_socket/sec_web}
\input{data/ch_socket/sec_smtp}
% “组网基础”
\graphicspath{{figure/chapters/ensp/}}
\input{data/ch_ensp/preface}
\input{data/ch_ensp/sec_static}
\input{data/ch_ensp/sec_rip}
\input{data/ch_ensp/sec_ospf}
% “路由器实现”
\graphicspath{{figure/chapters/router-openbox/}}
\input{data/ch_router-openbox/preface}
\input{data/ch_router-openbox/sec_switch}
\input{data/ch_router-openbox/sec_router}
\input{data/ch_router-openbox/sec_networking}
% “软件定义网络与网络测量”
\graphicspath{{figure/chapters/sdn-openbox/}}
\input{data/ch_sdn-openbox/preface}
\input{data/ch_sdn-openbox/sec_sdn}
\input{data/ch_sdn-openbox/sec_topo}
\input{data/ch_sdn-openbox/sec_ns}
%============================================================
% 附录
\appendix
% 速查手册
\graphicspath{{figure/appendixes/cheat_sheet/}}
\input{data/appendix/cheat_sheet}
% 华为网络仿真平台eNSP简介
\graphicspath{{figure/appendixes/ensp/}}
\input{data/appendix/ensp}
% FAST平台介绍与操作说明手册
\graphicspath{{figure/appendixes/fast/}}
\input{data/appendix/fast}
\end{document}
Loading…
Cancel
Save