4

How to Configure a Private Network on CentOS

 2 years ago
source link: https://www.vultr.com/docs/how-to-configure-a-private-network-on-centos
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

Using a Different System?

Are we missing a guide for your target system? Request one, or submit your own!
<?xml encoding="utf-8" ??>

Introduction

Vultr provides many flexible networking options for your cloud servers. In addition to the public network attached to every Vultr instance, you can configure up to five private networks per location. Private networks allow instances within a location to communicate without exposing the traffic to the public internet.

Note: Your network adapter names may not match the examples. See our article How to Find the Network Adapter Names for a Vultr Cloud Server.

Please see the guide How to Configure a Private Network at Vultr for general information about Vultr's private network feature.

Private networks do not have DHCP. When deploying a Vultr cloud server with private networking, you must manually configure the private adapters or supply your own DHCP server. We provide network configuration examples for many popular operating systems, pre-configured for your instance's IP addresses. You can find these by navigating to the settings screen (1) for your server, then selecting IPv4 (2). Follow the networking configuration link (3) to view the configuration examples.

NetworkConfig

The configurations in the customer portal are your best source of specific information. Please see below for step-by-step instructions with generic examples.

CentOS 8

  1. Verify that private networking is enabled for your cloud server. Your private network device is ens7. Your public network device is ens3.

  2. Edit /etc/sysconfig/network-scripts/ifcfg-ens7

    # nano /etc/sysconfig/network-scripts/ifcfg-ens7
    
  3. Change 10.10.10.3 to the selected private IP address and replace the contents of ifcfg-ens7 with:

    TYPE="Ethernet" 
    DEVICE="ens7" 
    ONBOOT="yes" 
    BOOTPROTO="none" 
    IPADDR=10.10.10.3
    PREFIX=16
    MTU=1450
    
  4. Restart the connection, or reboot.

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

CentOS 7 and CentOS 6

  1. Verify that private networking is enabled for your cloud server. Your private network device is eth1. Your public network device is eth0.

  2. Edit /etc/sysconfig/network-scripts/ifcfg-eth1

    # nano /etc/sysconfig/network-scripts/ifcfg-eth1
    
  3. Change 10.10.10.3 to the selected private IP address and replace the contents of ifcfg-eth1 with:

    DEVICE=eth1
    ONBOOT=yes
    NM_CONTROLLED=no
    BOOTPROTO=static
    IPADDR=10.10.10.3
    NETMASK=255.255.0.0
    IPV6INIT=no
    MTU=1450
    
  4. Start the interface or reboot.

    # ifup eth1
    

Manage Private Networks via API

The Vultr API offers several endpoints to manage private networks.

Want to contribute?

You could earn up to $600 by adding new articles


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK