I am trying to get a server running with 2 network cards. One network card will have a dynamic ip(DHCP) and the other will have a static ip 192.168.0.24. I have 2 network cards on this server, 1GB(enp4s0) and 10GB(enp5s0)
My current fresh OS installation:
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
This netplan is the default one that comes with a fresh OS install using default network configs:
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 of network cards with this 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
default routes with this netplan config:
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
Below is the new netplan config im trying to implement:
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]
The problem is once i run a sudo netplan --debug apply with the new config:
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 of network cards with this new 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
default routes with this new netplan config:
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
There are no errors with my config but I loose ssh access to the server. I can still access the internet from the server and ssh to other machines but I cannot ssh into the server from my laptop.
I can't ping the server but I can still see its address:
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
Im not sure why I cannot ssh into the server after enabling 2 network cards, any help would be greatly appreciated as I'm quite stuck
Edit answer update
below is the working netplan config. I simply split the 10GB cards and 10GB switch into different subnet 192.168.1.0/24 and kept the 1GB cards and switch on 192.168.0.0/24.
network:
version: 2
renderer: networkd
ethernets:
enp4s0:
dhcp4: true
enp5s0:
dhcp4: false
addresses:
- 192.168.1.24/24
also updated the hosts file on the servers to map hosts on the 192.168.1.0/24 subnet