How to use vknetd

Aleksej Lebedev root at zta.lk
Tue Sep 6 08:59:30 PDT 2016


Hi, again.

I have used vkernel for quite a while. And it worked perfectly.
Now want to run it from a non-root user, so I would like to access the 
network through vknetd,
but cannot get it working.

I created a user vhost, added it to the group vknet.
Vkned is started as follows:

$ ps ax | grep vknetd
/usr/sbin/vknetd -U -t tap0 -b bridge0

I can see that the interface tap0 (among others) is added to bridge0:

$ ifconfig bridge0
bridge0: flags=8043<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
         inet 88.198.33.138 netmask 0xffffffe0 broadcast 88.198.33.159
         inet6 fe80::e4ba:61ff:fed8:cd1b%bridge0 prefixlen 64 scopeid 0x6
         inet6 2a01:4f8:a0:300a::2 prefixlen 64
         ether e6:ba:61:d8:cd:1b
         priority 32768 hellotime 2 fwddelay 15 maxage 20
         member: tap5 flags=3<LEARNING,DISCOVER>
         member: tap4 flags=3<LEARNING,DISCOVER>
         member: tap0 flags=3<LEARNING,DISCOVER>
         member: re0 flags=3<LEARNING,DISCOVER>

Then I run my vkernel:

sudo -u vhost /var/vkernel/4.4/boot/kernel/kernel -m 2g -r 
/vhost/001/root.img -I /var/run/vknet -d -p /vhost/001/pid -i 
/vhost/001/mem.img -e vfs.root.mountfrom='"hammer:vkd0s0a"'

 From inside virtual machine, the interface vke0 is configured like 
follows:

vhost000# ifconfig vke0
vke0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500
         inet6 2a01:4f8:a0:300a::5 prefixlen 64
         inet6 fe80::201:a6ff:fe81:1644%vke0 prefixlen 64 scopeid 0x1
         ether 00:01:a6:81:16:44
         media: Ethernet autoselect (1000baseT <full-duplex>)
         status: active

Everything looks fine, but when I try to ping the gateway, it doesn't 
respond:

vhost000# ping6 fe80::1%vke0
PING6(56=40+8+8 bytes) fe80::201:a6ff:fe81:1644%vke0 --> fe80::1%vke0
^C
--- fe80::1%vke0 ping6 statistics ---
2 packets transmitted, 0 packets received, 100.0% packet loss

Everything works perfectly when the same virtual machine is started with 
-I auto:bridge0

Am I missing something?

Thanks in advance.

-- 
Aleksej Lebedev



More information about the Users mailing list