Answer the question
In order to leave comments, you need to log in
How to configure openvpn to work on 2 ip addresses?
there is a gateway on debian
there are 2 providers
one ip on eth0:3
another on eth1
by default we configure the gateway to be on eth0:3
#!/bin/sh
IP1=88.140.167.214
IP2=217.230.75.242
P1=88.140.167.213
P2=217.230.75.241
P1_NET=88.140.167.212/30
P2_NET=217.230.75.240/30
IF1=eth0:3
IF2=eth1
ip route flush table prov214
ip route add default via $P1 dev eth0:3 table prov214
ip route flush table prov242
ip route add default via $P2 dev eth1 table prov242
# Говорим, что по дефолту будем ходить через первого провайдера.
ip route del 0/0
ip route add default via $P1
ip rule del table prov214
ip rule del table prov242
ip rule add from $IP1 table prov214
ip rule add from $IP2 table prov242
ip rule add fwmark 0x1/0x1 lookup prov214
#!/bin/bash
iptables -A PREROUTING -i eth1 -j MARK --set-mark 0x1 -t mangle
iptables -A PREROUTING -j CONNMARK --save-mark -t mangle -m mark --mark 0x1
iptables -A PREROUTING -j CONNMARK -t mangle --set-mark 0x1 -i eth1
iptables -A PREROUTING -j CONNMARK -t mangle --set-mark 0x1 -s 10.0.1.73 -d ! 10.0.0.0/16
local 217.230.75.241
Answer the question
In order to leave comments, you need to log in
eventually put the network card eth3
#!/bin/sh
IP1=88.140.167.214
IP2=217.230.75.242
P1=88.140.167.213
P2=217.230.75.241
P1_NET=88.140.167.212/30
P2_NET=217.230.75.240/30
IF1=eth3
IF2=eth1
ip route flush table prov214
ip route add default via $P1 dev eth3 table prov214
ip route flush table prov242
ip route add default via $P2 dev eth1 table prov242
# Говорим, что по дефолту будем ходить через первого провайдера.
ip route del 0/0
ip route add default via $P1
ip rule del table prov214
ip rule del table prov242
ip rule add from $IP1 table prov214
ip rule add from $IP2 table prov242
ip rule add fwmark 0x1/0x1 lookup prov242
Why are you labeling traffic at all? Don't packets go fine without it?
It's not entirely clear what you want to do with the fire rules. Allow traffic from the eth1 interface to the prov214 table, it should also go to prov242. Those. You first say if the packet came with $IP1, then go to the prov214 table and immediately mark it, directing it to prov214. Where is the logic?
And yet, change the IP from the interface from eth0:3 to eth0. I had a problem with iproute and an alias on the interface.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question