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

Ratul Mahajan ratul@cs.washington.edu
Wed, 03 Aug 2005 23:45:22 -0700


atanu -

thanks for your response.

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

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

[.....................]

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

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

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

[.................]

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

---------------------

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

thanks.

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