我正尝试从vmbr1本地networkingconfiguration路由到公共接口vmbr0 。 我的电脑在vmbr1接口上有IP 192.168.0.1 。 我configuration了以下邮政路由规则: iptables -t nat -A POSTROUTING -o vmbr0 -j MASQUERADE
作为testing,我从另一台configuration为默认网关192.168.0.1计算机上ping Google DNS服务器8.8.4.4 。
使用iptables -t nat -L -v ,我可以看到一些数据包正在打到filter,但是通过增加的速度,很明显正确的数据包没有。
Chain POSTROUTING (policy ACCEPT 5 packets, 300 bytes) pkts bytes target prot opt in out source destination 24 8358 MASQUERADE all -- any vmbr0 anywhere anywhere
从tcpdump -i vmbr0 ,我可以看到数据包正在离开未经编辑的接口。
18:41:35.162157 IP 192.168.0.101 > google-public-dns-b.google.com: ICMP echo request, id 1872, seq 996, length 64 18:41:36.170172 IP 192.168.0.101 > google-public-dns-b.google.com: ICMP echo request, id 1872, seq 997, length 64 18:41:37.178164 IP 192.168.0.101 > google-public-dns-b.google.com: ICMP echo request, id 1872, seq 998, length 64
这是我的networkingconfiguration:
iface eth0 inet manual auto vmbr1 iface vmbr1 inet static address 192.168.0.1 netmask 255.255.255.0 bridge_ports dummy0 bridge_stp off bridge_fd 0 #NAT auto vmbr0 iface vmbr0 inet static address 151.80.1.13 netmask 255.255.255.0 gateway 151.80.1.254 broadcast 151.80.1.255 bridge_ports eth0 bridge_stp off bridge_fd 0 network 151.80.1.0
和路线:
Destination Gateway Genmask Flags Metric Ref Use Iface default 151.80.1.254 0.0.0.0 UG 0 0 0 vmbr0 151.80.1.0 * 255.255.255.0 U 0 0 0 vmbr0 192.168.0.0 * 255.255.255.0 U 0 0 0 vmbr1
我也尝试过iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE但是也没有工作。
编辑:事实certificate设置bridge_ports dummy0是问题。 有人可以解释为什么吗?