Hi all. Linux noob here.
I was hoping someone could help me with configuring some routing rules on my router, an Asus AC68.
The router is connected to two gateways, wan0_gateway and wan1_gateway.
I have rules set up in the router gui that will push all traffic from every IP other than my own to wan1_gateway.
This works well so far. What I would also like to do is push specific port ranges from my machine (192.168.1.2) onto the wan1_gateway also. For instance HTTP so that downloads will not affect performance of the wan0_gateway.
This is the script I was messing with so far.. I might be way off base here so any assistance is appreciated!
#!/bin/sh
ip route flush table 100
ip route del default table 100
ip rule del fwmark 1 table 100
ip route flush cache
iptables -t mangle -F PREROUTING
ip rule add fwmark 1 table 100 via $(nvram get wan1_gateway)
ip route flush cache
iptables -t mangle -A PREROUTING -m state --state NEW -p tcp --dport 80 -d 192.168.1.2 -j CONNMARK --set-mark 1
iptables -t mangle -A PREROUTING -m state --state NEW -p tcp --dport 443 -d 192.168.1.2 -j CONNMARK --set-mark 1
iptables -t mangle -A PREROUTING -m state --state NEW -p tcp --dport 8080 -d 192.168.1.2 -j CONNMARK --set-mark 1
iptables -t mangle -A PREROUTING -m state --state NEW -p tcp --dport 8443 -d 192.168.1.2 -j CONNMARK --set-mark 1
EDIT: Actually the following seems to be working... am I on the right track?
#!/bin/sh
ip route flush table 100
ip route del default table 100
ip rule del fwmark 1 table 100
ip route flush cache
iptables -t mangle -F PREROUTING
ip rule add fwmark 1 table 100 via $(nvram get wan1_gateway)
ip route flush cache
iptables -t mangle -A PREROUTING -p tcp -i br0 -m multiport --sports 80,20,21,443,8080,8443 -d 192.168.1.2 -j MARK --set-mark 1