A
A
Arthur2015-07-07 08:04:56
ubuntu
Arthur, 2015-07-07 08:04:56

How to set up two external IPs in Ubuntu Server?

Hello. Yes, repeating the question, last time I could not get a clear answer, sorry :(.
There is a server with Ubuntu Server. There are three network cards on the server. The first two IPs are external, the third is internal. The point is that both external addresses are pinged from outside I prescribe a route for one external, sell ping for another, and so on in a circle :(. It turns out that either the first or the second works.
Thank you.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
A
Arthur, 2015-09-03
@deleted-fromStark

1. Open /etc/iproute2/rt_tables and add something like this:

190     net_ext_1
195     net_ext_2

Well, i.e. you describe new tables of routing.
Next, we run the following commands:
/sbin/ip rule add from 10.10.1.10 lookup net_ext_1 pref 20000
/sbin/ip rule add from 10.11.2.10 lookup net_ext_2 pref 20000

Replace the addresses 10.10.1.10 and 10.11.2.10 with the addresses of your interfaces.
And final:
/sbin/ip route add default via 10.10.1.1 table net_ext_1
/sbin/ip route add default via 10.11.2.1 table net_ext_2

This is how you specify the default routes for each of the tables. Of course, the addresses should be replaced with your own.
If you want to understand in more detail - read the LARTC HowTo.
Thanks to the user .

A
Azazel PW, 2015-07-07
@azazelpw

The server is working correctly.
I turn on telepathy :)
You tell him
route add default gw xxxx
route add default gw yyyy metric 1
And only one gateway answers by default :)
And you were given an article on the simplest script for working two channels.
habrahabr.ru/post/54748
There, channel balancing was used through the weight
ip route add default scope global nexthop via $P1 dev $IF1 weight $W1 \
nexthop via $P2 dev $IF2 weight $W2 parameter
What exactly is not clear in this article? At one time, I also started with an analogue of the same.
I have now made a switch on providers on the same basis.

V
Vasily, 2015-07-07
@DobriyJuk

There is another option. Quite simple. Banal pingalka. When the signal does not pass through one channel, the script rewrites the main route and the signal goes through the second channel.
Of the minuses: Perversion, fault tolerance at a very low level, the ability to write elementary scripts on the shell is required. I'm not sure, but perhaps the RAM will still suffer seriously after a week of running the script. But again, I'm not sure.
On the other hand, it's easier to just run and poke yourself.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question