iptables question

I have a linux gateway. I would like to route everything to one firewall except mail which I'll like to route to another firewall. How do you redirect by destination port in iptables?

The man page mentioned a concept of 'redirect' but it doesn't sound useful.

EDIT What I was looking for:

iptables -t mangle -A PREROUTING -p tcp –dport 25 -j MARK --set-mark 1

ip rule add fwmark 1 table 10

ip route add table 10 dev That seems quite useful if you have two or more lines with different SLA's and you want to route accordingly.

1 Reply

isn't this sort of thing normally done in the nat table as opposed to mangle?


Please enter an answer

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct