How to Configure Multiple Network Interfaces on Ubuntu 18.04

May 20, 2024 / General Discussion

In this article, we have explained how to configure multiple network interfaces on Ubuntu 18.04. Configuring multiple network interfaces on Ubuntu 18.04 involves editing the network configuration files.

Here is a systematic guide-

  1. Identify Network Interfaces-
    1. First, recognize the network interfaces available on your system. You can use the “ifconfig” or “ip addr” command to list all network interfaces.
  2. Edit Network Configuration Files-
    1. Navigate to the /etc/netplan/ directory. This directory contains YAML configuration files for network settings.
    2. Open the appropriate YAML file for editing. The file name usually starts with 01-netcfg.yaml or similar.
    3. Here is an example YAML configuration with two network interfaces (‘eth0’ and ‘eth1’)-
      network:
      
        version: 2
      
        renderer: networkd
      
        ethernets:
      
          eth0:
      
            dhcp4: true
      
          eth1:
      
            dhcp4: true
    4. Substitute eth0 and eth1 with the names of your network interfaces.
    5. Set ‘dhcp4: true’ if you want the interface to use DHCP for IP configuration. If you want to allocate a static IP address, you can specify the IP configuration manually.
      For example-

      network:
      
        version: 2
      
        renderer: networkd
      
        ethernets:
      
          eth0:
      
            addresses: [192.168.1.10/24]
      
            gateway4: 192.168.1.1
      
            nameservers:
      
              addresses: [8.8.8.8, 8.8.4.4]
      
          eth1:
      
            dhcp4: true
  3. Apply Configuration Changes-
    1. After editing the configuration file, save your changes.
    2. Apply the configuration changes by running-
      sudo netplan apply
  4. Verify Configuration-
    1. Use the ‘ip addr’ or ‘ifconfig’ command to confirm that the network interfaces have been configured properly.
    2. Check network connectivity to ensure that both interfaces are running as expected.

Following the above-outlined steps, you can configure multiple network interfaces on Ubuntu 18.04 using Netplan, the default network configuration tool.

That is it! If you still find any difficulty in this KB, contact our support staff, they are available 24X7. You can read about How to Install Clang on Ubuntu 20.04 and 22.04.

Leave a Reply

Your email address will not be published. Required fields are marked *