Linux namespace ns3 - Unable to connect to any daemons

812 views
Skip to first unread message

ashok kumar

unread,
Sep 24, 2011, 11:23:14 AM9/24/11
to ns-3-users, Tom Henderson, Hajime Tazaki
Hi
I am creating a following network

subnet1(10.0.0.0) subnet2(10.0.1.0)
subnet3(10.0.2.0) subnet4(10.0.3.0)
_______________ ______________
_______________ _______________
|
| |
|
|
| |
|

------------------------------------------------------------------------------------------------------------------------------------------
|
Router
|

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

I modified the createnodes function of csma-line-quagga.py to create
above topology

def createnodes(self, numnodes, devhelper, nodenum = 0):
c = []
n=4
d = []
ip = []
csma = ns3.CsmaHelper()
addr = ns3.Ipv4AddressHelper()
csma.SetChannelAttribute ("DataRate",
ns3.DataRateValue (ns3.DataRate (5000000)));
csma.SetChannelAttribute ("Delay", ns3.TimeValue
(ns3.MilliSeconds (2)));
csma.SetDeviceAttribute ("Mtu", ns3.UintegerValue
(1400));
internet = ns3.InternetStackHelper()
router = NetnsNode("router",logfile = "/tmp/
router.log")
self.nodes.append(router)
internet.Install(router)
for j in xrange(n):
c.append(ns3.NodeContainer)
c[j] = ns3.NodeContainer()
for i in xrange(numnodes):
name = "n%s" % nodenum
n = NetnsNode (name, logfile = "/tmp/
%s.log" % name)
internet.Install(n)
self.nodes.append(n)
c[j].Add (self.nodes[nodenum])
nodenum += 1
d.append(ns3.NetDeviceContainer)
d[j] = ns3.NetDeviceContainer()
d[j] = csma.Install(router)
d[j].Add(csma.Install(c[j]))
addr_str = "10." + str(j) + ".0.0"

addr.SetBase(ns3.Ipv4Address(addr_str),ns3.Ipv4Mask("255.255.255.0"))
ip.append(ns3.Ipv4InterfaceContainer)
ip[j] = addr.Assign(d[j])

But when I run the program, I am getting following error

vtysh -c 'show ip ospf neighbor'

Exiting: failed to connect to any daemons

also when I run ifconfig, only loopback address is showing.

When I look into config function, they are referring only 10.0.0.0. Is
this the place to do some modification.

I retained every part of csma-line-quagga.py but only modified
createnodes function as above.

Some one please help me in resolving this problem.

ashok kumar

unread,
Sep 25, 2011, 1:37:03 AM9/25/11
to ns-3-users
Hi
Now I am facing another problem. Now after making this code, i tried
running csma-line-quagga.py -t 30
and I am getting following error.Initially all programs under example
directory are running.

/home/ashok/research/implementation/ns-allinone-3.11/netns3/examples/
netns3.py:3: DeprecationWarning: the ns3 module is a compatibility
layer and should not be used in newly written code
import ns3
Traceback (most recent call last):
File "./csma-line-quagga.py", line 92, in <module>
x.main()
File "/home/ashok/research/implementation/ns-allinone-3.11/netns3/
examples/netns3.py", line 149, in main
self.run()
File "/home/ashok/research/implementation/ns-allinone-3.11/netns3/
examples/netns3.py", line 118, in run
self.setup()
File "./csma-line-quagga.py", line 85, in setup
CsmaExperiment.setup(self)
File "/home/ashok/research/implementation/ns-allinone-3.11/netns3/
examples/netns3.py", line 175, in setup
self.createnodes(self.options.numnodes, devhelper)
File "./csma-line-quagga.py", line 27, in createnodes
n = NetnsNode(name, logfile = "/tmp/%s.log" % name)
File "/home/ashok/research/implementation/ns-allinone-3.11/netns3/
examples/netns3.py", line 45, in __init__
Netns3.__init__(self, *args, **kwds)
File "/usr/local/lib/python2.6/dist-packages/netns.py", line 245, in
__init__
self.start()
File "/usr/local/lib/python2.6/dist-packages/netns.py", line 251, in
start
self.pid, self.port = self.spawnserver(self.name, self.logfile)
File "/usr/local/lib/python2.6/dist-packages/netns.py", line 219, in
spawnserver
(cls.__name__, erroutput.strip()))
ValueError: NetnsNode.spawnserver() failed:
creating netns failed: [Errno 22] Invalid argument


I followed the discussion
http://groups.google.com/group/ns-3-users/browse_thread/thread/cedfe00612ab84d5

I am using Ubuntu 10.4 LTS
My python version is Python 2.6.5

Please help me solving these probelms

Regards
Ashok

ashok kumar

unread,
Sep 25, 2011, 3:00:31 AM9/25/11
to ns-3-users
Hi
The second issue was solved. I reinstalled everything and restarted My machine. Now csma-line-quagga.py is working fine.

Regarding first issue. I suspect error was in line

 router = NetnsNode("router",logfile = "/tmp/router.log")


because initially I was getting error as

File "./temp.py", line 84, in config
    subprocess.checkcall(["chown","quagga.quagga", confdirname])
AttributeError: 'module' object has no attribute 'checkcall'


I changed quagga.quagga in config function to debian.conf(its path name /etc/quagga/debian.conf). Now I am getting following error

 File "/usr/lib/python2.6/subprocess.py", line 498, in check_call
    raise CalledProcessError(retcode, cmd)
CalledProcessError: Command '['chown', 'debian.conf', '/tmp/router.bp0tUk']' returned non-zero exit status 1

Further in /etc/quagga/daemons

Following options are turned off.

zebra=no
bgpd=no
ospfd=no
ospf6d=no
ripd=no
ripngd=no
isisd=no

Whether I need to turn them on.

please help me to solve this
Regards
Ashok
 
 

--
You received this message because you are subscribed to the Google Groups "ns-3-users" group.
To post to this group, send email to ns-3-...@googlegroups.com.
To unsubscribe from this group, send email to ns-3-users+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/ns-3-users?hl=en.


ashok kumar

unread,
Sep 26, 2011, 1:15:06 AM9/26/11
to ns-3-users, Tom Henderson, Hajime Tazaki
Hi
Finally simulation is working but not showing results.

Out put :
netns router: pid 5350 port 46801 logfile /tmp/router.log
netns n0: pid 5357 port 51764 logfile /tmp/n0.log
netns n1: pid 5363 port 47103 logfile /tmp/n1.log
netns n2: pid 5369 port 55694 logfile /tmp/n2.log
netns n3: pid 5375 port 41794 logfile /tmp/n3.log
netns n4: pid 5381 port 53318 logfile /tmp/n4.log
netns n5: pid 5387 port 47557 logfile /tmp/n5.log
netns n6: pid 5393 port 52762 logfile /tmp/n6.log
netns n7: pid 5399 port 41998 logfile /tmp/n7.log
netns n8: pid 5405 port 46165 logfile /tmp/n8.log
netns n9: pid 5411 port 59256 logfile /tmp/n9.log
netns n10: pid 5417 port 48322 logfile /tmp/n10.log
netns n11: pid 5423 port 45404 logfile /tmp/n11.log
running simulator for 120.0 sec
configuring and running zebra and ospfd
done configuring and running zebra and ospfd
simulator done


but showing no results for
vtysh -c 'show ip ospf neighbor' and ifconfig

I am attaching the simulation script with this mail. Will some one please suggest, the logic I am using to create network is right or wrong.
csma-subnet-quagga.py

Alice

unread,
Sep 26, 2011, 8:41:32 AM9/26/11
to ns-3-users
Hi are you still running this on Ubuntu 10.4 that may be your first
problem, the kernel with
that distribution does not fully support network namespaces. See
this
wiki, for instance, about known kernel issues.
http://code.google.com/p/coreemu/wiki/Linux

try to change to Fedora and rerun the example, after i switched
distributions, mine worked perfectly, i am now using Fedora 12

One more thing
do u think it is possible to log routing tables of the individual
routers?

On Sep 26, 1:15 am, ashok kumar <ashokiitg...@gmail.com> wrote:
> Hi
> Finally simulation is working but not showing results.
>
> Out put :
> netns router: pid 5350 port 46801 logfile /tmp/router.log
> netns n0: pid 5357 port 51764 logfile /tmp/n0.log
> netns n1: pid 5363 port 47103 logfile /tmp/n1.log
> netns n2: pid 5369 port 55694 logfile /tmp/n2.log
> netns n3: pid 5375 port 41794 logfile /tmp/n3.log
> netns n4: pid 5381 port 53318 logfile /tmp/n4.log
> netns n5: pid 5387 port 47557 logfile /tmp/n5.log
> netns n6: pid 5393 port 52762 logfile /tmp/n6.log
> netns n7: pid 5399 port 41998 logfile /tmp/n7.log
> netns n8: pid 5405 port 46165 logfile /tmp/n8.log
> netns n9: pid 5411 port 59256 logfile /tmp/n9.log
> netns n10: pid 5417 port 48322 logfile /tmp/n10.log
> netns n11: pid 5423 port 45404 logfile /tmp/n11.log
> running simulator for 120.0 sec
> configuring and running zebra and ospfd
> done configuring and running zebra and ospfd
> simulator done
>
> but showing no results for
>
> vtysh -c 'show ip ospf neighbor' and ifconfig
>
> I am attaching the simulation script with this mail. Will some one please
> suggest, the logic I am using to create network is right or wrong.
>
> >>http://groups.google.com/group/ns-3-users/browse_thread/thread/cedfe0...
>  csma-subnet-quagga.py
> 4KViewDownload

ashok kumar

unread,
Sep 26, 2011, 9:08:13 AM9/26/11
to ns-3-...@googlegroups.com
Hi Alice
I don't think  problem is with the distribution.If I was not getting result for for kernel mismatch then I should not have got result for csma-line-quagga.py. But for csma-line-quagga.py I am getting correct result.

Will you please run the code I attached in previous mail to find out whether it is running in Fedora 12.

Since they have suggested this for measuring routing algorithms performance, it must be possible to log routing tables of each router. Once I have My simulation working, I too need to do that. 

Tom Henderson

unread,
Sep 26, 2011, 9:39:18 AM9/26/11
to ashok kumar, ns-3-users, Hajime Tazaki
> <http://self.name>, self.logfile)

> File "/usr/local/lib/python2.6/dist-packages/netns.py", line
> 219, in
> spawnserver
> (cls.__name__, erroutput.strip()))
> ValueError: NetnsNode.spawnserver() failed:
> creating netns failed: [Errno 22] Invalid argument
>
>
> I followed the discussion
> http://groups.google.com/group/ns-3-users/browse_thread/thread/cedfe00612ab84d5
>
> I am using Ubuntu 10.4 LTS
> My python version is Python 2.6.5
>
> Please help me solving these probelms
>
> Regards
> Ashok
>
>
>
>
> On Sep 24, 8:23 pm, ashok kumar <ashokiitg...@gmail.com


