7

Configure Fedora with Multiple IP Addresses

 2 years ago
source link: https://www.vultr.com/docs/configure-fedora-with-multiple-ip-addresses
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

A basic network configuration at Vultr consists of a single IPv4 address, configured by DHCP. If you have advanced networking requirements, Vultr supports multiple public IPs and up to five private networks. You need to manually configure these advanced scenarios. Refer to the networking configuration page in the customer portal for your exact configuration. This example demonstrates three public IPv4 addresses, two private IPv4 networks, and two public IPv6 addresses.

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.

IPv4 Info

MultipleIP

IPv6 Info

MultipleIP

Example for Fedora 29 - 32

Public Network

  1. Configure the public network for three static IPv4 addresses:

    # nmcli con add con-name public-net ifname ens3 type ethernet ipv4.method 'manual' ipv4.addresses '192.0.2.101/23' ipv4.gateway '192.0.2.1' ipv4.dns ''
    # nmcli con mod public-net +ipv4.addresses '192.0.2.102'
    # nmcli con mod public-net +ipv4.addresses '192.0.2.103'
    
  2. Configure DNS for the public network:

    # nmcli con mod public-net +ipv4.dns '192.0.2.200'
    
  3. Configure the public network for dynamic IPv6 configuration, and one additional IPv6 address (/128). Additional addresses can be added in the same fashion.

    # nmcli con mod public-net ipv6.method 'auto' ipv6.addresses ''
    # nmcli con mod public-net +ipv6.addresses '2001:db8:1000::200/128'
    
  4. Restart the public network.

    # nmcli con up public-net
    

Private Network

  1. Configure the private network for two static IPv4 addresses:

    # nmcli con add con-name private-net ifname ens7 type ethernet ipv4.method 'manual' ipv4.addresses '10.1.1.100/20' 802-3-ethernet.mtu 1450
    # nmcli con mod private-net +ipv4.addresses '10.1.1.200/20'
    
  2. Restart the private network.

    # nmcli con up private-net
    

Example for Fedora 24 - 28

Configure the public network with three public IPv4 addresses and two public IPv6 addresses.

  1. Define the first public IPv4 and both public IPv6 addresses on adapter ens3.
    Populate /etc/sysconfig/network-scripts/ifcfg-ens3 with:

    DEVICE=ens3
    ONBOOT=yes
    NM_CONTROLLED=no
    BOOTPROTO=static
    NOZEROCONF=yes
    IPADDR=192.0.2.101
    NETMASK=255.255.254.0
    GATEWAY=192.0.2.1
    DNS1=192.0.2.200
    
    IPV6INIT=yes
    IPV6ADDR="2001:db8:1000::100/64"
    IPV6_AUTOCONF="yes"
    IPV6ADDR_SECONDARIES="2001:db8:1000::200/64" 
    DNS2=2001:db8:1000::1
    
  2. Set the default route for ens3.
    Populate /etc/sysconfig/network-scripts/route-ens3 with:

    169.254.0.0/16 dev ens3
    
  3. Define the second public IPv4 on adapter ens3:1.
    Populate /etc/sysconfig/network-scripts/ifcfg-ens3:1 with:

    DEVICE=ens3:1
    BOOTPROTO=static
    IPADDR=192.0.2.102
    NETMASK=255.255.255.255
    ONBOOT=yes
    
  4. Define the third public IPv4 on adapter ens3:2.
    Populate /etc/sysconfig/network-scripts/ifcfg-ens3:2 with:

    DEVICE=ens3:2
    BOOTPROTO=static
    IPADDR=192.0.2.103
    NETMASK=255.255.255.255
    ONBOOT=yes
    

Private Network

  1. Define the first private network on adapter ens7.
    Populate /etc/sysconfig/network-scripts/ifcfg-ens7 with:

    DEVICE=ens7
    ONBOOT=yes
    BOOTPROTO=static
    NOZEROCONF=yes
    IPV6INIT=no
    IPADDR=10.1.1.100
    NETMASK=255.255.240.0
    MTU=1450
    
  2. Define the second private network on adapter ens8.
    Populate /etc/sysconfig/network-scripts/ifcfg-ens8 with:

    DEVICE=ens8
    ONBOOT=yes
    BOOTPROTO=static
    NOZEROCONF=yes
    IPV6INIT=no
    IPADDR=10.1.1.200
    NETMASK=255.255.240.0
    MTU=1450
    

Activate Network Changes

Restart networking or reboot to activate the network changes.

# systemctl restart network.service

Nameservers

Verify that /etc/resolv.conf has your preferred nameservers for IPv4, and optionally IPv6.

domain       example.com
nameserver   2001:db8:1000::1
nameserver   192.0.2.200

More Resources

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