0

I have two servers linked together through a virtual link (actually a 4in6 tunnel). One is an OpenVZ VPS server which has an unused IPv4 address configured on a venet interface (cannot be bridged), and I want to transfer this IPv4 to the other server.

In other words, I want to link two interfaces together:

  • all IPv4 traffic coming from the venet0 interface (the spare IPv4) should be forwarded to the ip6tnl1 interface
  • all IPv4 traffic coming back from the ip6tnl1 interface should be forwarded to venet0

Do you know how I can set up this, keeping in mind that venet interfaces cannot be bridged?

Thanks

1 Answer 1

0

I suppose I could do with iptables:

# packets received from venet0 are sent to ip6tnl1
iptables -t mangle -A PREROUTING  -i venet0 -j MARK --set-mark 11
iptables -t mangle -A POSTROUTING --mark 11 -o ip6tnl1

# packets received from ip6tnl1 are sent to venet0
iptables -t mangle -A PREROUTING  -i ip6tnl1 -j MARK --set-mark 12
iptables -t mangle -A POSTROUTING --mark 12 -o venet0

Some nice inspiration in: iptables - Target to route packet to specific interface?

The only problem with these iptables rules is that when the packet coming from venet0 comes out of the PREROUTING chain, it will be sent to userspace instead of forwarding it and being processedby POSTROUTING

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .