Skip to content

Ubuntu OS configuration

Hector Cruz edited this page Oct 11, 2024 · 8 revisions

This page describes the process to configure Ubuntu 24.04 to interface with the vehicle sensors and run docker containers

Network configuration

In order to configure the network properly, we need to migrate the configuration files/settings that the previous CentOS 7 had to communcate with the sensors.

The sever neeeds two configurations: the network interface and the dhcp server.

CentOS7 ifconfig output:

enp129s0f0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 172.27.28.69  netmask 255.255.252.0  broadcast 172.27.31.255
        inet6 fe80::ae1f:6bff:fe8a:5218  prefixlen 64  scopeid 0x20<link>
        ether ac:1f:6b:8a:52:18  txqueuelen 1000  (Ethernet)
        RX packets 3004  bytes 863431 (843.1 KiB)
        RX errors 0  dropped 1  overruns 0  frame 0
        TX packets 523  bytes 46865 (45.7 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

enp129s0f1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 172.31.0.1  netmask 255.255.0.0  broadcast 172.31.255.255
        inet6 fe80::ae1f:6bff:fe8a:5219  prefixlen 64  scopeid 0x20<link>
        ether ac:1f:6b:8a:52:19  txqueuelen 1000  (Ethernet)
        RX packets 1129  bytes 102963 (100.5 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 2198  bytes 380183 (371.2 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

enp129s0f1:1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 10.2.0.81  netmask 255.255.0.0  broadcast 10.2.255.255
        ether ac:1f:6b:8a:52:19  txqueuelen 1000  (Ethernet)

enp129s0f1.101: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 10.1.0.81  netmask 255.255.0.0  broadcast 10.1.255.255
        inet6 fe80::ae1f:6bff:fe8a:5219  prefixlen 64  scopeid 0x20<link>
        ether ac:1f:6b:8a:52:19  txqueuelen 1000  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 667  bytes 41746 (40.7 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

We need to recplicate this settings in Ubuntu.

Ubuntu uses Netplan to configure networks based on YAML files

Configuring enp129s0f1

Based on CentOS ifcfg-enp129s0f1 and route-enp129s0f1 configuration files:

# ifcfg-enp129s0f1

DEVICE="enp129s0f1"
TYPE="Ethernet"
ONBOOT="yes"
BOOTPROTO="static"
IPADDR="172.31.0.1"
NETMASK="255.255.0.0"
NM_CONTROLLED="no"
IPV6INIT="no"
ZONE="sensor-lan"
DEFROUTE="no"
ETHTOOL_OPTS="-L ${DEVICE} combined 16; -A ${DEVICE} autoneg off tx off rx off"
# route-enp129s0f1
0.2.0.0/16 dev enp129s0f1

Ubuntu 24.04 by default sets both enp129s0f1 and enp129s0f0 both to be DHCP4 clients by default due to Cloud configuration (???) and automatically defines /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:
        enp129s0f0:
            dhcp4: true
        enp129s0f1:
            dhcp4: true
    version: 2

As per file description, we created a /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg file with the network: {config: disabled}

But also the contents inside 50-cloud-init.yaml file was commented as clashes with the target configuration which is deactivating dhcp4 client on enp129s0f1

A 40_lxo_network_config.yaml file was created with chmod 600 to avoid warnings:

network:
  version: 2
  ethernets:
    enp129s0f0:
      dhcp4: true
    enp129s0f1:
      addresses:
        - 172.31.0.1/16 # /16 corresponds to a subnet mask of 255.255.0.0
      dhcp4: false
      dhcp6: false
      routes:
        - to: default
          via: 172.31.0.1

Changes are applied with sudo netplan apply.

This ubuntu netlplan tutorial suggests using renderer: networkd however, this casues issues on the configuration and it was omitted. This will cause the NetworkManager to use it

Clone this wiki locally