[Xorp-users] Emulating multiple routers on the same host

Atanu Ghosh atanu@ICSI.Berkeley.EDU
Thu, 04 Aug 2005 08:16:41 -0700


Hi,

Setting the environment variable XORP_FINDER_SERVER_PORT hasn't
worked. The default port number is 19999, which is the port number in
the error message. The first XORP instance has started with the default
port number and the second has failed as it has clashed with the first.

The changes went in after the 1.1 release. Updating these two files and
recompiling may work for you:

Revison 1.12 finder_server.cc
<http://xorpc.icir.org/cgi-bin/cvsweb.cgi/xorp/libxipc/finder_server.cc>

Revison 1.47 xrl_router.cc
<http://xorpc.icir.org/cgi-bin/cvsweb.cgi/xorp/libxipc/xrl_router.cc>

	Atanu.

>>>>> "Ratul" == Ratul Mahajan <ratul@cs.washington.edu> writes:

    Ratul> atanu -

    Ratul> thanks for your response.

    Ratul> i tried what you suggested and i get the following error on the second
    Ratul> router instance.

    Ratul> -----------
    Ratul> % XORP_FINDER_SERVER_PORT=7002 ./xorp_rtrmgr -b CONFIG2

    Ratul> [.....................]

    Ratul> [ 2005/08/03 23:38:09  ERROR xorp_rtrmgr:738 LIBCOMM +177 comm_sock.c
    Ratul> comm_sock_bind4 ] Error binding socket (family = 2, my_addr =
    Ratul> 127.0.0.1, my_port = 19999): Address already in use
    Ratul> [ 2005/08/03 23:38:09  ERROR xorp_rtrmgr:738 RTRMGR +274
    Ratul> main_rtrmgr.cc run ] Address already in use: a finder may already be
    Ratul> running.
    Ratul> ------------

    Ratul> then, i tried the following, which did not work either.

    Ratul> ------------
    Ratul> % XORP_FINDER_SERVER_PORT=7002 ./xorp_rtrmgr -b CONFIG2 -p 20000

    Ratul> [.................]

    Ratul> [ 2005/08/03 23:40:18  WARNING xorp_rtrmgr:748 XrlFinderTarget +406
    Ratul> ../xrl/targets/finder_base.cc handle_finder_0_2_resolve_xrl ] Handling
    Ratul> method for finder/0.2/resolve_xrl failed: XrlCmdError 102 Command
    Ratul> failed [ 2005/08/03 23:40:19  WARNING xorp_rtrmgr:748 XrlFinderTarget
    Ratul> +406 ../xrl/targets/finder_base.cc handle_finder_0_2_resolve_xrl ]
    Ratul> Handling method for finder/0.2/resolve_xrl failed: XrlCmdError 102
    Ratul> Command failed Target "fea" does not exist or is not enabled.
    Ratul> [ 2005/08/03 23:40:19  ERROR xorp_rtrmgr:748 RTRMGR +1227 task.cc
    Ratul> task_fail ] Shutting down fatally wounded process (interfaces)
    Ratul> [ 2005/08/03 23:40:19  INFO xorp_rtrmgr:748 RTRMGR +216
    Ratul> module_manager.cc terminate ] Terminating module: interfaces
    Ratul> [ 2005/08/03 23:40:19  INFO xorp_rtrmgr:748 RTRMGR +262
    Ratul> module_manager.cc terminate ] Killing module: interfaces (pid = 749)
    Ratul> [ 2005/08/03 23:40:19  ERROR xorp_rtrmgr:748 RTRMGR +597
    Ratul> master_conf_tree.cc commit_pass2_done ] Commit failed: Can't validate
    Ratul> config ready of process interfaces
    Ratul> [ 2005/08/03 23:40:19  ERROR xorp_rtrmgr:748 RTRMGR +182
    Ratul> master_conf_tree.cc config_done ] Configuration failed: Can't validate
    Ratul> config ready of process interfaces
    Ratul> [ 2005/08/03 23:40:19  INFO xorp_rtrmgr:748 RTRMGR +1420 task.cc
    Ratul> run_task ] No more tasks to run
    Ratul> [ 2005/08/03 23:40:19  INFO xorp_rtrmgr:748 RTRMGR +216
    Ratul> module_manager.cc terminate ] Terminating module: interfaces
    Ratul> [ 2005/08/03 23:40:19  INFO xorp_rtrmgr:748 RTRMGR +262
    Ratul> module_manager.cc terminate ] Killing module: interfaces (pid = 749)
    Ratul> [ 2005/08/03 23:40:19  INFO xorp_rtrmgr:748 RTRMGR +547
    Ratul> module_manager.cc killed ] Module killed during shutdown: interfaces
    Ratul> [ 2005/08/03 23:40:19  INFO xorp_rtrmgr:748 RTRMGR +262
    Ratul> module_manager.cc terminate ] Killing module: interfaces (pid = 749)
    Ratul> [ 2005/08/03 23:40:21  FATAL xorp_rtrmgr:748 RTRMGR +299
    Ratul> module_manager.cc terminate_with_prejudice ] Assertion (path_iter !=
    Ratul> module_paths.end()) failed
    Ratul> Aborted

    Ratul> ---------------------

    Ratul> i am using release 1.1.  (in case your instructions work only with the
    Ratul> current code).

    Ratul> thanks.

    Ratul> Atanu Ghosh wrote:
    >> Hi,
    >> I have recently been experimenting with imunes
    >> <http://www.imunes.net/>. Imunes allows the creation of multiple network
    >> stacks on a single host. Currently Imunes only works on FreeBSD 4.11 and
    >> requires kernel modifications. I have built a FreeBSD 4.11 system inside
    >> vmware applied the kernel patches and built XORP. My very limited
    >> experiments have worked well. Multiple instances of XORP can be run on a
    >> single host each on its own network stack. Therefore no modifications to
    >> XORP.
    >> If you want to run multiple instance of XORP/BGP on one host the
    >> instructions are below.
    >> NOTE: BGP IS THE ONLY PROTOCOL THAT CAN BE RUN THIS WAY.
    >> Atanu.
    >> ========================================
    >> 1) Modify the template files to run the dummy fea rather than the
    >> real
    >> fea. Otherwise multiple processes will attempt to modify the routing
    >> table. In xorp/etc/templates run the script below or modify the
    >> templates manually.
    >> ----------------------------------------
    >> #!/bin/sh
    >> grep -l \"fea/xorp_fea\" * |
    >> while read name
    >> do
    >> echo $name
    >> ed $name <<\!
    >> 1,$s/"fea\/xorp_fea"/"fea\/xorp_fea_dummy"/
    >> wq
    >> !
    >> done
    >> ----------------------------------------
    >> 2) Create the router configuration files. The BGP protocol requires
    >> that port 179 is used TCP sessions. As our regression tests run on a
    >> single host our BGP can be configured to use any port.
    >> Below is the configuration for two XORP instances on a single host:
    >> CONFIG1
    >> ----------------------------------------
    >> interfaces {
    >> interface dc0 {
    >> vif dc0 {
    >> disable: false
    >> address 10.10.10.1 {
    >> prefix-length: 24
    >> broadcast: 10.10.10.255
    >> disable: false
    >> }
    >> }
    >> }
    >> }
    >> protocols {
    >> bgp {
    >> bgp-id: 10.10.10.1
    >> local-as: 65001
    >> peer 127.0.0.1 {
    >> local-ip: 127.0.0.1
    >> as: 65002
    >> next-hop: 10.10.10.1
    >> local-port: 2001
    >> peer-port: 2002
    >> }
    >> /* Introduce a route */
    >> network4 10.10.10.0/24 {
    >> next-hop: 10.10.10.1
    >> unicast: true
    >> multicast: true
    >> }
    >> 
    >> }
    >> }
    >> ----------------------------------------
    >> CONFIG2
    >> ----------------------------------------
    >> interfaces {
    >> interface dc0 {
    >> vif dc0 {
    >> disable: false
    >> address 10.10.10.2 {
    >> prefix-length: 24
    >> broadcast: 10.10.10.255
    >> disable: false
    >> }
    >> }
    >> }
    >> }
    >> protocols {
    >> bgp {
    >> bgp-id: 10.10.10.2
    >> local-as: 65002
    >> peer 127.0.0.1 {
    >> local-ip: 127.0.0.1
    >> as: 65001
    >> next-hop: 10.10.10.2
    >> local-port: 2002
    >> peer-port: 2001
    >> }
    >> }
    >> }
    >> ----------------------------------------
    >> 3) The different processes that make up a XORP router communicate
    >> with
    >> each other using a default port. This port number can be changed using
    >> the enviroment variable "XORP_FINDER_SERVER_PORT".
    >> Start two instances of XORP in separate shells:
    >> XORP_FINDER_SERVER_PORT=7001 ./xorp_rtrmgr -b CONFIG1
    >> XORP_FINDER_SERVER_PORT=7002 ./xorp_rtrmgr -b CONFIG2
    >> Either XORP router instance can now be communicated with by setting
    >> the appropriate enviroment varaiable. Note that router2 has the route
    >> introduced by router1.
    >> ----------------------------------------
    >> emu$ XORP_FINDER_SERVER_PORT=7002 ./xorpsh
    >> Welcome to XORP on emu.icir.org
    Xorp> show bgp routes Status Codes: * valid route, > best route
    >> Origin Codes: i IGP, e EGP, ? incomplete
    >> Prefix                Nexthop                    Peer
    >> AS Path
    >> ------                -------                    ----            -------
    >> *> 10.10.10.0/24         10.10.10.1                 10.10.10.1     65001 ?
    Xorp> ----------------------------------------
    >> ========================================
    >> 
    >>>>>>> "Ratul" == Ratul Mahajan <ratul@cs.washington.edu> writes:
    Ratul> James Courtier-Dutton wrote:
    >> >> On 8/1/05, Ratul Mahajan <ratul@cs.washington.edu> wrote:
    >> >>     >>> > You can currently run multiple BGP instances on the
    >> same
    >> >>> machine, as > BGP uses TCP, and you can configure the peer
    >> >>> address and port on a > per-peer basis.  So if you want to
    >> >>> experiment with BGP, this is > possible without code changes.
    >> >>> But the resulting virtual routers > won't actually forward
    >> >>> packets to each other, so this is only useful > for routing
    >> >>> experiments, not a general solution.
    >> >>>     >>> so whats the simplest way to accomplish this?
    >> >>>     >>> (i realize that the answer is there somewhere in the
    >> code/docs
    >> >>> but specific pointers would help.)
    >> >>  How about using XEN. You can then virtualise multiple Linux
    >> >> boxes efficiently, and run a single XORP on each one.
    Ratul> i guess that (and other interface-level virtualization
    Ratul> mechanisms) is an option but i'd be more interested in
    Ratul> retaining the configuration of the experimenting machine and
    Ratul> play at a user-level if possible.
    Ratul> thanks.  _______________________________________________
    Ratul> Xorp-users mailing list Xorp-users@xorp.org
    Ratul> http://mailman.ICSI.Berkeley.EDU/mailman/listinfo/xorp-users