Estou tentando fazer um servidor rodar com 2 placas de rede. Uma placa de rede terá um ip dinâmico (DHCP) e a outra terá um ip estático 192.168.0.24
. Tenho 2 placas de rede neste servidor, 1 GB (enp4s0) e 10 GB (enp5s0)
Minha instalação atual do novo sistema operacional:
oven@oven-f1:~$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 22.04.5 LTS
Release: 22.04
Codename: jammy
Este netplan é o padrão que vem com uma nova instalação do sistema operacional usando configurações de rede padrão:
oven@oven-f1:~$ sudo cat /etc/netplan/50-cloud-init.yaml
# This file is generated from information provided by the datasource. Changes
# to it will not persist across an instance reboot. To disable cloud-init's
# network configuration capabilities, write a file
# /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg with the following:
# network: {config: disabled}
network:
ethernets:
enp4s0:
dhcp4: true
version: 2
wifis: {}
status das placas de rede com este netplan:
oven@oven-f1:~$ ip link show
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: enp4s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP mode DEFAULT group default qlen 1000
link/ether d8:43:ae:90:b8:2e brd ff:ff:ff:ff:ff:ff
3: enp5s0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN mode DEFAULT group default qlen 1000
link/ether 74:fe:ce:ea:db:b5 brd ff:ff:ff:ff:ff:ff
rotas padrão com esta configuração netplan:
oven@oven-f1:~$ ip route
default via 192.168.0.1 dev enp4s0 proto dhcp src 192.168.0.27 metric 100
192.168.0.0/24 dev enp4s0 proto kernel scope link src 192.168.0.27 metric 100
192.168.0.1 dev enp4s0 proto dhcp scope link src 192.168.0.27 metric 100
Abaixo está a nova configuração do netplan que estou tentando implementar:
network:
version: 2
renderer: networkd
ethernets:
enp4s0:
dhcp4: true
enp5s0:
dhcp4: true
addresses:
- 192.168.0.24/24
routes:
- to: 0.0.0.0/0
via: 192.168.0.1
nameservers:
addresses: [8.8.8.8, 8.8.4.4]
O problema é que quando executo um sudo netplan --debug apply
com a nova configuração:
oven@oven-f1:~$ sudo netplan --debug apply
** (generate:1778): DEBUG: 07:51:08.869: starting new processing pass
** (generate:1778): DEBUG: 07:51:08.869: enp5s0: adding new route
** (generate:1778): DEBUG: 07:51:08.869: starting new processing pass
** (generate:1778): DEBUG: 07:51:08.869: We have some netdefs, pass them through a final round of validation
** (generate:1778): DEBUG: 07:51:08.869: enp4s0: setting default backend to 1
** (generate:1778): DEBUG: 07:51:08.869: Configuration is valid
** (generate:1778): DEBUG: 07:51:08.869: enp5s0: setting default backend to 1
** (generate:1778): DEBUG: 07:51:08.869: Configuration is valid
** (generate:1778): DEBUG: 07:51:08.869: Generating output files..
** (generate:1778): DEBUG: 07:51:08.869: Open vSwitch: definition enp4s0 is not for us (backend 1)
** (generate:1778): DEBUG: 07:51:08.869: NetworkManager: definition enp4s0 is not for us (backend 1)
** (generate:1778): DEBUG: 07:51:08.869: Open vSwitch: definition enp5s0 is not for us (backend 1)
** (generate:1778): DEBUG: 07:51:08.869: NetworkManager: definition enp5s0 is not for us (backend 1)
** (process:1776): DEBUG: 07:51:09.042: starting new processing pass
** (process:1776): DEBUG: 07:51:09.042: enp5s0: adding new route
** (process:1776): DEBUG: 07:51:09.042: starting new processing pass
** (process:1776): DEBUG: 07:51:09.042: We have some netdefs, pass them through a final round of validation
** (process:1776): DEBUG: 07:51:09.042: enp4s0: setting default backend to 1
** (process:1776): DEBUG: 07:51:09.042: Configuration is valid
** (process:1776): DEBUG: 07:51:09.042: enp5s0: setting default backend to 1
** (process:1776): DEBUG: 07:51:09.042: Configuration is valid
** (process:1776): DEBUG: 07:51:09.128: starting new processing pass
** (process:1776): DEBUG: 07:51:09.128: enp5s0: adding new route
** (process:1776): DEBUG: 07:51:09.128: starting new processing pass
** (process:1776): DEBUG: 07:51:09.128: We have some netdefs, pass them through a final round of validation
** (process:1776): DEBUG: 07:51:09.128: enp4s0: setting default backend to 1
** (process:1776): DEBUG: 07:51:09.128: Configuration is valid
** (process:1776): DEBUG: 07:51:09.128: enp5s0: setting default backend to 1
** (process:1776): DEBUG: 07:51:09.128: Configuration is valid
** (process:1776): DEBUG: 07:51:09.128: starting new processing pass
** (process:1776): DEBUG: 07:51:09.128: enp5s0: adding new route
** (process:1776): DEBUG: 07:51:09.128: starting new processing pass
** (process:1776): DEBUG: 07:51:09.128: We have some netdefs, pass them through a final round of validation
** (process:1776): DEBUG: 07:51:09.128: enp4s0: setting default backend to 1
** (process:1776): DEBUG: 07:51:09.128: Configuration is valid
** (process:1776): DEBUG: 07:51:09.128: enp5s0: setting default backend to 1
** (process:1776): DEBUG: 07:51:09.128: Configuration is valid
status das placas de rede com este novo netplan:
oven@oven-f1:~$ ip link show
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: enp4s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP mode DEFAULT group default qlen 1000
link/ether d8:43:ae:90:b8:2e brd ff:ff:ff:ff:ff:ff
3: enp5s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP mode DEFAULT group default qlen 1000
link/ether 74:fe:ce:ea:db:b5 brd ff:ff:ff:ff:ff:ff
rotas padrão com esta nova configuração netplan:
oven@oven-f1:~$ ip route
default via 192.168.0.1 dev enp5s0 proto static
default via 192.168.0.1 dev enp4s0 proto dhcp src 192.168.0.27 metric 100
192.168.0.0/24 dev enp5s0 proto kernel scope link src 192.168.0.24
192.168.0.0/24 dev enp4s0 proto kernel scope link src 192.168.0.27 metric 100
192.168.0.1 dev enp4s0 proto dhcp scope link src 192.168.0.27 metric 100
Não há erros com minha configuração , mas perco acesso ssh ao servidor . Ainda consigo acessar a internet do servidor e ssh para outras máquinas , mas não consigo ssh no servidor do meu laptop.
Não consigo fazer ping no servidor, mas ainda consigo ver seu endereço:
s@M1 ~ % nslookup oven-f1
Server: 2001:8003:d44e:7600::1
Address: 2001:8003:d44e:7600::1#53
Name: oven-f1.modem
Address: 192.168.0.27
s@M1 ~ % ping oven-f1
PING oven-f1.modem (192.168.0.27): 56 data bytes
Request timeout for icmp_seq 0
Request timeout for icmp_seq 1
Request timeout for icmp_seq 2
Request timeout for icmp_seq 3
^C
--- oven-f1.modem ping statistics ---
5 packets transmitted, 0 packets received, 100.0% packet loss
Não tenho certeza do porquê não consigo fazer ssh no servidor depois de habilitar 2 placas de rede, qualquer ajuda seria muito apreciada, pois estou bastante travado
Editar resposta atualização
abaixo está a configuração do netplan funcionando. Eu simplesmente dividi os cartões de 10 GB e o switch de 10 GB em sub-redes diferentes 192.168.1.0/24
e mantive os cartões de 1 GB e o switch ligados 192.168.0.0/24
.
network:
version: 2
renderer: networkd
ethernets:
enp4s0:
dhcp4: true
enp5s0:
dhcp4: false
addresses:
- 192.168.1.24/24
também atualizou o arquivo hosts nos servidores para mapear hosts na 192.168.1.0/24
sub-rede