View previous topic :: View next topic |
Author |
Message |
betlor5 n00b
Joined: 12 Jul 2013 Posts: 25
|
Posted: Fri Oct 25, 2013 11:41 pm Post subject: Diffrence between tunctl and /etc/conf.d/net |
|
|
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 |
|
|
Logicien Veteran
Joined: 16 Sep 2005 Posts: 1555 Location: Montréal
|
Posted: Sat Oct 26, 2013 2:28 am Post subject: |
|
|
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 |
|
|
betlor5 n00b
Joined: 12 Jul 2013 Posts: 25
|
Posted: Sat Oct 26, 2013 8:27 am Post subject: |
|
|
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 |
|
|
Hu Moderator
Joined: 06 Mar 2007 Posts: 21630
|
Posted: Sat Oct 26, 2013 3:02 pm Post subject: |
|
|
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 |
|
|
betlor5 n00b
Joined: 12 Jul 2013 Posts: 25
|
Posted: Sat Oct 26, 2013 5:44 pm Post subject: |
|
|
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 |
|
|
|