Q
Q
Quqas2021-05-19 20:19:35
ubuntu
Quqas, 2021-05-19 20:19:35

Ubuntu server 20.04 (netplan). Two network cards. Both over DHCP. How to fix it to work?

Owing to insuperable circumstances on the server (virtual) 2 network interface cards are used. eth0 and eth1 both set to dhcp in netplan

network:
  version: 2
  renderer: networkd
  ethernets:
    eth0:
      dhcp4: true
      dhcp6: true
    eth1:
      dhcp4: true
      dhcp6: true

because both dhcp have 2 gateways
, this is unchanged.
it is necessary that dhcp

eth0 looks in the Internet
10.0.26.88/24
eth1 in the domain. there is no access to the Internet through the gateway.
192.168.25.88/24

access to the server is from both networks, which is typical. I did not notice that he did not answer.

Problems at the server.

then he does not see the Internet, then he cannot reach DC.
And not 100% of the time, but randomly.
ping ya.ru from 0 to 100% loss in a period of time can
also be with ping dom.local

Reasons I understand that in 2 network cards, that there are 2 gateways, both / 24 and, in addition, the metrics are apparently equal.
The question is how to fix and what?

obviously it is easier to edit the route for the domain network card, but it does not work yet.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
Q
Quqas, 2021-05-19
@Quqas

in the first approximation, it was enough to change the metric on the domain network card

network:
  version: 2
  renderer: networkd
  ethernets:
    eth0:
      dhcp4: true
      dhcp4-overrides:
                route-metric: 100
    eth1:
      dhcp4: true
      dhcp4-overrides:
                route-metric: 110

# ip route
default via 10.0.26.1 dev eth0 proto dhcp src 10.0.26.80 metric 100
default via 192.168.25.1 dev eth1 proto dhcp src 192.168.25.88 metric 110
10.0.26.0/24 dev eth0 proto kernel scope link src 10.0.26.80
10.0.26.1 dev eth0 proto dhcp scope link src 10.0.26.80 metric 100
192.168.25.0/24 dev eth1 proto kernel scope link src 192.168.25.88
192.168.25.1 dev eth1 proto dhcp scope link src 192.168.25.88 metric 110

pings from the server began to go without problems. always
but the Apache on it still continues to be stupid. we will look further
----------------------------------------
this solved the trouble as I wanted
.

K
ky0, 2021-05-19
@ky0

"My network is crooked on the server, there is no root, nothing can be changed, what should I do?"
Do you understand how absurd it sounds?
Z.Y. - If you have the opportunity to prescribe a route, then there is an opportunity to demolish an extra gateway.

D
Dmitry, 2021-05-19
@q2digger

It is necessary to set for dhcp that ignoring default route on one of the interfaces. I don't know how to do it in Netplan
But there are discussions on the net.
https://unix.stackexchange.com/questions/517995/pr...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question