In general, I think your problems lie in this part of the code that you
did not carry forward from csma-line-quagga.py:

< ifnames = ["eth1", "eth0"]
< CsmaExperiment.createnet(self, devhelper, nc,
< addrhelper, mask, ifnames)
< addrhelper.NewNetwork()


The 'createnet' method is creating the interfaces within the container
that are needed for quagga. If you do an ifconfig within your xterms,
you will see that only interface 'lo' is showing. This is probably why
quagga daemons are dying.

The first step to resolve this is to make sure that your containers have
the right interfaces enabled, which either means using the above
'createnet' or creating your own variant if needed.

- Tom

Alice

unread,
Sep 26, 2011, 4:18:29 PM9/26/11
to ns-3-users
i just tried to run it, its saying permission denied

ive been on my computer all day trying to figure out a way to log all
routing tables into a file for analysis
still havent gotten any



On Sep 26, 9:08 am, ashok kumar <ashokiitg...@gmail.com> wrote:
> Hi Alice
> I don't think  problem is with the distribution.If I was not getting result
> for for kernel mismatch then I should not have got result for
> csma-line-quagga.py. But for csma-line-quagga.py I am getting correct
> result.
>
> Will you please run the code I attached in previous mail to find out whether
> it is running in Fedora 12.
>
> Since they have suggested this for measuring routing algorithms performance,
> it must be possible to log routing tables of each router. Once I have My
> simulation working, I too need to do that.
>
> ...
>
> read more »

ashok kumar

unread,
Sep 26, 2011, 11:43:26 PM9/26/11
to ns-3-...@googlegroups.com
cannot you use a redirect operation to store the route output

vtysh -c 'show ip ospf route' > route.log


For more options, visit this group at http://groups.google.com/group/ns-3-users?hl=en.


Alice

unread,
Sep 27, 2011, 7:53:35 AM9/27/11
to ns-3-users
well this isnt a valid command for the vtysh
do you mean i should include this statement in the python script?
> ...
>
> read more »

ashok kumar

unread,
Sep 27, 2011, 7:57:39 AM9/27/11
to ns-3-...@googlegroups.com
This is command to enter in xterm to direct output of vtysh to a file.

> ...
>
> read more »

Alice

unread,
Sep 27, 2011, 8:21:25 AM9/27/11
to ns-3-users
it worked :)
but its looking like i would have to run this individually on all the
routers, is there a way to add this to the python script so that all
routers log their routing tables automatically when i run the
simulation?
thankyou for your help
> ...
>
> read more »
Reply all
Reply to author
Forward
0 new messages