Skip to content

Instantly share code, notes, and snippets.

@und3fined
Last active August 18, 2022 22:53
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save und3fined/e3b7eb511703ab7788dc15ae08254a7c to your computer and use it in GitHub Desktop.
Save und3fined/e3b7eb511703ab7788dc15ae08254a7c to your computer and use it in GitHub Desktop.
Sample Network Configuration

Sample Network Configuration

  • IP: 12.34.56.78
  • Netmask: 255.255.255.0
  • Gateway: 12.34.56.1

Important Information

  • In most cases, you should not need to adjust these files. Instances are normally configured using DHCP. You only really need to change these files if you are trying to enable additional IPs.
  • Changing to the examples below will cause problems if you take a snapshot of an instance and restore it. We recommend reverting back to DHCP before taking a snapshot.
  • You must restart your server via the control panel after adding extra IPs.

CentOS 8

Populate the /etc/sysconfig/network-scripts/ifcfg-ens3 file with the following text.

TYPE="Ethernet"
DEVICE="ens3"
ONBOOT="yes"
BOOTPROTO="none"
IPADDR=12.34.56.78
GATEWAY=12.34.56.1
NETMASK=255.255.255.0
DNS1=108.61.10.10
IPV6INIT="yes"
IPV6_AUTOCONF="yes"

Restart the connection, or reboot.

nmcli con load /etc/sysconfig/network-scripts/ifcfg-ens3
nmcli con up 'System ens3'

Populate the /etc/sysconfig/network-scripts/ifcfg-ens7 file with the following text.

# Private network: net5de51d24c09e1
TYPE="Ethernet"
DEVICE="ens7"
ONBOOT="yes"
BOOTPROTO="none"
IPADDR=10.40.96.3
PREFIX=20
MTU=1450

Restart the connection, or reboot.

nmcli con load /etc/sysconfig/network-scripts/ifcfg-ens7
nmcli con up 'System ens7'

CentOS 6, CentOS 7

Populate the /etc/sysconfig/network-scripts/ifcfg-eth0 file with the following text.

DEVICE=eth0
ONBOOT=yes
BOOTPROTO=static
IPADDR=12.34.56.78
GATEWAY=12.34.56.1
NETMASK=255.255.255.0
DNS1=108.61.10.10

Populate the /etc/sysconfig/network-scripts/route-eth0 file with the following text.

169.254.0.0/16 dev eth0

Populate the /etc/sysconfig/network-scripts/ifcfg-eth1 file with the following text.

# Private network: net5de51d24c09e1
DEVICE=eth1
ONBOOT=yes
BOOTPROTO=static
IPADDR=10.40.96.3
NETMASK=255.255.240.0
MTU=1450

Restart networking or reboot. service network restart

Debian 7, Debian 8

Populate the /etc/network/interfaces file with the following text.

auto lo
iface lo inet loopback

auto eth0
iface eth0 inet static
	address 12.34.56.78
	netmask 255.255.255.0
	gateway 12.34.56.1
	dns-nameservers 108.61.10.10
	post-up ip route add 169.254.0.0/16 dev eth0


# Private network: net5de51d24c09e1
auto eth1
iface eth1 inet static
	address 10.40.96.3
	netmask 255.255.240.0
	mtu 1450

Restart networking or reboot. systemctl restart networking.service

Debian 9, Debian 10

Populate the /etc/network/interfaces file with the following text.

auto lo
iface lo inet loopback

auto ens3
iface ens3 inet static
	address 12.34.56.78
	netmask 255.255.255.0
	gateway 12.34.56.1
	dns-nameservers 108.61.10.10
	post-up ip route add 169.254.0.0/16 dev ens3


# Private network: net5de51d24c09e1
auto ens7
iface ens7 inet static
	address 10.40.96.3
	netmask 255.255.240.0
	mtu 1450

Restart networking or reboot. systemctl restart networking.service

Fedora 24 - 28

Populate the /etc/sysconfig/network-scripts/ifcfg-ens3 file with the following text.

DEVICE=ens3
ONBOOT=yes
NM_CONTROLLED=no
BOOTPROTO=static
NOZEROCONF=yes
IPADDR=12.34.56.78
NETMASK=255.255.255.0
GATEWAY=12.34.56.1
DNS1=108.61.10.10

Populate the /etc/sysconfig/network-scripts/route-ens3 file with the following text. 169.254.0.0/16 dev ens3

