0

I have a server with two interfaces: eth0 and dummy0, both have different public IP.

How to route all traffic from specific program (daemon) through dummy0, using iptables?

I want the daemon to establish an internet connection via a different public IP, that i have on the dummy0 interface.

I need the demon traffic to be routed only through the second public IP address of my server.

I've tried many examples, but with no success...

2

I want the daemon to establish an internet connection via a different public IP, that i have on the dummy0 interface.

That's not how it works with dummy interfaces.

Best solution: Make a networking namespace, run your demon (and every other program that should use the second IP) in the networking namespace, have macvlan in the networking namespace with your second IP with eth0 as master.

Another possible solution: Add second IP to eth0, make sure every single program you run supports binding to IP addresses, and picks either the first IP or the second IP. Otherwise they may end up picking a random IP. That's a considerable headache, so I recommend the first solution.

I've tried many examples, but with no success...

I am not surprised.

1
  • 1
    Googling "macvlan network namespace tutorial" gives quite a few hits. Try those out, if you get stuck, ask a new question. I've also posted a script to create a network namespace (with veth-pair, but you can modify this) either here or on superuser, use the search function. – dirkt Jan 29 at 10:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.