linux – KVM / Libvirt桥接/路由网络不适用于较新的来宾内核

前端之家收集整理的这篇文章主要介绍了linux – KVM / Libvirt桥接/路由网络不适用于较新的来宾内核前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我有一个运行Debian 6的专用服务器,包含Libvirt(0.9.11.3)和Qemu-KVM(qemu-kvm-1.0 dfsg-11,Debian).
我在使用较新的内核(> 2.6.38)在KVM来宾中使用桥接/路由网络时遇到问题. NATted网络工作正常.
较旧的内核也可以很好地工作.
主机内核的版本是3.2.0-2-amd64,问题也出现在较旧的主机内核上.
主机的/ etc / network / interfaces的内容(删除了ip):
# Loopback device:
auto lo
iface lo inet loopback

# bridge
auto br0
iface br0 inet static
  address   176.9.xx.xx
  broadcast 176.9.xx.xx
  netmask   255.255.255.224
  gateway   176.9.xx.xx
  pointopoint   176.9.xx.xx
  bridge_ports eth0
  bridge_stp off
  bridge_maxwait 0
  bridge_fd 0
  up route add -host 176.9.xx.xx dev br0 # VM IP
  post-up mii-tool -F 100baseTx-FD br0

# default route to access subnet
up route add -net 176.9.xx.xx netmask 255.255.255.224 gw 176.9.xx.xx br0

主机上ifconfig -a的输出

br0       Link encap:Ethernet  HWaddr 54:04:a6:8a:66:13  
          inet addr:176.9.xx.xx  Bcast:176.9.xx.xx  Mask:255.255.255.224
          inet6 addr: fe80::5604:a6ff:fe8a:6613/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:20216729 errors:0 dropped:0 overruns:0 frame:0
          TX packets:19962220 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:14144528601 (13.1 GiB)  TX bytes:7990702656 (7.4 GiB)

eth0      Link encap:Ethernet  HWaddr 54:04:a6:8a:66:13  
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:26991788 errors:0 dropped:12066 overruns:0 frame:0
          TX packets:19737261 errors:270082 dropped:0 overruns:0 carrier:270082
          collisions:1686317 txqueuelen:1000 
          RX bytes:15459970915 (14.3 GiB)  TX bytes:6661808415 (6.2 GiB)
          Interrupt:17 Memory:fe500000-fe520000 

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:6240133 errors:0 dropped:0 overruns:0 frame:0
          TX packets:6240133 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:6081956230 (5.6 GiB)  TX bytes:6081956230 (5.6 GiB)

virbr0    Link encap:Ethernet  HWaddr 52:54:00:79:e4:5a                                                                                                                                                                                                                        
          inet addr:192.168.100.1  Bcast:192.168.100.255  Mask:255.255.255.0                                                                                                                                                                                                   
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1                                                                                                                                                                                                                   
          RX packets:225016 errors:0 dropped:0 overruns:0 frame:0                                                                                                                                                                                                              
          TX packets:412958 errors:0 dropped:0 overruns:0 carrier:0                                                                                                                                                                                                            
          collisions:0 txqueuelen:0                                                                                                                                                                                                                                            
          RX bytes:16284276 (15.5 MiB)  TX bytes:687827984 (655.9 MiB)                                                                                                                                                                                                         

virbr0-nic Link encap:Ethernet  HWaddr 52:54:00:79:e4:5a                                                                                                                                                                                                                       
          BROADCAST MULTICAST  MTU:1500  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:500                                                                                                                                                                                                                                          
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)                                                                                                                                                                                                                               

vnet0     Link encap:Ethernet  HWaddr fe:54:00:93:4e:68                                                                                                                                                                                                                        
          inet6 addr: fe80::fc54:ff:fe93:4e68/64 Scope:Link                                                                                                                                                                                                                    
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1                                                                                                                                                                                                                   
          RX packets:607670 errors:0 dropped:0 overruns:0 frame:0                                                                                                                                                                                                              
          TX packets:5932089 errors:0 dropped:0 overruns:0 carrier:0                                                                                                                                                                                                           
          collisions:0 txqueuelen:500                                                                                                                                                                                                                                          
          RX bytes:83574773 (79.7 MiB)  TX bytes:1092482370 (1.0 GiB)                                                                                                                                                                                                          

vnet1     Link encap:Ethernet  HWaddr fe:54:00:ed:6a:43                                                                                                                                                                                                                        
          inet6 addr: fe80::fc54:ff:Feed:6a43/64 Scope:Link                                                                                                                                                                                                                    
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1                                                                                                                                                                                                                   
          RX packets:922132 errors:0 dropped:0 overruns:0 frame:0                                                                                                                                                                                                              
          TX packets:6342375 errors:0 dropped:0 overruns:0 carrier:0                                                                                                                                                                                                           
          collisions:0 txqueuelen:500 
          RX bytes:251091242 (239.4 MiB)  TX bytes:1629079567 (1.5 GiB)

