我试图为eth0上的linux (它在Azure中)创建一个管理vrf,同时使用eth1和eth2作为数据包转发接口。到目前为止,我使用的是积云指南,我使用的是这个配置:
sudo ip link add mgmt-vrf type vrf table 10
ip link set dev mgmt-vrf up
ip route add table 10 unreachable default metric 4278198272
sudo ip link set dev eth0 master mgmt-vrf
sudo ip route add table 10 0.0.0.0/0 dev eth0 via 10.40.255.1我认为这是可行的,而且我得到了合理的产出:
ip -br link show vrf mgmt-vrf
eth0 UP 00:22:48:00:d4:8b <BROADCAST,MULTICAST,UP,LOWER_UP>
ip vrf show
Name Table
-----------------------
mgmt-vrf 10当我运行tcpdump时,很明显SSH没有响应:
sudo tcpdump -i eth0 !(port 80 or 53) -nn
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on eth0, link-type EN10MB (Ethernet), capture size 262144 bytes
11:17:56.843175 IP 10.26.0.112.55756 > 10.40.255.4.22: Flags [S], seq 782432837, win 64960, options [nop,wscale 8,nop,nop,sackOK], length 0
11:17:58.011786 ARP, Request who-has 10.40.255.1 tell 10.40.255.4, length 28
11:17:58.012169 ARP, Reply 10.40.255.1 is-at 12:34:56:78:9a:bc, length 28
11:17:59.956102 IP 10.26.0.112.55756 > 10.40.255.4.22: Flags [S], seq 782432837, win 64960, options [nop,wscale 8,nop,nop,sackOK], length 0
11:18:05.845234 IP 10.26.0.112.55756 > 10.40.255.4.22: Flags [S], seq 782432837, win 64960, options [nop,wscale 8,nop,nop,sackOK], length 0据我所知,VRF不是一个网络名称空间,所以我不能在名称空间下运行SSH。此外,我还运行了以下操作:
sudo sysctl -w net.ipv4.tcp_l3mdev_accept=1
sudo sysctl -w net.ipv4.udp_l3mdev_accept=1但仍然没有喜悦。谢谢你的帮助
ip -4 r ls table 10
unreachable default
10.26.0.0/21 via 10.40.255.1 dev eth0
broadcast 10.40.255.0 dev eth0 proto kernel scope link src 10.40.255.4
10.40.255.0/24 dev eth0 proto kernel scope link src 10.40.255.4
local 10.40.255.4 dev eth0 proto kernel scope host src 10.40.255.4
broadcast 10.40.255.255 dev eth0 proto kernel scope link src 10.40.255.4
ip route get 10.40.255.4 from 10.26.0.112 iif eth0
local 10.40.255.4 from 10.26.0.112 dev mgmt-vrf table 10
cache <local> iif eth0
ip route get 10.26.0.112 from 10.40.255.4
10.26.0.112 from 10.40.255.4 via 10.40.0.1 dev eth1 uid 1000
cache
ip route get 10.26.0.1 from 10.40.255.4 vrf mgmt-vrf
10.26.0.1 from 10.40.255.4 via 10.40.255.1 dev eth0 table 10 uid 1000
cache此外,tcpdump不再解析主机IP地址,而且我无法平移本地接口,就好像这些服务在此VRF中不再可用,sysctl mdev命令也没有任何效果。希望这能有所帮助
发布于 2019-06-07 08:43:45
谢谢你的帮助,我设法解决了这个问题
我已经将IPtables配置为接受eth0 mgmt接口上的输入,如下所示:
sudo iptables -L -v
136M ACCEPT all -- eth0 any anywhere anywhere这确实引用了从设备,但是在这里:https://www.kernel.org/doc/Documentation/networking/vrf.txt
我发现您还需要引用主设备,所以添加了规则
sudo iptables -A INPUT -i mgmt-vrf -j ACCEPT这个解决了我的问题
谢谢你的帮助--帮助我朝着正确的方向前进
https://serverfault.com/questions/970363
复制相似问题