Friday, March 13, 2020

Setting up New Ethernet Interfaces on Debian Linux

I am running Debian Linux on Oracle VirtualBox virtual machines. The Linux system has only the command line interface, and has no GUI installed.  Below are the steps to add Ethernet interfaces to the Linux virtual machine and to get IP addresses via DHCP.
  1. Shut down  the Linux virtual machine
  2. Add and enable Ethernet interfaces to the virtual machine
  3. Boot the Linux virtual machine
  4. On the Linux virtual machine, view the Internet addresses
    
    ip address show
    
  5. Assume that we added two Ethernet adapters and the output of the command above shows that they are enp0s8 and enp0s9, we add the following lines to /etc/network/interfaces,
    
    allow-hotplug enp0s8
    iface enp0s8 inet dhcp
    
    allow-hotplug enp0s9
    iface enp0s9 inet dhcp
     
  6. Restart the networking service by running the following as root (or via sudo)
    
    systemctl restart networking
     
  7. Complete IP setting including assigning IP addresses via DHCP by running the following as root (or via sudo)
    
    dhclient