vnet2     Link encap:Ethernet  HWaddr fe:54:00:0d:cb:3d  
          inet6 addr: fe80::fc54:ff:fe0d:cb3d/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:9461 errors:0 dropped:0 overruns:0 frame:0
          TX packets:665189 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:500 
          RX bytes:4990275 (4.7 MiB)  TX bytes:49229647 (46.9 MiB)

vnet3     Link encap:Ethernet  HWaddr fe:54:cd:83:eb:aa  
          inet6 addr: fe80::fc54:cdff:fe83:ebaa/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:1649 errors:0 dropped:0 overruns:0 frame:0
          TX packets:12177 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:500 
          RX bytes:77233 (75.4 KiB)  TX bytes:2127934 (2.0 MiB)

guest虚拟机的/ etc / network / interfaces,在这种情况下运行Ubuntu 12.04(删除了ip):

# This file describes the network interfaces available on your system
# and how to activate them. For more information,see interfaces(5).

# The loopback network interface
auto lo
iface lo inet loopback

auto eth0
iface eth0 inet static
        address 176.9.xx.xx
        netmask 255.255.255.248
        gateway 176.9.xx.xx                # Host IP
        pointopoint 176.9.xx.xx            # Host IP
        dns-nameservers 8.8.8.8 8.8.4.4

guest虚拟机上ifconfig -a的输出

eth0      Link encap:Ethernet  HWaddr 52:54:cd:83:eb:aa  
          inet addr:176.9.xx.xx  Bcast:0.0.0.0  Mask:255.255.255.255
          inet6 addr: fe80::5054:cdff:fe83:ebaa/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:14190 errors:0 dropped:0 overruns:0 frame:0
          TX packets:1768 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:2614642 (2.6 MB)  TX bytes:82700 (82.7 KB)

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:954 errors:0 dropped:0 overruns:0 frame:0
          TX packets:954 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:176679 (176.6 KB)  TX bytes:176679 (176.6 KB)

在guest上输出ping -c4:

PING google.nl (173.194.35.151) 56(84) bytes of data.
64 bytes from muc03s01-in-f23.1e100.net (173.194.35.151): icmp_req=1 ttl=55 time=14.7 ms
From static.174.82.xx.xx.clients.your-server.de (176.9.xx.xx): icmp_seq=2 Redirect Host(New nexthop: static.161.82.9.176.clients.your-server.de (176.9.82.161))
64 bytes from muc03s01-in-f23.1e100.net (173.194.35.151): icmp_req=2 ttl=55 time=15.1 ms
From static.198.170.9.176.clients.your-server.de (176.9.170.198) icmp_seq=3 Destination Host Unreachable
From static.198.170.9.176.clients.your-server.de (176.9.170.198) icmp_seq=4 Destination Host Unreachable

--- google.nl ping statistics ---
4 packets transmitted,2 received,+2 errors,50% packet loss,time 3002ms
rtt min/avg/max/mdev = 14.797/14.983/15.170/0.223 ms,pipe 2

static.174.82.xx.xx.clients.your-server.de(176.9.xx.xx)是主机的IP.
我遇到过这个问题,我试过的每个客户操作系统都是Fedora,Ubuntu(服务器/桌面)和Debian,升级内核.我也试过自己编译来宾内核,但没有用.
我重新编译内核没有问题,尽管主机无法承受任何停机时间.
关于这个问题的任何想法都非常受欢迎.

编辑:我可以从访客内部ping主机.

解决方法

好的,我自己找到了解决方案.显然,the Hetzner wiki上的文章并不完整.重定向仍然被发送,导致Hetzner(我们有我们的服务器)阻止流量.我不确定它与客户运行的内核版本有什么关系,如果有人可以解释我非常想听到它.

您可以通过执行以下命令找出是否遇到同样的问题:

for file in `find /proc/ -iname send_redirects`; do echo $file; cat $file; done

输出如下:

/proc/sys/net/ipv4/conf/all/send_redirects
0
/proc/sys/net/ipv4/conf/default/send_redirects
1
/proc/sys/net/ipv4/conf/lo/send_redirects
1
/proc/sys/net/ipv4/conf/eth0/send_redirects
0
/proc/sys/net/ipv4/conf/br0/send_redirects
1
/proc/sys/net/ipv4/conf/vnet1/send_redirects
1
/proc/sys/net/ipv4/conf/vnet0/send_redirects
1
/proc/sys/net/ipv4/conf/virbr0/send_redirects
1
/proc/sys/net/ipv4/conf/virbr0-nic/send_redirects
1
/proc/sys/net/ipv4/conf/vnet2/send_redirects
1
/proc/sys/net/ipv4/conf/vnet3/send_redirects
1

我不得不承认我不知道哪些应该或不应该是0,但我已将它们全部设置为0,现在它工作正常,所以我会留下它.

for file in `find /proc/ -iname send_redirects`; do echo 0 > $file; done

猜你在找的Linux相关文章