
network 192.168.100.0/24 vlan 100network 192.168.200.0/24 vlan 200
一个ubuntu服务器(1个以太2个vlan)
eth0.100(ip:192.168.100.10/24)
eth0.200(ip:192.168.200.20/24 def gw 192.168.200.254)
情况如下:
> eth0.200已上架
> eth0.100我们失望了.
>子网192.168.100.0/24的连接可以到192.168.200.20.
当我创建eth0.100时:
>无法从192.168.100.0/24网络访问192.168.200.20. (错误的接口响应.当包从192.168.100.0/24到达192.168.200.20时,它被192.168.100.10回复)
怎么解决这个问题?
尝试使用rp_filter = 0 / rp_filter = 1
#cat /etc/network/interfacesiface eth0.200 inet static address 192.168.200.20 netmask 255.255.255.0 vlan-raw-device eth0 gateway 192.168.200.254 post-up ip r a 192.168.200.6 via 192.168.200.250 #one ip behind wifiiface eth0.100 inet static address 192.168.100.10 netmask 255.255.255.0 vlan-raw-device eth0
希望合作:
iptables -A PREROUTING -t mangle -i eth0.100 -j MARK --set-mark 100iptables -A PREROUTING -t mangle -i eth0.200 -j MARK --set-mark 200making some route tables like t100 and t200and then ading rule like:ip rule add from all fwmark 100 table t100ip rule add from all fwmark 200 table t200
它是RP_FILTER
net.ipv4.conf.default.rp_filter = 0net.ipv4.conf.eth0/100.rp_filter = 0net.ipv4.conf.eth0/200.rp_filter = 0解决方法 添加我的评论作为答案,以便可以标记.
这样的问题是由net.ipv4.conf.*.rp_filter引起的.
启用rp_filter后,内核将拒绝流量源地址与该服务器上其他接口的子网匹配的接口上的流量.
如果在net.ipv4.conf.all.rp_filter上启用了该设置,则很多时候会出现问题,但在net.ipv4.conf.eth0.rp_filter等特定接口上却没有.rp_filter的默认设置为0,但是许多发行版都会覆盖此设置.因为它是在发布时由发行版手动设置的,所以在net.ipv4.conf.all.rp_filter下设置它不再有效,它必须在特定接口上设置(例如net.ipv4.conf.eth0.rp_filter).
总结以上是内存溢出为你收集整理的linux vlan路由全部内容,希望文章能够帮你解决linux vlan路由所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)