R
R
RoffDaniel2020-11-16 11:09:02
CentOS
RoffDaniel, 2020-11-16 11:09:02

How to make CentOS 8 work through two network interfaces?

I welcome everyone! Can you please tell me how to properly configure two or more network interfaces in CentOS 8? In my case, two interfaces. My network is set up this way. There is a local IP 10.0.20.0/24 with a gateway 10.0.20.251 (ens18), and 10.0.30.0/24 with a gateway 10.0.30.251 (ens19). When installing the operating system, I set the network interfaces to static (Manual). Editing only one tab, IPv4. The next step is to install the system. After installation, I enable the option "Automatically turn on at startup". I restart, try to SSH into the IP address 10.0.20.20, connect, enter the login (root), and then it starts. I wait about a minute for the program (PuTTY) to let me enter the password. If I want to connect via 10.0.30.30, it just doesn't connect to me, and I don't understand why?

I apologize in advance, most likely these are banal and simple questions, but I'm working with CentOS for the first time... If I didn't explain well, I hope at least the screenshots will help.

spoiler

5fb2330a0d5e7724754328.png
5fb23312798ff948624518.png
5fb233194d060902195540.png
5fb2332666675006079377.png
5fb2332f67894614256295.png
5fb2333561c89512392803.png
5fb233667d847793199541.png
5fb2336fabd2b365937113.png
5fb23375a70be961629329.png
5fb2337aa51c1127689691.png
5fb2337fe56e8105859992.png

Answer the question

In order to leave comments, you need to log in

3 answer(s)
S
shurshur, 2020-11-16
@RoffDaniel

That's right, because the packet arrives on one interface, and then by default route tries to leave through another with the wrong address for this interface. In principle, this can even work if you turn off rp_filter. But in general, they say correctly: two gateways are not needed, nothing good will come of this.
In the general case, the task of "responding to a request through the same interface, bypassing the default route" is solved using policy routing. You need to make two more different routing tables with the necessary routes and then select them through ip rule.
As for the brakes when logging in, this server is trying to check the PTR record of the connecting person in the DNS. Accordingly, if everything is done well on the server with DNS, then there will be no brakes.

K
Keffer, 2020-11-16
@Keffer

Two gateways should never be registered. And you most likely prescribe both at once. This is where network programs come into play.

S
Sergey Ryzhkin, 2020-11-16
@Franciz

You leave the gateway on one of the interfaces, after which you write a route in the config file of each of the network interfaces to ask it which network they are looking at.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question