D
D
Denis2019-12-18 16:07:16
Debian
Denis, 2019-12-18 16:07:16

Multiple IP addresses internal and external on Debian?

We have 3 Internet providers in our company
They have gateways

192.168.0.100 - Провайдер № 1 Ростелеком, Внеший IP 92.126.213.101
192.168.0.102 - Провайдер №2 Дом.ру, Внеший IP 92.126.213.102
192.168.0.103 - Провайдер №2 ТТК, Внеший IP 92.126.213.103

In the local network There is a server on Debian.
It has 3 IP addresses assigned to it
192.168.3.98 - маска подсети 255.255.248.0
192.168.3.97 - маска подсети 255.255.248.0
192.168.3.96 - маска подсети 255.255.248.0

The bottom line is that if the Internet is lost on one provider, you can contact the server through another external IP.
In Debian, I opened the /etc/network/interfaces
file and added the config there
auto eth0:0
iface eth0:0 inet static
address 192.168.3.98
netmask 255.255.248.0
gateway 192.168.0.101

auto eth0:1
iface eth0:1 inet static
address 192.168.3.97
netmask 255.255.248.0
gateway 192.168.0.102

auto eth0:2
iface eth0:2 inet static
address 192.168.3.96
netmask 255.255.248.0
gateway 192.168.0.103

But in the end, when accessing all three external IPs, only one opens.
If you turn off all IP addresses on the local server in the config in turn and leave only one, then everything works fine.
If you try to open 192.168.3.98, 192.168.3.97, 192.168.3.96 from the local network - everything opens correctly

Answer the question

In order to leave comments, you need to log in

2 answer(s)
V
Vladimir, 2019-12-18
@MechanID

In order for the server to be able to receive connections from the Internet through any of the providers at the same time:
you need to configure the routing rules for each provider, you can read it here LARTC in paragraph 4.2.1.

T
Talyan, 2019-12-18
@flapflapjack

maybe my gateway change script will help you:

#!/bin/bash
route del default
gw=`ifconfig ppp1 | grep 'inet addr' | awk '{print $3}' | sed -e 's/.*://' `
route add default gw $gw

LOG="/var/log/routes"
answer=`wget -q http://myip.ru/index_small.php -O -| grep '95\.128'| sed -e 's/$
echo "`date` PPPoE White is $answer" >> $LOG

if ! ping -c1 8.8.8.8 >/dev/null; then
#        echo "No inet on PPPoE White!"
        exit 2
else
        exit 0
fi

Can you customize or need help?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question