[Xorp-users] Emulating multiple routers on the same host
Atanu Ghosh
atanu@ICSI.Berkeley.EDU
Wed, 03 Aug 2005 13:41:23 -0700
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