A
A
Anton Misyagin2018-08-22 20:56:27
linux
Anton Misyagin, 2018-08-22 20:56:27

How to configure domain routing in ubuntu?

Friends, tell me, is it possible to configure the ubuntu server 14 OS in such a way that all network requests from any programs under its control on a specific domain name (ip is also suitable) are sent to a specific gate? The picture shows the layout of the locale. You need to go to domain 2 through router number 2, to other addresses through router 1. Domain 2 has blocked my static ip and I want to go to it from now on through dynamic. How to do? Thanks for the help.
PS I tried this:
sudo nano /etc/network/interfaces
auto eth0
iface eth0 inet static
address 192.168.0.1
netmask 255.255.255.0
network 192.168.0.0
broadcast 192.168.0.255
gateway 192.168.0.1
dns-nameservers 192.168.0.1

I.e. by default, I understand we climb through the first gate
then I set up the route:
sudo route add -host 185.xx.yy.132 gw 192.168.0.2
I mean that I will go to the host 185.xx.yy.132 through the second gate,
I get the routing table:
route -n

Destination Gateway Genmask Flags Metric Ref Use Iface
0.0.0.0 192.168.0.1 0.0.0.0 UG 0 0 0 p2pl
185.xx. yy.132 192.168.0.2 255.255.255.255 UGH 0 0 0 p2pl
192.168.0.0 0.0.0.0 255.255.255.0 U 0 0 0 p2pl

In general, the target domain did not ban me. From other LAN computers, I go only through router 2 and the target server lets other LAN computers. Something is wrong, but what is not clear and how to check whether the packets of my server really climb through the desired gate ...
PPS In general, my server has two network cards and, accordingly, two LAN connectors. Perhaps both should be used. How I don't know..
5b7db4da2b3e7204246794.png

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Anton Misyagin, 2018-08-23
@sunnmas

Actually, I did everything correctly, as I wrote in my question. I just didn't look at the result correctly.

D
Dmitry, 2018-08-22
@Tabletko

Specify routes to required networks through different gateways

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question