Skip to content

Instantly share code, notes, and snippets.

@dipanshuchaubey
Created January 10, 2022 12:26
Show Gist options
  • Save dipanshuchaubey/84dc0c6c4aa9101144ec19e4de5f190b to your computer and use it in GitHub Desktop.
Save dipanshuchaubey/84dc0c6c4aa9101144ec19e4de5f190b to your computer and use it in GitHub Desktop.
linux-networking

Adding New Network Interface in Ubuntu

1. Check if the network adapter is connected

$ ifconfig -a
ens00: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.1.1  netmask 255.255.255.0  broadcast 192.168.1.255
        inet6 fe80::20c:29ff:feb8:214e  prefixlen 64  scopeid 0x20<link>

ens01: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.74.1  netmask 255.255.255.0  broadcast 192.168.74.255
        inet6 fe80::20c:29ff:feb8:2158  prefixlen 64  scopeid 0x20<link>

NOTE: To list all the connected network adapters run: ls /sys/class/net

2. Add the config of new interface into /etc/netplan/00-installer-config.yaml

$ sudo vim 00-installer-config.yaml
network:
  ethernets:
     ens00:
        dhcp4: true
     ens01:
        dhcp4: true
version: 2

3. Apply the changes

$ netplan apply
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment