Leftfild (leftfild) wrote in ru_gentoo,
Leftfild
leftfild
ru_gentoo

Gentoo 3.0.6: Проблема с tun/tap и qemu

Всем привет!

У меня тут возникла проблема с пробросом виртуальной машины в сеть. При запуске qemu вываливается следующее сообщение:

# qemu-system-sparc -bios /opt/ss20_v2.25_rom -M SS-20 -nographic -boot c -hda /opt/disk.img -m 512 telnet:0.0.0.0:3000,server -net nic,vlan=0,macaddr=00:00:00:00:00:01,model=lance -net tap,vlan=0,ifname=tap0,script=0
0: could not launch network script
qemu-system-sparc: -net tap,vlan=0,ifname=tap0,script=0: Device 'tap' could not be initialized

Пускаю из под рута, чтобы исключить проблему с правами доступа.

В чем проблема? Я уже битый час бьюсь и не могу найти источник данной проблемы.

PS: Гуглил... не помогает...



Ядро

# uname -a
Linux XXXXXX 3.0.6-gentoo #6 SMP Tue May 1 01:53:10 CEST 2012 i686 AMD E-350 Processor AuthenticAMD GNU/Linux

В ядре включена поддержка:

GRE, TUN, IEEE 802.1q, IEEE 802.1d

Вывод dmesg

# dmesg | grep tun
[ 1.180785] tun: Universal TUN/TAP device driver, 1.6
[ 1.180867] tun: (C) 1999-2004 Max Krasnyansky
[ 1.450374] IPv4 over IPv4 tunneling driver
[ 1.451171] GRE over IPv4 tunneling driver
[ 1.455321] IPv6 over IPv4 tunneling driver

Вывод ifconfig -a

# ifconfig -a
br0 Link encap:Ethernet HWaddr 2a:ed:a3:cd:79:21
inet addr:XX.XX.XX.X Bcast:XX.XX.XX.255 Mask:255.255.255.0
inet6 addr: fe80::28ed:a3ff:fecd:7921/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:4427 errors:0 dropped:0 overruns:0 frame:0
TX packets:4595 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:789311 (770.8 KiB) TX bytes:997813 (974.4 KiB)

eth0 Link encap:Ethernet HWaddr d0:27:88:6c:3a:a6
inet6 addr: fe80::d227:88ff:fe6c:3aa6/64 Scope:Link
UP BROADCAST RUNNING PROMISC MULTICAST MTU:1500 Metric:1
RX packets:4427 errors:0 dropped:0 overruns:0 frame:0
TX packets:4633 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:851289 (831.3 KiB) TX bytes:999793 (976.3 KiB)
Interrupt:40 Base address:0xe000

gre0 Link encap:UNSPEC HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
NOARP MTU:1476 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)

lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:12283 errors:0 dropped:0 overruns:0 frame:0
TX packets:12283 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:3295009 (3.1 MiB) TX bytes:3295009 (3.1 MiB)

sit0 Link encap:IPv6-in-IPv4
NOARP MTU:1480 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)

tap0 Link encap:Ethernet HWaddr 2a:ed:a3:cd:79:21
inet6 addr: fe80::28ed:a3ff:fecd:7921/64 Scope:Link
UP BROADCAST PROMISC MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:2 overruns:0 carrier:0
collisions:0 txqueuelen:500
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)

tunl0 Link encap:IPIP Tunnel HWaddr
NOARP MTU:1480 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)


Вывод brctl

# brctl show
bridge name bridge id STP enabled interfaces
br0 8000.2aeda3cd7921 no eth0
tap0

Параметры ядра

# sysctl -a | grep net.*.tap0
error: "Invalid argument" reading key "fs.binfmt_misc.register"
error: permission denied on key 'net.ipv4.route.flush'
net.ipv4.neigh.tap0.mcast_solicit = 3
net.ipv4.neigh.tap0.ucast_solicit = 3
net.ipv4.neigh.tap0.app_solicit = 0
net.ipv4.neigh.tap0.retrans_time = 99
net.ipv4.neigh.tap0.base_reachable_time = 30
net.ipv4.neigh.tap0.delay_first_probe_time = 5
net.ipv4.neigh.tap0.gc_stale_time = 60
net.ipv4.neigh.tap0.unres_qlen = 3
net.ipv4.neigh.tap0.proxy_qlen = 64
net.ipv4.neigh.tap0.anycast_delay = 99
net.ipv4.neigh.tap0.proxy_delay = 79
net.ipv4.neigh.tap0.locktime = 99
net.ipv4.neigh.tap0.retrans_time_ms = 1000
net.ipv4.neigh.tap0.base_reachable_time_ms = 30000
net.ipv4.conf.tap0.forwarding = 0
net.ipv4.conf.tap0.mc_forwarding = 0
net.ipv4.conf.tap0.accept_redirects = 1
net.ipv4.conf.tap0.secure_redirects = 1
net.ipv4.conf.tap0.shared_media = 1
net.ipv4.conf.tap0.rp_filter = 1
net.ipv4.conf.tap0.send_redirects = 1
net.ipv4.conf.tap0.accept_source_route = 1
net.ipv4.conf.tap0.accept_local = 0
net.ipv4.conf.tap0.src_valid_mark = 0
net.ipv4.conf.tap0.proxy_arp = 0
net.ipv4.conf.tap0.medium_id = 0
net.ipv4.conf.tap0.bootp_relay = 0
net.ipv4.conf.tap0.log_martians = 0
net.ipv4.conf.tap0.tag = 0
net.ipv4.conf.tap0.arp_filter = 0
net.ipv4.conf.tap0.arp_announce = 0
net.ipv4.conf.tap0.arp_ignore = 0
net.ipv4.conf.tap0.arp_accept = 0
net.ipv4.conf.tap0.arp_notify = 0
net.ipv4.conf.tap0.proxy_arp_pvlan = 0
net.ipv4.conf.tap0.disable_xfrm = 0
net.ipv4.conf.tap0.disable_policy = 0
net.ipv4.conf.tap0.force_igmp_version = 0
net.ipv4.conf.tap0.promote_secondaries = 0
net.ipv6.neigh.tap0.mcast_solicit = 3
net.ipv6.neigh.tap0.ucast_solicit = 3
net.ipv6.neigh.tap0.app_solicit = 0
net.ipv6.neigh.tap0.retrans_time = 1000
net.ipv6.neigh.tap0.base_reachable_time = 30
net.ipv6.neigh.tap0.delay_first_probe_time = 5
net.ipv6.neigh.tap0.gc_stale_time = 60
net.ipv6.neigh.tap0.unres_qlen = 3
net.ipv6.neigh.tap0.proxy_qlen = 64
net.ipv6.neigh.tap0.anycast_delay = 99
net.ipv6.neigh.tap0.proxy_delay = 79
net.ipv6.neigh.tap0.locktime = 0
net.ipv6.neigh.tap0.retrans_time_ms = 1000
net.ipv6.neigh.tap0.base_reachable_time_ms = 30000
error: permission denied on key 'net.ipv6.route.flush'
net.ipv6.conf.tap0.forwarding = 0
net.ipv6.conf.tap0.hop_limit = 64
net.ipv6.conf.tap0.mtu = 1500
net.ipv6.conf.tap0.accept_ra = 1
net.ipv6.conf.tap0.accept_redirects = 1
net.ipv6.conf.tap0.autoconf = 1
net.ipv6.conf.tap0.dad_transmits = 1
net.ipv6.conf.tap0.router_solicitations = 3
net.ipv6.conf.tap0.router_solicitation_interval = 4
net.ipv6.conf.tap0.router_solicitation_delay = 1
net.ipv6.conf.tap0.force_mld_version = 0
net.ipv6.conf.tap0.max_addresses = 16
net.ipv6.conf.tap0.accept_ra_defrtr = 1
net.ipv6.conf.tap0.accept_ra_pinfo = 1
net.ipv6.conf.tap0.proxy_ndp = 0
net.ipv6.conf.tap0.accept_source_route = 0
net.ipv6.conf.tap0.disable_ipv6 = 0
net.ipv6.conf.tap0.accept_dad = 1
net.ipv6.conf.tap0.force_tllao = 0

Конфиг /etc/conf.d/net

bridge_br0="eth0 tap0"
brctl_br0="setfd 0 sthello 0 stp off"
rc_net_br0_need="net.tap0"
config_br0="XX.XX.XX.X netmask 255.255.255.0 brd XXX.XX.XX.255"
routes_br0="default via XX.XX.XX.1"
config_tap0="null"
tuntap_tap0="tap"
config_eth0="null"

Загрузка rc-update show

rc-update show
apache2 | default
bootmisc | boot
bridge_forward | default
devfs | sysinit
dhcpd | default
dmesg | sysinit
fsck | boot
hostname | boot
hwclock | boot
keymaps | boot
killprocs | shutdown
local | default
localmount | boot
modules | boot
mount-ro | shutdown
mtab | boot
mysql | default
named | default
net.br0 | default
net.lo | boot
net.tap0 | default
netmount | default
nginx | default
procfs | boot
radiusd | default
root | boot
savecache | shutdown
sshd | default
swap | boot
sysctl | boot
syslog-ng | default
termencoding | boot
udev | sysinit
udev-postmount | default
urandom | boot
vixie-cron | default

Скрипт bridge_forward

ls -la /etc/init.d/bridge_forward
-rwxr-xr-x 1 root root 577 May 1 02:15 /etc/init.d/bridge_forward
# more /etc/init.d/bridge_forward
#!/sbin/runscript
# Copyright 1999-2012 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $

depend() {
need net.br0
}

start() {
ebegin "Turning on forwarding for bridge interface"
/sbin/sysctl net.ipv4.conf.br0.forwarding=1 >/dev/null 2>&1
eend $?
}

stop() {
ebegin "Turning off forwarding for bridge interface"
/sbin/sysctl net.ipv4.conf.br0.forwarding=0 >/dev/null 2>&1
eend $?
}

restart() {
ebegin "Turning off forwarding for bridge interface"
/sbin/sysctl net.ipv4.conf.br0.forwarding=0 >/dev/null 2>&1
eend $?
}

Права доступа на /dev/net/tun

# ls -la /dev/net/
total 0
drwxr-xr-x 2 root root 60 May 1 02:21 .
drwxr-xr-x 14 root root 3620 May 1 02:21 ..
crw-rw-rw- 1 root root 10, 200 May 1 02:21 tun

Инициализация интерфейсов

# ls -la /etc/init.d/net.*
lrwxrwxrwx 1 root root 6 Apr 30 22:15 /etc/init.d/net.br0 -> net.lo
lrwxrwxrwx 1 root root 6 Nov 13 16:26 /etc/init.d/net.eth0 -> net.lo
-rwxr-xr-x 1 root root 15459 Nov 9 00:45 /etc/init.d/net.lo
lrwxrwxrwx 1 root root 6 Apr 30 22:16 /etc/init.d/net.tap0 -> net.lo

Версия qemu

# qemu-system-sparc --version
QEMU emulator version 1.0,1, Copyright (c) 2003-2008 Fabrice Bellard





Где проблема?

Спасибо!
  • Post a new comment

    Error

    default userpic

    Your IP address will be recorded 

  • 1 comment