Populate the /etc/sysconfig/network-scripts/ifcfg-ens7 file with the following text.

# Private network: net5de51d24c09e1
DEVICE=ens7
ONBOOT=yes
BOOTPROTO=static
NOZEROCONF=yes
IPV6INIT=no
IPADDR=10.40.96.3
NETMASK=255.255.240.0
MTU=1450

Restart networking or reboot.

systemctl restart network.service

Fedora 29 - 31

Run the following commands to configure the public network.

nmcli con mod public-net +ipv4.dns '108.61.10.10'

Run the following commands to configure the private network.

nmcli con add con-name private-net ifname ens7 type ethernet ipv4.method 'manual' ipv4.addresses '10.40.96.3/20' 802-3-ethernet.mtu 1450
nmcli con up private-net

FreeBSD 10.x, FreeBSD 11.x, FreeBSD 12.x

Populate the /etc/rc.conf file with the following text.

static_routes="linklocal"
route_linklocal="-net 169.254.0.0/16 -interface vtnet0"
ifconfig_vtnet0="inet 12.34.56.78 netmask 255.255.255.0"
defaultrouter="12.34.56.1"


# Private network: net5de51d24c09e1

ifconfig_vtnet1="inet 10.40.96.3 netmask 255.255.240.0 mtu 1450"

Reboot the system.

reboot

OpenBSD 6.0 - OpenBSD 6.2

Populate the /etc/mygate file with the following text. 12.34.56.1 Populate the /etc/hostname.vio0 file with the following text.

inet 12.34.56.78 255.255.255.0 NONE

Populate the /etc/hostname.vio1 file with the following text.

inet 10.40.96.3 255.255.240.0
!ifconfig vio1 mtu 1450

Populate the /etc/resolv.conf file with the following text.

nameserver 108.61.10.10
lookup file bind

Reboot the system. reboot

OpenBSD 6.3 - OpenBSD 6.6

Populate the /etc/mygate file with the following text.

139.180.130.1

Populate the /etc/hostname.vio0 file with the following text.

inet 139.180.131.39 255.255.254.0 NONE

Populate the /etc/hostname.vio1 file with the following text.

inet 10.40.96.3 255.255.240.0
!ifconfig vio1 mtu 1450

Populate the /etc/resolv.conf file with the following text.

nameserver 108.61.10.10
lookup file bind

Reboot the system.

reboot

Ubuntu 12.xx - Ubuntu 15.xx

Populate the /etc/network/interfaces file with the following text.

auto lo
iface lo inet loopback

auto eth0
iface eth0 inet static
	address 139.180.131.39
	netmask 255.255.254.0
	gateway 139.180.130.1
	dns-nameservers 108.61.10.10
	post-up ip route add 169.254.0.0/16 dev eth0


# Private network: net5de51d24c09e1
auto eth1
iface eth1 inet static
	address 10.40.96.3
	netmask 255.255.240.0
	mtu 1450

Start each interface or reboot the system.

ifup eth0

Ubuntu 16.xx, Ubuntu 17.04

Populate the /etc/network/interfaces file with the following text.

auto lo
iface lo inet loopback

auto ens3
iface ens3 inet static
	address 139.180.131.39
	netmask 255.255.254.0
	gateway 139.180.130.1
	dns-nameservers 108.61.10.10
	post-up ip route add 169.254.0.0/16 dev ens3


# Private network: net5de51d24c09e1
auto ens7
iface ens7 inet static
	address 10.40.96.3
	netmask 255.255.240.0
	mtu 1450

Start each interface or reboot the system.

ifup ens3

Ubuntu 17.10, Ubuntu 18.xx, Ubuntu 19.xx

Populate the /etc/netplan/10-ens3.yaml file with the following text.

network:
  version: 2
  renderer: networkd
  ethernets:
    ens3:
      dhcp4: no
      addresses: [139.180.131.39/23]
      gateway4: 139.180.130.1
      nameservers:
        addresses: [108.61.10.10]
      routes:
      - to: 169.254.0.0/16
        via: 139.180.130.1
        metric: 100

Populate the /etc/netplan/10-ens7.yaml file with the following text.

network:
  version: 2
  renderer: networkd
  ethernets:
    ens7:
      match:
        macaddress: 5a:00:02:71:eb:f5
      mtu: 1450
      dhcp4: no
      addresses: [10.40.96.3/20]

Update networking or reboot.

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