Ubuntu Network Config

I recently had to modify the NIC setup and add a virtual nic.  Thought I would save this.. as it was simple and thought i’d share.  This is using the default ens160 interface, and a sub-interface on the same nic.

# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

source /etc/network/interfaces.d/*

# The loopback network interface
auto lo ens160 ens160:1
iface lo inet loopback

# The primary network interface
iface ens160 inet static
address 10.111.1.105
netmask 255.255.224.0
network 10.111.0.0
broadcast 10.111.31.255
gateway 10.111.0.4
dns-nameservers 8.8.8.8
dns-domain your-domain.com
dns-search your-domain.com

iface ens160:1 inet static
address 10.111.2.198
netmask 255.255.224.0
broadcast 10.111.31.255
network 10.111.0.0

 

# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

source /etc/network/interfaces.d/*

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
auto ens160
iface ens160 inet dhcp

Leave a Reply

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