Seleccionar página

Añadir ips failover en ubuntu server 18.04

Re: New Netplan setup – netplan: fatal error: cannot bind to port 2983, is another da

Well I had the very same issue, it turns out that for some reason that the package netplan.io had disappered.

But a quick response on irc fixed this with the following response for answer

you’ve probably confused the netplan calendaring tool with netplan the network configuration tool
install netplan.io not netplan
(sudo) apt install netplan.io netplan-

After a

Code:
netplan generate; netplan try

then applied the old working config and everything worked again

Configuring your new failover IP in Ubuntu 18.04

Now that we have our IP, it won’t automatically be configured on the actual Ubuntu 18.04 server. You have to do this manually.

Unfortunately Ubuntu 18.04 no longer includes ifupdown as default. Instead netplan is bundled for network interfacing. You can install ifupdown and use that but you may as well get used to netplan moving forward.

If you want to go back to ifupdown, read details here: https://netplan.io/faq#how-to-go-back-to-ifupdown

Before we begin

First all of we need to take note of your current servers ethernet card details (assuming you only have one ethernet card). We need the following details:

  • Network interface name
  • MAC address

Type in the following command to get these details:

root@localhost:/#

ifconfig

Hopefully you get an output similar to the following:

ifconfig-mac-address

I have highlighted in green and yellow the network interface name and mac address for my server. We are going to use this information to help configure the new IP failover using netplan.

  • Network interface name: eno1
  • MAC address: x8:50:f6:2x:67:8x

Configuring netplan

The first thing is to create a new custom netplan configuration file. Head over to your /etc/netplan folder and create a new empty configuration file (call it anything but it must end with a .yaml extension).

I’m going to call my file config.yaml. I am going to use nano editor but feel free to use whatever you are comfortable with.

root@localhost:/#

cd /etc/netplan

root@localhost:/etc/netplan#

nano config.yaml

If we go back and list all the information we have gathered, we are going to use this information in our new config.yaml file to bind the 2 new failover IP’s to our server:

  • Network interface name: eno1
  • MAC address: x8:50:f6:2x:67:8x 
  • Failover 1: 123.45.67.8
  • Failover 2: 123.45.67.99

Paste and edit the following in to your empty config.yaml:

network:
     version: 2
     ethernets:

eno1

:
             dhcp4: true
             match:
                 macaddress:

x8:50:f6:2x:67:8x

             set-name:

eno1

             addresses:
             -

123.45.67.8

/32
             -

123.45.67.99

/32

Note: It is very important that the indentation is correct since this is a YAML file and YAML syntax has fixed indentation rules (more on that here: https://docs.saltstack.com/en/latest/topics/yaml/).

If you do not have the correct indentation, it is likely netplan will throw an error when you try to test / restart it.

As you can see we have populated the details such as the Network Interface Name (eno1),MAC address (x8:50:f6:2x:67:8x) and added each of our failover IP’s after the line addresses:


addresses:
– 123.45.67.8/32
– 123.45.67.99/32

We have then also added a subnet mask of /32 to each of the IP’s.

Save the file and exit the editor.

Testing the new netplan configuration

Now that we have successfully saved our file, we want to test it to see if it works, run the following command netplan try:

root@localhost:/etc/netplan#

netplan try

You should see a successful output like the following:

root@localhost:/etc/netplan#

netplan try


Configuration accepted.

Excellent – now that we have verified the configuration looks good, lets apply the changes: Run the command netplan apply.

root@localhost:/etc/netplan#

netplan apply

Now all we need to do is verify that the new failover IPs have been assigned to the server, run the command ip addr list:

root@localhost:/etc/netplan#  ip addr list
 1: lo:  mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
     link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
     inet 127.0.0.1/8 scope host lo
        valid_lft forever preferred_lft forever
     inet6 ::1/128 scope host
        valid_lft forever preferred_lft forever
 2:

eno1

:  mtu 1500 qdisc fq_codel state UP group default qlen 1000
     link/ether

x8:50:f6:2x:67:8x

 brd ff:ff:ff:ff:ff:ff
     inet

123.45.67.8/32

  scope global eno1
        valid_lft forever preferred_lft forever
     inet

123.45.67.99/32

 scope global eno1
        valid_lft forever preferred_lft forever
     inet 91.121.xx.xx/24 brd 91.121.xx.xx scope global dynamic eno1
        valid_lft 587sec preferred_lft 587sec
     inet6 fe80::xx40:x2xx:xe3x:678x/64 scope link
        valid_lft forever preferred_lft forever

As you can see, our new failover IP’s have been assigned to the server.

Sobre el Autor

Deja una respuesta

Tu dirección de correo electrónico no será publicada. Los campos obligatorios están marcados con *

Este sitio usa Akismet para reducir el spam. Aprende cómo se procesan los datos de tus comentarios.

Abrir chat
Powered by