Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Diffrence between tunctl and /etc/conf.d/net
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
betlor5
n00b
n00b


Joined: 12 Jul 2013
Posts: 25

PostPosted: Fri Oct 25, 2013 11:41 pm    Post subject: Diffrence between tunctl and /etc/conf.d/net Reply with quote

Hi,

I wanted to ask about the diffrence of the execution of tunctl and same command over /etc/conf.d/net. Because I noticed some diffrences in the working of my network. For example if I run
Code:

tunctl -u root-t tap0
ifconfig tap0 192.168.100.11

and afterwards associate a qemu maschine with it I am able to ping the tap device, but if I write down
Code:

tuntap_tap1="tap"
config_tap1="192.168.100.11"

in /etc/conf.d/net and symlinke net.tap0 with net.lo and put it in rc-update, I am not able to link my qemu with the tap0 device. This means that if I try to ping my tap0 inside the qemu I do not get any replay. Therefore I wanted to ask what am I missing or what is the diffrence between the two tap0 devices?

Thanks,
betlor5
Back to top
View user's profile Send private message
Logicien
Veteran
Veteran


Joined: 16 Sep 2005
Posts: 1555
Location: Montréal

PostPosted: Sat Oct 26, 2013 2:28 am    Post subject: Reply with quote

According with what you want, you need to write in /etc/conf.d/net
Code:
config_tap0="192.168.100.11"
tunctl_tap0="-u root"
tuntap_tap0="tap"

and symlink net.tap0 to net.lo. Create tap1 in /etc/conf.d/net and symlink net.tap0 to net.lo should not work.

Note that the access to this network virtual device by non root users depend on the permissions of the device file /dev/net/tun. It user and group can be root and non root users will access it if the permissions are 0666. It depend of what Udev do.

For the users is in the users group for example, you can just configure
Code:
tunctl_tap0="-g users"

in /etc/conf.d/net and all of them should access tap0. In my Gentoo installation tunctl is not install and Openrc create tap0 at boot time. It probably use the ip command. Here is a manual example that should work for you
Code:
modprobe tun
ip tuntap add tap0 mode tap group users
ip addr flush dev tap0
ip addr add 192.168.100.11/24 brd 192.168.100.255 dev tap0
ip link set dev tap0 up

To delete tap0
Code:
ip link set dev tap0 down
ip link del tap0

Those network virtual devices are often use with virtual machines. I prefer to not give any IP address to tap0 and put it in a bridge that will have an IP address and than give tap0 as the virtual network device to VirtualBox and Qemu.
_________________
Paul
Back to top
View user's profile Send private message
betlor5
n00b
n00b


Joined: 12 Jul 2013
Posts: 25

PostPosted: Sat Oct 26, 2013 8:27 am    Post subject: Reply with quote

Hi,

I tried adding the option
Code:

tunctl_tap0="-u root"

but I am still getting a diffrent result. I can't ping the tap defice from within the qemu device while I can do it with the tunctl option.

And in my post beforehand I made a misstake. The tap0 should also be tap1.
Back to top
View user's profile Send private message
Hu
Moderator
Moderator


Joined: 06 Mar 2007
Posts: 21630

PostPosted: Sat Oct 26, 2013 3:02 pm    Post subject: Reply with quote

Please post the output of cat -n /etc/conf.d/net, the boot messages showing the net.tap0 script starting, and the qemu command line.
Back to top
View user's profile Send private message
betlor5
n00b
n00b


Joined: 12 Jul 2013
Posts: 25

PostPosted: Sat Oct 26, 2013 5:44 pm    Post subject: Reply with quote

As I have already posted my /etc/conf.d/net looks now like this:

Code:

tuntap_tap1="tap"
tunctl_tap1="-u betlor -g qemu"
config_tap1="192.168.100.11"


For qemu I have tried it with all thinkable combinations, the current one is:

Code:

qemu-system-x86_64 \
        -smp 1\
        -hda Mail.img\
        -enable-kvm\
        -m 2G \
        -vnc :1\
        -net nic\
        -net tap,ifname=tap1,script=no\
        -name "Mail VM" \


But the error should be undependent from qemu. I could have asked the same question with openvpn and tun devices. Regarding the net.tap1 device:

Code:

[    8.104628] IPv6: ADDRCONF(NETDEV_UP): tap1: link is not ready
[   43.531949] IPv6: ADDRCONF(NETDEV_CHANGE): tap1: link becomes ready


For further connection I am using
Code:

ifconfig iptables route

with the same syntax in both cases.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum