VxWorks ospf 使用实例
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
AppNote-133 WindNet OSPFv2 2.1 – a Quick Tutorial
Installing, Configuring, and Testing WindNet OSPFv2 2.1 Between Two Wind River wrSbc8260 Reference Boards
Copyright © 1984-2001 Wind River Systems Inc.
ALL RIGHTS RESERVED.
Abstract
The Open Shortest Path First (OSPF) routing protocol is a link-state hierarchical
Interior Gateway Protocol (IGP) widely used throughout the Internet. WindNet
OSPF 2.1 is Wind River’s implementation of the OSPF routing protocol. This
version of WindNet OSPF supports dynamic configuration through Simple
Network Management Protocol (SNMP) Management Information Base (MIBs).
It also runs with above the WindNet Router Network Stack, and WindNet OSPF
takes advantage of many of the Router Stack features such as unnumbered
Internet Protocol (IP) addressing.
The purpose of this technical note is to describe the sequence of steps required
to install, configure, and test the WindNet OSPFv2 2.1 product between two
wrSbc8260 reference boards as a quick tutorial. After completing this exercise,
developers can easily extend this example to test some additional OSPF features,
and also extend the test configuration to include additional targets or even
commercial IP routers.
Outline:
1.0 Introduction
2.0 Recommended Hardware
3.0 Software Installation
4.0 Building the WindNet Router Stack
5.0 Building WindNet OSPFv2 2.1
6.0 Building a VxWorks image – via the Command-Line Build Approach
7.0 Testing WindNet OSPFv2 2.1
Appendix A: Example OSPF Configuration – cfg_sbc1.txt
Appendix B: Example OSPF Configuration – cfg_sbc2.txt
1.0 Introduction:
This AppNote explains how to install, build, configure, and run WindNet OSPF v2 2.1
between two targets as a simple example. This procedure was tested between 2 wrSbc8260 PowerPC based targets. The purpose of this AppNote is to help developers succeed in
getting OSPF up in running in an extremely short amount of time. This Appnote includes instructions for building a vxWorks image using the command-line build approach. The
project facility approach may also be used, but it is left as an exercise for the reader.
2.0 Recommended Hardware:
??Two targets (2 wrSbc8260 reference boards for example)
?? A minimum of 16 MB of RAM is recommended for each target since WindNet OSPF v2
2.1 allocates an 8 MB amount of RAM at startup.
??One Ethernet hub or switch.
3.0 Software Installation:
a) Install Tornado 2.0.2 for PowerPC
b) Install additional Board Support Packages (e.g. wrSbc8260)
c) Download the WindNet Router Stack 1.0 FCS [available from WindSurf]
- Go to: /windsurf
- Login or create a new login and password then login
- Click on 'Downloads'
- Click on 'Electronic Software Distribution (ESD)'
- Click on 'TDK-14373.tar.gz'
- Note: Other files are available for processors other than PowerPC.
- Decompress the file so that it may be installed via the setup program
- On Solaris:
# gunzip TDK-14338.tar.gz
# tar -xvf TDK-14338.tar
# ./SETUP
- On Windows hosts:
Decompress the file into a temporary directory
Click on SETUP.EXE
d) Download the WindNet OSPFv2 2.1 [available from Windsurf]
- The OSPFv2 2.1 code is posted on Windsurf.
- Please refer to the Release notes, rnOSPFv2.pdf for installation instructions and the readme.txt for a list of outstanding problems.
- Go to: /windsurf
- Login or create a new login and password then login
- Click on 'Downloads'
- Click on 'Electronic Software Distribution (ESD)'
- Click on 'TDK-14563.tar.gz'
- Note: Other files are available for processors other than PowerPC.
- Decompress the file so that it may be installed via the setup program
e) On Solaris 2.8 and above:
# gunzip TDK-14563.tar.gz
# tar -xvf TDK-14563.tar
# ./SETUP
f) On Windows hosts:
Decompress the file into a temporary directory
Click on SETUP.EXE
g) Install Envoy SNMP 9.2 into a separate installation directory.
- See the Envoy 9.2 Release notes for installation instructions.
- Note: Envoy SNMP installation may be deferred in order to demonstrate OSPF in
a short period of time.
4.0 Building the WindNet Router Stack
The WindNet Router Stack is a source code product, so the source code must be compiled before it is used. Each directory containing Router Stack source code may be built individually, or they may be built automatically built using the unsupported scripts. To use the unsupported build scripts, adjust the each batch (Windows) or Unix script file to reflect the WIND_BASE directory (installation directory). Next, perform a clean, and then a build as follows:
On Windows hosts run the build scripts as follows:
C:> libRtrStkBuild <CPU_TYPE>
Example:
C:> libRtrStkClean PPC603
C:> libRtrStkBuild PPC603
On Solaris run the shell scripts as follows:
%./libRtrStkBuild.dat <CPU_TYPE>
Example:
% ./libRtrStkClean.dat PPC603
% ./libRtrStkBuild.dat PPC603
5.0 Building WindNet OSPFv2 2.1:
5.1 OSPF Pre-Build Adjustments:
Modify /target/src/wrn/rtm/Makefile
Uncomment the following lines by removing the "#" at the beginning of the line:
#PREPROC_SYNTH_RS=-DROUTER_STACK
#PREPROC_RTM_SYNTH=-D__RTM_FOR_SYNTH__
Modify /target/src/wrn/addif/Makefile
Add the following line:
EXTRA_DEFINE=-DROUTER_STACK
Modify /target/src/wrn/ospf/Makefile
Add the following flag by removing the "#" at the beginning of the line
#PREPROC_MIB=-D__OSPF_MIB__
Uncomment the following line by removing the "#" at the beginning of the line:
#PREPROC_FTP=-D__OSPF_FTP__
Adjust the following lines to point to the Envoy 9.2 installation:
#Envoy 9.2 header files
WRN_EPILOGUE_INSTALLDIR=$(TGT_DIR)/src/wrn/epilogue
WRN_HEADERS_SNMP_DIR=$(TGT_DIR)/h/snmp
WRN_EPILOGUE_INSTALL_DIR1=$(WRN_EPILOGUE_INSTALLDIR)/port/vxworks
For example:
WRN_EPILOGUE_INSTALLDIR=C:\env92_603
WRN_HEADERS_SNMP_DIR=C:\env92_603\snark\vxworks\h\snmp
WRN_EPILOGUE_INS TALL_DIR1=$(WRN_EPILOGUE_INSTALLDIR)/port/vxworks
Note: If Envoy 9.2 is not yet installed, the three lines mentioned above may be commented out by inserting a “#” sign at the beginning of each line.
Unnumbered links are not used in this tutorial, but they may be enable for future use by removing the “#” at the beginning of each line below:
#Unnumbered Link -bt-
#PREPROC_UNNUMBERED=-D__UNNUMBERED_LINK__
Modify /target/src/wrn/ospf_te/Makefile
Adjust the following lines to point to the Envoy 9.2 installation:
#Envoy 9.2 header files
WRN_EPILOGUE_INSTALLDIR=$(TGT_DIR)/src/wrn/epilogue
WRN_HEADERS_SNMP_DIR=$(TGT_DIR)/h/snmp
WRN_EPILOGUE_INSTALL_DIR1=$(WRN_EPILOGUE_INSTALLDIR)/port/vxworks
For example:
WRN_EPILOGUE_INSTALLDIR=C:\env92_603
WRN_HEADER S_SNMP_DIR=C:\env92_603\snark\vxworks\h\snmp
WRN_EPILOGUE_INSTALL_DIR1=$(WRN_EPILOGUE_INSTALLDIR)/port/vxWorks
Note: If Envoy 9.2 is not yet installed, the three lines mentioned above may be commented out by inserting a “#” sign at the beginning of each line.
Uncomment the following line:
#PREPROC_FTP=-D__OSPF_FTP__
Uncomment the following line:
#PREPROC_MIB=-D__OSPF_MIB__
Uncomment the following line:
#PREPROC_UNNUMBERED=-D__UNNUMBERED_LINK__
Adjust the /target/src/wrn/ospf/netinet/Makefile
Remove: -DBUILD_FOR_T2 from the ADDED_CFLAGS
If Envoy SNMP is installed, problems may arise when building the /target/src/wrn/ospf directory. The build may not find the following header files: envoy.h, common.h and oemtypes.h which are
located in envoy installation directory under port/vxworks. One possible workaround is to copy these files to the /target/h/snmp directory.
Also copy /EPILOGU_BASE/snark/vxworks/h/snmp/snmpdInit.h to
/target/h/snmp/snmpdInit.h
Also copy /EPILOGUE_BASE/snark/vxworks/h/snmp/
buffer.h, snmpdefs.h, and auxfuncs.h
to: /target/h/snmp
Comment out the following line in /target/src/wrn/rtm/rtm_explib.h (SPR # 74171)
#define routeEntryDelete routeEntryDel
5.1 Building the OSPF Components:
The OSPF source code components may be compiled by building each folder individually or by using build scripts, which automate this procedure. The OSPF components may be built using the unsupported build scripts as follows. Adjust each batch file or Unix script file to reflect the WIND_BASE directory, then clean and build the source code as follows:
On windows hosts:
C:> libOspf21Clean <CPU_TYPE>
Example: C:> libOspf21Clean PPC603
C:> libOspf21Build <CPU_TYPE>
Example: C:> libOspf21Build PPC603
On Solaris hosts:
%./libOspf21Clean.dat <CPU_TYPE>
Example: % ./libOspfClean.dat PPC603
%./libOspf21Build.dat <CPU_TYPE>
Example: % ./libOspfBuild.dat PPC603
This completes the building of the OSPF Source Code. If the build succeeded, proceed with building a vxWorks image using the command-line build method as described below.
6.0 Building a VxWorks image – Via the Command-Line Build Approach:
Assuming the source files built successfully, a vxWorks image may be built by building a BSP using the command-line build method after making the additional modifications:
- Make the following adjustments to the BSP:
- Adjust the wrSbc8260 Makefile as follows:
For boards with only 16 MB of RAM, change the following from:
RAM_HIGH_ADRS = 01E00000
To:
RAM_HIGH_ADRS = 00E00000
Change the following from:
MACH_EXTRA= m8260FccEnd.obj miiLib.obj #m8260SccEnd.obj
EXTRA_MODULES = $(BSP_DIR)\m8260FccEnd.obj $(BSP_DIR)\miiLib.obj
#$(BSP_DIR)\m8260SccEnd.obj
To:
MACH_EXTRA= m8260FccEnd.obj miiLib.obj m8260SccEnd.obj
c:\env92_603\snark\vxworks\agent\snmp
EXTRA_MODULES = $(BSP_DIR)\m8260FccEnd.obj $(BSP_DIR)\miiLib.obj
$(BSP_DIR)\m8260SccEnd.obj
c:\env92_603\snark\vxworks\agent\snmp
Notice that the Envoy 9.2 SNMP agent binary is added to each line above. Change the last setting in each line to match the location of the SNMP binary in the installation.
- Note: For project facility builds, it may be necessary to remove the "$(BSP_DIR)\" before the object names.
For example, change this from:
$(BSP_DIR)\m8260FccEnd.obj
To:
m8260FccEnd.obj
- Adjust config.h in the BSP as follows:
- if the wrSbc8260 only has 16 MB of RAM, change the following from:
#undef INCLUDE_16MEG_SDRAM
#define INCLUDE_64MEG_SDRAM
To:
#define INCLUDE_16MEG_SDRAM
#undef INCLUDE_64MEG_SDRAM
- Change the following line from:
#define BOOT_DEVICE FCC_END
To:
#define BOOT_DEVICE SCC_FCC_END
- Add the following #defines to config.h in the BSP:
#undef IP_MAX_UNITS
#define IP_MAX_UNITS 2
/********* Router Stack Definitions ************/
#undef INCLUDE_NETWRS_IFINDEXLIB
#define INCLUDE_NETWRS_IFINDEXLIB
#undef INCLUDE_NETINET_IF_ETHER
#define INCLUDE_NETINET_IF_ETHER
#undef ARP_MAX_ENTRIES
#define ARP_MAX_ENTRIES 20
/* IGMPV2 router support
#undef INCLUDE_IGMP_ROUTER
#define INCLUDE_IGMP_ROUTER
*/
/* Include the fastpath library
#undef INCLUDE_FASTPATH
#define INCLUDE_FASTPATH
*/
/* Include the ICMP router discovery server
#undef INCLUDE_RDISC
#define INCLUDE_RDISC
*/
/* Remote access to target shell
#undef INCLUDE_SHELL_REMOTE
#define INCLUDE_SHELL_REMOTE
*/
/* RARP client support
#undef INCLUDE_RARP
#define INCLUDE_RARP
*/
/* if using the pcPentium BSP on x86, uncomment the following: */ /* not sure if this is necessary anymore for the fcs release
#undef INCLUDE_SLIP
#undef SLIP_TTY
*/
/******* End of Router Stack Definitions ********/
/* ENVOY 9.2 definitions */
#define INCLUDE_SNMPD
#define INCLUDE_MIB2_ALL
/***** Include The Ping Client ******/
#define INCLUDE_PING
/*************************************/
/* Include Network/other Routines: ***/
#define INCLUDE_NET_SHOW
#define INCLUDE_SHOW_ROUTINES
/*************************************/
/*************************************/
/*#define INCLUDE_WDB_TSFS*/
#define INCLUDE_LOADER
/*************************************/
/****** Include the target shell ******/
#define INCLUDE_SHELL
#define INCLUDE_SHELL_BANNER
#undef SHELL_STACK_SIZE
#define SHELL_STACK_SIZE (20000)
/*************************************/
/** Include a network symbol table ***/
#define INCLUDE_CPLUS_DEMANGLER
#define INCLUDE_STARTUP_SC RIPT /* execute start-up script */
#define INCLUDE_STAT_SYM_TBL /* create user-readable error status */
#define INCLUDE_SYM_TBL /* symbol table package */
#define INCLUDE_NET_SYM_TBL /* load symbol table from network */
/*************************************/
/** Include WindNet OSPF v2 2.0 **/
#define INCLUDE_RWLIB
#define INCLUDE_ROUTE_SOCK
#define INCLUDE_OSPF
#define AUTO_START 0
#define OSPF_IP_BIND_ID 0
#define INCLUDE_OSPF_IP_INTERFACE
/*********************************/
- Make the following change to /target/src/config/usrNetwork.c:
- Change the following line from:
ospfLibInit ();
To:
ospfInitialize(0);
- Open a Windows dos prompt window, or a Unix shell window, and setup the Tornado environment variables if they aren't already set:
- On Windows NT or 2000:
C:> cd C:\tornado\host\x86-win32\bin
C:\tornado\host\x86-win32\bin> torvars
C:\tornado\host\x86-win32\bin> cd\
C:> cd C:\tornado\target\config\bspname
- On Solaris:
/bin/csh
cd /WIND_BASE/host/sun4_solaris/bin
source ./torVars.csh
cd /WIND_BASE/target/config/bspname
- Build a vxWorks image:
make CPU=PPC603 clean
make CPU=PPC603 vxWorks
- Adjust the bootline on the target to load the vxWorks image built by the bootable project - reboot the target
6.0 Testing WindNet OSPFv2 2.1
The following diagram illustrates the simple test setup. After completing this test exercise, this setup may easily be extended to include more complex OSPF configurations.
sbc#1sbc#2
192.168.195.5192.168.195.6
Figure 1: OSPF Test Configuration
- Create two text configurations similar to those provided in Appendix A and B: ospfcfg_sbc1.txt, and ospfcfg_sbc2.txt. Adjust the IP addresses as needed to match the IP addresses of the network the targets are attached to. If the IP addresses are different than those shown in Figure 1 above, the following lines must be adjusted in each text file
configuration:
OSPF Router ID = 192.168.195.5\n
OSPF Area Address Range Address = 00,192.168.195.5\n
OSPF Area Address Range Mask = 00,255.255.255.0\n
OSPF Port Address = 00,192.168.195.5\n
OSPF Port Address Mask = 00,255.255.255.0\n
o The “OSPF Router ID”, the “OSPF Area Address Range
Address”, and the “OSPF Port Address” should all match an
IP address assigned to the target.
o The “OSPF Area Address Range Mask”, and the “OSPF Port
Address Mask” should match the subnet mask of that interface.
- Start the FTP server on the host
- Initialize ospf on each target:
For the sbc1 target:
-> ospf_init "ospfcfg_sbc1.txt", "192.168.195.3","E:\demo","vxworks","itsasecret"
For the sbc2 target:
-> ospf_init "ospfcfg_sbc2.txt", "192.168.195.3","E:\demo","vxworks","itsasecret" In the lines above, each parameter corresponds to the following:
- ospf_cfg_sbc1.txt - is the name of the configuration file
- 192.168.195.3 - is the address of the FTP server
- E:\demo - is the directory on the host where the file resides
- vxworks - is the ftp username
- itsasecret - is the ftp password
- ospfEnableDebug may be used to review debugging information:
a) Type the following command in either the WindShell or the Target shell to list possible
OSPF debug options:
-> ospfEnableDebug()
b) Use the following to review all incoming and outgoing OSPF packets:
-> ospfEnableDebug("PACKET")
c) Use the following to enable all OSPF debug messages:
-> ospfEnableDebug("ALL")
Appendix A: Example OSPF Configuration – ospfcfg_sbc1.txt
[[OSPF Routing = Section Start]]\n
OSPF Use Default Values = enabled\n
OSPF = enabled\n
OSPF Router ID = 192.168.195.5\n
OSPF Number of Areas = 1\n
OSPF Total Number of Area Address Ranges = 0\n
OSPF Number of Ports = 1\n
OSPF Port Passive-Interface = none\n
OSPF Autonomous System Border Router = disabled\n
OSPF Redistribute Default = disabled\n/* Needs to be enabled for redistribution of routes */
OSPF Redistribute Static = disabled\n /* Needs to be enabled for redistribution of routes */
OSPF Redistribute BGP = disabled\n /* Needs to be enabled for OSPF-BGP interaction */
OSPF Redistribute RIP = disabled\n /* Needs to be enabled for OSPF-RIP interaction */
OSPF IP Multicast = enabled\n
OSPF Type of Service Capability = disabled\n
OSPF Printf = enabled\n
OSPF Printf INTERFACE = disabled\n
OSPF Printf NEIGHBOR = disabled\n
OSPF Printf Memory = disabled\n
OSPF Printf Alarm = disabled\n
OSPF Printf SNMP = disabled\n
OSPF Printf Packets = disabled\n
OSPF Printf Routing Table = disabled\n
OSPF Printf Debug = disabled\n
OSPF Printf DB Overflow = disabled\n
OSPF Route Queue Process Interval = 1\n
OSPF Opaque Capability = disabled\n
OSPF RFC1583 Compatibility = enabled\n
OSPF Point to Point Router Lsa Option = 2\n
#if defined (__OSPF_DB_OVERFLOW_SUPPORT__)
OSPF External LSDB Limit = -1\n
OSPF Exit Overflow Interval = 0\n
#endif /*__OSPF_DB_OVERFLOW_SUPPORT__*/
\n
OSPF Area ID = 00,0.0.0.0\n
OSPF Area External Routing Capability = 00,enabled\n
\n
OSPF Area Address Range Address = 00,192.168.195.5\n
OSPF Area Address Range Mask = 00,255.255.255.0\n
OSPF Area Address Range Advertise = 00,enabled\n
OSPF Area Address Range Area ID = 00,0.0.0.0\n
\n
OSPF Port = 00,enabled\n
OSPF Port Address = 00,192.168.195.5\n
OSPF Port Address Mask = 00,255.255.255.0\n
OSPF Port Area ID = 00,0.0.0.0\n
OSPF Port Priority = 00,1\n
OSPF Port Cost = 00,1\n
OSPF Port Hello Interval = 00,10\n
OSPF Port Router Dead Interval = 00,40\n OSPF Port Transmit Delay = 00,1\n
OSPF Port Passive = 00, disabled\n
OSPF Port Type = 00,2\n
\n
[[OSPF Routing = Section End]]\n
Appendix B: Example OSPF Configuration – ospfcfg_sbc2.txt
[[OSPF Routing = Section Start]]\n
OSPF Use Default Values = enabled\n
OSPF = enabled\n
OSPF Router ID = 192.168.195.6\n
OSPF Number of Areas = 1\n
OSPF Total Number of Area Address Ranges = 0\n
OSPF Number of Ports = 1\n
OSPF Port Passive-Interface = none\n
OSPF Autonomous System Border Router = disabled\n
OSPF Redistribute Default = disabled\n/* Needs to be enabled for redistribution of routes */ OSPF Redistribute Static = disabled\n /* Needs to be enabled for redistribution of routes */ OSPF Redistribute BGP = disabled\n /* Needs to be enabled for OSPF-BGP interaction */ OSPF Redistribute RIP = disabled\n /* Needs to be enabled for OSPF-RIP interaction */ OSPF IP Multicast = enabled\n
OSPF Type of Service Capability = disabled\n
OSPF Printf = enabled\n
OSPF Printf INTERFACE = disabled\n
OSPF Printf NEIGHBOR = disabled\n
OSPF Printf Memory = disabled\n
OSPF Printf Alarm = disabled\n
OSPF Printf SNMP = disabled\n
OSPF Printf Packets = disabled\n
OSPF Printf Routing Table = disabled\n
OSPF Printf Debug = disabled\n
OSPF Printf DB Overflow = disabled\n
OSPF Route Queue Process Interval = 1\n
OSPF Opaque Capability = disabled\n
OSPF RFC1583 Compatibility = enabled\n
OSPF Point to Point Router Lsa Option = 2\n
#if defined (__OSPF_DB_OVERFLOW_SUPPORT__)
OSPF External LSDB Limit = -1\n
OSPF Exit Overflow Interval = 0\n
#endif /*__OSPF_DB_OVERFLOW_SUPPORT__*/
\n
OSPF Area ID = 00,0.0.0.0\n
OSPF Area External Routing Capability = 00,enabled\n
\n
OSPF Area Address Range Address = 00,192.168.195.6\n
OSPF Area Address Range Mask = 00,255.255.255.0\n
OSPF Area Address Range Advertise = 00,enabled\n
OSPF Area Address Range Area ID = 00,0.0.0.0\n
\n
OSPF Port = 00,enabled\n
OSPF Port Address = 00,192.168.195.6\n
OSPF Port Address Mask = 00,255.255.255.0\n
OSPF Port Area ID = 00,0.0.0.0\n
OSPF Port Priority = 00,1\n
OSPF Port Cost = 00,1\n
OSPF Port Hello Interval = 00,10\n
OSPF Port Router Dead Interval = 00,40\n
OSPF Port Transmit Delay = 00,1\n
OSPF Port Passive = 00, disabled\n
OSPF Port Type = 00,2\n
\n
[[OSPF Routing = Section End]]\n。