我很难在两个虚拟接口之间进行路由。这是装置。
我所要做的就是在192.168.20.0/24和192.168.10.0/24之间安排交通路线。
为此目的:
在物理机器上,我向各自的网络添加路由(尽管它们是自动添加的)。
从虚拟机1,我可以ping 192.168.10.1和192.168.20.1,但不是192.168.20.2。来自第二个虚拟机的同样的东西-- thing 192.168.10.1和20.1,但不是20.2)
ip转发被激活:root@expire:~/..ovpn# sysctl -a _ grep转发
net.ipv4.conf.all.forwarding = 1
net.ipv4.conf.all.mc_forwarding = 0
net.ipv4.conf.default.forwarding = 1
net.ipv4.conf.default.mc_forwarding = 0
net.ipv4.conf.docker0.forwarding = 1
net.ipv4.conf.docker0.mc_forwarding = 0
net.ipv4.conf.eth0.forwarding = 1
net.ipv4.conf.eth0.mc_forwarding = 0
net.ipv4.conf.lo.forwarding = 1
net.ipv4.conf.lo.mc_forwarding = 0
net.ipv4.conf.tun0.forwarding = 1
net.ipv4.conf.tun0.mc_forwarding = 0
net.ipv4.conf.wlan0.forwarding = 1
net.ipv4.conf.wlan0.mc_forwarding = 0
net.ipv4.ip_forward = 1
有没有人对如何继续工作有一些提示。
谢谢。
PS。我不想用iptable
编辑: eth0:1和eth0:2是别名接口,而不是虚拟接口。谢谢Tero Kilkanen
发布于 2016-08-24 07:16:35
我不认为有人能让这一切像这样运作。eth0:N
实际上不是虚拟接口,它是单个接口的IP别名。
虚拟机管理程序在启动虚拟机时创建虚拟接口。例如,在我的服务器中,Xen在启动虚拟机时创建一个虚拟接口vif2.0
。
使用您的配置,您在同一个物理接口上有多个IP网络的地址,这是不工作的。
因此,您需要配置您的网络,以便您拥有的每个VM在主机端都有自己的接口。您可能希望将接口类型路由。然后,主机和来宾VM都会在IPv4子网中获得IP地址。
在此之后,您可以在虚拟机上配置正常路由。
https://serverfault.com/questions/798810
复制