Convert /etc/network/interfaces to netplan for floating IP
I am new to the netplan on Ubuntu 18.04, just discovered it exists today.
I have an interface that I am trying to add to create a floating IP on google cloud. It is based on this example:
https://cloud.google.com/solutions/best-practices-floating-ip-addresses#implementing_option_4
I tested the example, and it works, but now I try to do the same on ubuntu, and I don't know how to convert this:
cat << EOF >> /etc/network/interfaces
auto eth0:0
iface eth0:0 inet static
address 10.190.1.1
netmask 255.255.255.255
EOF
to netplan.
The output for ls /etc/netplan
is '50-cloud-init.yaml'. and the output for cat /etc/netplan/*.yaml
is:
network:
version: 2
ethernets:
ens4:
dhcp4: true
match:
macaddress: 42:01:0a:8e:00:3e
set-name: ens4
my ifconfig:
# ifconfig ens4
ens4: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1460
inet 10.142.0.62 netmask 255.255.255.255 broadcast 0.0.0.0
inet6 fe80::4001:aff:fe8e:3e prefixlen 64 scopeid 0x20<link>
ether 42:01:0a:8e:00:3e txqueuelen 1000 (Ethernet)
RX packets 9430 bytes 1635180 (1.6 MB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 13383 bytes 1513428 (1.5 MB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
What is the equivalent of what he said to put in the file, for netplan?
networking 18.04 netplan
add a comment |
I am new to the netplan on Ubuntu 18.04, just discovered it exists today.
I have an interface that I am trying to add to create a floating IP on google cloud. It is based on this example:
https://cloud.google.com/solutions/best-practices-floating-ip-addresses#implementing_option_4
I tested the example, and it works, but now I try to do the same on ubuntu, and I don't know how to convert this:
cat << EOF >> /etc/network/interfaces
auto eth0:0
iface eth0:0 inet static
address 10.190.1.1
netmask 255.255.255.255
EOF
to netplan.
The output for ls /etc/netplan
is '50-cloud-init.yaml'. and the output for cat /etc/netplan/*.yaml
is:
network:
version: 2
ethernets:
ens4:
dhcp4: true
match:
macaddress: 42:01:0a:8e:00:3e
set-name: ens4
my ifconfig:
# ifconfig ens4
ens4: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1460
inet 10.142.0.62 netmask 255.255.255.255 broadcast 0.0.0.0
inet6 fe80::4001:aff:fe8e:3e prefixlen 64 scopeid 0x20<link>
ether 42:01:0a:8e:00:3e txqueuelen 1000 (Ethernet)
RX packets 9430 bytes 1635180 (1.6 MB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 13383 bytes 1513428 (1.5 MB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
What is the equivalent of what he said to put in the file, for netplan?
networking 18.04 netplan
Are you using Ubuntu Desktop or Ubuntu Server? When you say "floating IP", do you mean that you want a dynamic IP address, or a static IP address? Is eth0 or ens4 your ethernet device? Do you have multiple machines where you want failover?
– heynnema
Dec 16 at 16:51
I am using google cloud platform. The vm was generated with 'ens4' ethernet device. When creating the vm, I choose static ip (10.142.0.62), /etc/netplan/50-cloud-init.yaml was autogenerated. What I want to do is to add the floating ip as explained in option#4 in the link that is in the question.
– justadev
Dec 16 at 17:05
add a comment |
I am new to the netplan on Ubuntu 18.04, just discovered it exists today.
I have an interface that I am trying to add to create a floating IP on google cloud. It is based on this example:
https://cloud.google.com/solutions/best-practices-floating-ip-addresses#implementing_option_4
I tested the example, and it works, but now I try to do the same on ubuntu, and I don't know how to convert this:
cat << EOF >> /etc/network/interfaces
auto eth0:0
iface eth0:0 inet static
address 10.190.1.1
netmask 255.255.255.255
EOF
to netplan.
The output for ls /etc/netplan
is '50-cloud-init.yaml'. and the output for cat /etc/netplan/*.yaml
is:
network:
version: 2
ethernets:
ens4:
dhcp4: true
match:
macaddress: 42:01:0a:8e:00:3e
set-name: ens4
my ifconfig:
# ifconfig ens4
ens4: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1460
inet 10.142.0.62 netmask 255.255.255.255 broadcast 0.0.0.0
inet6 fe80::4001:aff:fe8e:3e prefixlen 64 scopeid 0x20<link>
ether 42:01:0a:8e:00:3e txqueuelen 1000 (Ethernet)
RX packets 9430 bytes 1635180 (1.6 MB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 13383 bytes 1513428 (1.5 MB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
What is the equivalent of what he said to put in the file, for netplan?
networking 18.04 netplan
I am new to the netplan on Ubuntu 18.04, just discovered it exists today.
I have an interface that I am trying to add to create a floating IP on google cloud. It is based on this example:
https://cloud.google.com/solutions/best-practices-floating-ip-addresses#implementing_option_4
I tested the example, and it works, but now I try to do the same on ubuntu, and I don't know how to convert this:
cat << EOF >> /etc/network/interfaces
auto eth0:0
iface eth0:0 inet static
address 10.190.1.1
netmask 255.255.255.255
EOF
to netplan.
The output for ls /etc/netplan
is '50-cloud-init.yaml'. and the output for cat /etc/netplan/*.yaml
is:
network:
version: 2
ethernets:
ens4:
dhcp4: true
match:
macaddress: 42:01:0a:8e:00:3e
set-name: ens4
my ifconfig:
# ifconfig ens4
ens4: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1460
inet 10.142.0.62 netmask 255.255.255.255 broadcast 0.0.0.0
inet6 fe80::4001:aff:fe8e:3e prefixlen 64 scopeid 0x20<link>
ether 42:01:0a:8e:00:3e txqueuelen 1000 (Ethernet)
RX packets 9430 bytes 1635180 (1.6 MB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 13383 bytes 1513428 (1.5 MB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
What is the equivalent of what he said to put in the file, for netplan?
networking 18.04 netplan
networking 18.04 netplan
edited Dec 16 at 11:56
asked Dec 16 at 11:48
justadev
32
32
Are you using Ubuntu Desktop or Ubuntu Server? When you say "floating IP", do you mean that you want a dynamic IP address, or a static IP address? Is eth0 or ens4 your ethernet device? Do you have multiple machines where you want failover?
– heynnema
Dec 16 at 16:51
I am using google cloud platform. The vm was generated with 'ens4' ethernet device. When creating the vm, I choose static ip (10.142.0.62), /etc/netplan/50-cloud-init.yaml was autogenerated. What I want to do is to add the floating ip as explained in option#4 in the link that is in the question.
– justadev
Dec 16 at 17:05
add a comment |
Are you using Ubuntu Desktop or Ubuntu Server? When you say "floating IP", do you mean that you want a dynamic IP address, or a static IP address? Is eth0 or ens4 your ethernet device? Do you have multiple machines where you want failover?
– heynnema
Dec 16 at 16:51
I am using google cloud platform. The vm was generated with 'ens4' ethernet device. When creating the vm, I choose static ip (10.142.0.62), /etc/netplan/50-cloud-init.yaml was autogenerated. What I want to do is to add the floating ip as explained in option#4 in the link that is in the question.
– justadev
Dec 16 at 17:05
Are you using Ubuntu Desktop or Ubuntu Server? When you say "floating IP", do you mean that you want a dynamic IP address, or a static IP address? Is eth0 or ens4 your ethernet device? Do you have multiple machines where you want failover?
– heynnema
Dec 16 at 16:51
Are you using Ubuntu Desktop or Ubuntu Server? When you say "floating IP", do you mean that you want a dynamic IP address, or a static IP address? Is eth0 or ens4 your ethernet device? Do you have multiple machines where you want failover?
– heynnema
Dec 16 at 16:51
I am using google cloud platform. The vm was generated with 'ens4' ethernet device. When creating the vm, I choose static ip (10.142.0.62), /etc/netplan/50-cloud-init.yaml was autogenerated. What I want to do is to add the floating ip as explained in option#4 in the link that is in the question.
– justadev
Dec 16 at 17:05
I am using google cloud platform. The vm was generated with 'ens4' ethernet device. When creating the vm, I choose static ip (10.142.0.62), /etc/netplan/50-cloud-init.yaml was autogenerated. What I want to do is to add the floating ip as explained in option#4 in the link that is in the question.
– justadev
Dec 16 at 17:05
add a comment |
2 Answers
2
active
oldest
votes
First, your /etc/network/interfaces
is incorrect. You can't ask for "auth eth0" and then set a static address later.
auto eth0:0
iface eth0:0 inet static
address 10.190.1.1
netmask 255.255.255.255
If I understand what you're trying to do, then this netplan .yaml snippet is the minimum that you need...
network:
version: 2
renderer: networkd
ethernets:
ens4:
dhcp4: false
dhcp6: false
addresses:
- 10.142.0.62/24 # server #1, 10.142.0.63/24 for server #2
- 10.190.1.1/24 # floating IP in keepalived.conf
gateway4: 10.142.0.1
Assumptions:
- only one ethernet interface, ens4:
- if you have a multiport ethernet card, my .yaml needs additional code
- Ubuntu Server environment
- not using NetworkManager
only one ethernet interface, yes. ubuntu server, and not using NetworkManager as much as I know (how do I check?) The /etc/network/interfaces in the example is copy-paste from google official doc example in the OP. I tested it and it worked. What I don't understand in your answer is where did the floating IP disappeared (10.190.1.1). This is an explanation about floating/virtual ip docs.oracle.com/cd/E37670_01/E41138/html/…
– justadev
Dec 16 at 17:57
So there suppose to be two addresses from the ens4 nic: one static (10.142.0.62) and one virutal/floating (10.190.1.1) that is used for failover.
– justadev
Dec 16 at 17:59
@justadev No, from my understanding, the "floating/virtual IP" is configured in the keepalived .conf files. My .yaml snippet assigns an IP to the hardware in server #1. If 10.142.0.62 is your floating/virtual IP, that needs to go in keepalive, and server addresses could be... say... 10.142.0.2 and 10.142.0.3... and my .yaml would require a simple edit for those addresses on each server.
– heynnema
Dec 16 at 18:07
@justadev slight edit in my answer.
– heynnema
Dec 16 at 18:16
thanks, the code edit looks good, I will try, but in yoru comment you mixed things up (10.190.1.1 is the floating point, not 10.142.0.62). Question: can 10.142.0.62 be assigned by dhcp rather than to be statically declared in the config file? Reason I am asking is because conf file is saved on disk, so if in the future I will create disk snapshot and restore it can cause networking issue. no?
– justadev
Dec 16 at 19:26
|
show 2 more comments
Seems like you cannot create eth0:0
Check this out: https://netplan.io/examples
Multiple addresses on an interface
network:
version: 2
renderer: networkd
ethernets:
enp3s0:
addresses:
- 10.100.1.38/24
- 10.100.1.39/24
gateway4: 10.100.1.1
Multiple gateways and multiple ips
network:
version: 2
renderer: networkd
ethernets:
enp3s0:
addresses:
- 9.0.0.9/24
- 10.0.0.10/24
- 11.0.0.11/24
#gateway4: # unset, since we configure routes below
routes:
- to: 0.0.0.0/0
via: 9.0.0.1
metric: 100
- to: 0.0.0.0/0
via: 10.0.0.1
metric: 100
- to: 0.0.0.0/0
via: 11.0.0.1
metric: 100
You may want to explain how to configurenetplan
to make use of the second IP address/alias?
– Thomas
Dec 16 at 12:35
You should add the relevant part to your answer, not in the comment.
– Thomas
Dec 16 at 13:28
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "89"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1102295%2fconvert-etc-network-interfaces-to-netplan-for-floating-ip%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
First, your /etc/network/interfaces
is incorrect. You can't ask for "auth eth0" and then set a static address later.
auto eth0:0
iface eth0:0 inet static
address 10.190.1.1
netmask 255.255.255.255
If I understand what you're trying to do, then this netplan .yaml snippet is the minimum that you need...
network:
version: 2
renderer: networkd
ethernets:
ens4:
dhcp4: false
dhcp6: false
addresses:
- 10.142.0.62/24 # server #1, 10.142.0.63/24 for server #2
- 10.190.1.1/24 # floating IP in keepalived.conf
gateway4: 10.142.0.1
Assumptions:
- only one ethernet interface, ens4:
- if you have a multiport ethernet card, my .yaml needs additional code
- Ubuntu Server environment
- not using NetworkManager
only one ethernet interface, yes. ubuntu server, and not using NetworkManager as much as I know (how do I check?) The /etc/network/interfaces in the example is copy-paste from google official doc example in the OP. I tested it and it worked. What I don't understand in your answer is where did the floating IP disappeared (10.190.1.1). This is an explanation about floating/virtual ip docs.oracle.com/cd/E37670_01/E41138/html/…
– justadev
Dec 16 at 17:57
So there suppose to be two addresses from the ens4 nic: one static (10.142.0.62) and one virutal/floating (10.190.1.1) that is used for failover.
– justadev
Dec 16 at 17:59
@justadev No, from my understanding, the "floating/virtual IP" is configured in the keepalived .conf files. My .yaml snippet assigns an IP to the hardware in server #1. If 10.142.0.62 is your floating/virtual IP, that needs to go in keepalive, and server addresses could be... say... 10.142.0.2 and 10.142.0.3... and my .yaml would require a simple edit for those addresses on each server.
– heynnema
Dec 16 at 18:07
@justadev slight edit in my answer.
– heynnema
Dec 16 at 18:16
thanks, the code edit looks good, I will try, but in yoru comment you mixed things up (10.190.1.1 is the floating point, not 10.142.0.62). Question: can 10.142.0.62 be assigned by dhcp rather than to be statically declared in the config file? Reason I am asking is because conf file is saved on disk, so if in the future I will create disk snapshot and restore it can cause networking issue. no?
– justadev
Dec 16 at 19:26
|
show 2 more comments
First, your /etc/network/interfaces
is incorrect. You can't ask for "auth eth0" and then set a static address later.
auto eth0:0
iface eth0:0 inet static
address 10.190.1.1
netmask 255.255.255.255
If I understand what you're trying to do, then this netplan .yaml snippet is the minimum that you need...
network:
version: 2
renderer: networkd
ethernets:
ens4:
dhcp4: false
dhcp6: false
addresses:
- 10.142.0.62/24 # server #1, 10.142.0.63/24 for server #2
- 10.190.1.1/24 # floating IP in keepalived.conf
gateway4: 10.142.0.1
Assumptions:
- only one ethernet interface, ens4:
- if you have a multiport ethernet card, my .yaml needs additional code
- Ubuntu Server environment
- not using NetworkManager
only one ethernet interface, yes. ubuntu server, and not using NetworkManager as much as I know (how do I check?) The /etc/network/interfaces in the example is copy-paste from google official doc example in the OP. I tested it and it worked. What I don't understand in your answer is where did the floating IP disappeared (10.190.1.1). This is an explanation about floating/virtual ip docs.oracle.com/cd/E37670_01/E41138/html/…
– justadev
Dec 16 at 17:57
So there suppose to be two addresses from the ens4 nic: one static (10.142.0.62) and one virutal/floating (10.190.1.1) that is used for failover.
– justadev
Dec 16 at 17:59
@justadev No, from my understanding, the "floating/virtual IP" is configured in the keepalived .conf files. My .yaml snippet assigns an IP to the hardware in server #1. If 10.142.0.62 is your floating/virtual IP, that needs to go in keepalive, and server addresses could be... say... 10.142.0.2 and 10.142.0.3... and my .yaml would require a simple edit for those addresses on each server.
– heynnema
Dec 16 at 18:07
@justadev slight edit in my answer.
– heynnema
Dec 16 at 18:16
thanks, the code edit looks good, I will try, but in yoru comment you mixed things up (10.190.1.1 is the floating point, not 10.142.0.62). Question: can 10.142.0.62 be assigned by dhcp rather than to be statically declared in the config file? Reason I am asking is because conf file is saved on disk, so if in the future I will create disk snapshot and restore it can cause networking issue. no?
– justadev
Dec 16 at 19:26
|
show 2 more comments
First, your /etc/network/interfaces
is incorrect. You can't ask for "auth eth0" and then set a static address later.
auto eth0:0
iface eth0:0 inet static
address 10.190.1.1
netmask 255.255.255.255
If I understand what you're trying to do, then this netplan .yaml snippet is the minimum that you need...
network:
version: 2
renderer: networkd
ethernets:
ens4:
dhcp4: false
dhcp6: false
addresses:
- 10.142.0.62/24 # server #1, 10.142.0.63/24 for server #2
- 10.190.1.1/24 # floating IP in keepalived.conf
gateway4: 10.142.0.1
Assumptions:
- only one ethernet interface, ens4:
- if you have a multiport ethernet card, my .yaml needs additional code
- Ubuntu Server environment
- not using NetworkManager
First, your /etc/network/interfaces
is incorrect. You can't ask for "auth eth0" and then set a static address later.
auto eth0:0
iface eth0:0 inet static
address 10.190.1.1
netmask 255.255.255.255
If I understand what you're trying to do, then this netplan .yaml snippet is the minimum that you need...
network:
version: 2
renderer: networkd
ethernets:
ens4:
dhcp4: false
dhcp6: false
addresses:
- 10.142.0.62/24 # server #1, 10.142.0.63/24 for server #2
- 10.190.1.1/24 # floating IP in keepalived.conf
gateway4: 10.142.0.1
Assumptions:
- only one ethernet interface, ens4:
- if you have a multiport ethernet card, my .yaml needs additional code
- Ubuntu Server environment
- not using NetworkManager
edited Dec 16 at 19:36
answered Dec 16 at 17:42
heynnema
18.1k22054
18.1k22054
only one ethernet interface, yes. ubuntu server, and not using NetworkManager as much as I know (how do I check?) The /etc/network/interfaces in the example is copy-paste from google official doc example in the OP. I tested it and it worked. What I don't understand in your answer is where did the floating IP disappeared (10.190.1.1). This is an explanation about floating/virtual ip docs.oracle.com/cd/E37670_01/E41138/html/…
– justadev
Dec 16 at 17:57
So there suppose to be two addresses from the ens4 nic: one static (10.142.0.62) and one virutal/floating (10.190.1.1) that is used for failover.
– justadev
Dec 16 at 17:59
@justadev No, from my understanding, the "floating/virtual IP" is configured in the keepalived .conf files. My .yaml snippet assigns an IP to the hardware in server #1. If 10.142.0.62 is your floating/virtual IP, that needs to go in keepalive, and server addresses could be... say... 10.142.0.2 and 10.142.0.3... and my .yaml would require a simple edit for those addresses on each server.
– heynnema
Dec 16 at 18:07
@justadev slight edit in my answer.
– heynnema
Dec 16 at 18:16
thanks, the code edit looks good, I will try, but in yoru comment you mixed things up (10.190.1.1 is the floating point, not 10.142.0.62). Question: can 10.142.0.62 be assigned by dhcp rather than to be statically declared in the config file? Reason I am asking is because conf file is saved on disk, so if in the future I will create disk snapshot and restore it can cause networking issue. no?
– justadev
Dec 16 at 19:26
|
show 2 more comments
only one ethernet interface, yes. ubuntu server, and not using NetworkManager as much as I know (how do I check?) The /etc/network/interfaces in the example is copy-paste from google official doc example in the OP. I tested it and it worked. What I don't understand in your answer is where did the floating IP disappeared (10.190.1.1). This is an explanation about floating/virtual ip docs.oracle.com/cd/E37670_01/E41138/html/…
– justadev
Dec 16 at 17:57
So there suppose to be two addresses from the ens4 nic: one static (10.142.0.62) and one virutal/floating (10.190.1.1) that is used for failover.
– justadev
Dec 16 at 17:59
@justadev No, from my understanding, the "floating/virtual IP" is configured in the keepalived .conf files. My .yaml snippet assigns an IP to the hardware in server #1. If 10.142.0.62 is your floating/virtual IP, that needs to go in keepalive, and server addresses could be... say... 10.142.0.2 and 10.142.0.3... and my .yaml would require a simple edit for those addresses on each server.
– heynnema
Dec 16 at 18:07
@justadev slight edit in my answer.
– heynnema
Dec 16 at 18:16
thanks, the code edit looks good, I will try, but in yoru comment you mixed things up (10.190.1.1 is the floating point, not 10.142.0.62). Question: can 10.142.0.62 be assigned by dhcp rather than to be statically declared in the config file? Reason I am asking is because conf file is saved on disk, so if in the future I will create disk snapshot and restore it can cause networking issue. no?
– justadev
Dec 16 at 19:26
only one ethernet interface, yes. ubuntu server, and not using NetworkManager as much as I know (how do I check?) The /etc/network/interfaces in the example is copy-paste from google official doc example in the OP. I tested it and it worked. What I don't understand in your answer is where did the floating IP disappeared (10.190.1.1). This is an explanation about floating/virtual ip docs.oracle.com/cd/E37670_01/E41138/html/…
– justadev
Dec 16 at 17:57
only one ethernet interface, yes. ubuntu server, and not using NetworkManager as much as I know (how do I check?) The /etc/network/interfaces in the example is copy-paste from google official doc example in the OP. I tested it and it worked. What I don't understand in your answer is where did the floating IP disappeared (10.190.1.1). This is an explanation about floating/virtual ip docs.oracle.com/cd/E37670_01/E41138/html/…
– justadev
Dec 16 at 17:57
So there suppose to be two addresses from the ens4 nic: one static (10.142.0.62) and one virutal/floating (10.190.1.1) that is used for failover.
– justadev
Dec 16 at 17:59
So there suppose to be two addresses from the ens4 nic: one static (10.142.0.62) and one virutal/floating (10.190.1.1) that is used for failover.
– justadev
Dec 16 at 17:59
@justadev No, from my understanding, the "floating/virtual IP" is configured in the keepalived .conf files. My .yaml snippet assigns an IP to the hardware in server #1. If 10.142.0.62 is your floating/virtual IP, that needs to go in keepalive, and server addresses could be... say... 10.142.0.2 and 10.142.0.3... and my .yaml would require a simple edit for those addresses on each server.
– heynnema
Dec 16 at 18:07
@justadev No, from my understanding, the "floating/virtual IP" is configured in the keepalived .conf files. My .yaml snippet assigns an IP to the hardware in server #1. If 10.142.0.62 is your floating/virtual IP, that needs to go in keepalive, and server addresses could be... say... 10.142.0.2 and 10.142.0.3... and my .yaml would require a simple edit for those addresses on each server.
– heynnema
Dec 16 at 18:07
@justadev slight edit in my answer.
– heynnema
Dec 16 at 18:16
@justadev slight edit in my answer.
– heynnema
Dec 16 at 18:16
thanks, the code edit looks good, I will try, but in yoru comment you mixed things up (10.190.1.1 is the floating point, not 10.142.0.62). Question: can 10.142.0.62 be assigned by dhcp rather than to be statically declared in the config file? Reason I am asking is because conf file is saved on disk, so if in the future I will create disk snapshot and restore it can cause networking issue. no?
– justadev
Dec 16 at 19:26
thanks, the code edit looks good, I will try, but in yoru comment you mixed things up (10.190.1.1 is the floating point, not 10.142.0.62). Question: can 10.142.0.62 be assigned by dhcp rather than to be statically declared in the config file? Reason I am asking is because conf file is saved on disk, so if in the future I will create disk snapshot and restore it can cause networking issue. no?
– justadev
Dec 16 at 19:26
|
show 2 more comments
Seems like you cannot create eth0:0
Check this out: https://netplan.io/examples
Multiple addresses on an interface
network:
version: 2
renderer: networkd
ethernets:
enp3s0:
addresses:
- 10.100.1.38/24
- 10.100.1.39/24
gateway4: 10.100.1.1
Multiple gateways and multiple ips
network:
version: 2
renderer: networkd
ethernets:
enp3s0:
addresses:
- 9.0.0.9/24
- 10.0.0.10/24
- 11.0.0.11/24
#gateway4: # unset, since we configure routes below
routes:
- to: 0.0.0.0/0
via: 9.0.0.1
metric: 100
- to: 0.0.0.0/0
via: 10.0.0.1
metric: 100
- to: 0.0.0.0/0
via: 11.0.0.1
metric: 100
You may want to explain how to configurenetplan
to make use of the second IP address/alias?
– Thomas
Dec 16 at 12:35
You should add the relevant part to your answer, not in the comment.
– Thomas
Dec 16 at 13:28
add a comment |
Seems like you cannot create eth0:0
Check this out: https://netplan.io/examples
Multiple addresses on an interface
network:
version: 2
renderer: networkd
ethernets:
enp3s0:
addresses:
- 10.100.1.38/24
- 10.100.1.39/24
gateway4: 10.100.1.1
Multiple gateways and multiple ips
network:
version: 2
renderer: networkd
ethernets:
enp3s0:
addresses:
- 9.0.0.9/24
- 10.0.0.10/24
- 11.0.0.11/24
#gateway4: # unset, since we configure routes below
routes:
- to: 0.0.0.0/0
via: 9.0.0.1
metric: 100
- to: 0.0.0.0/0
via: 10.0.0.1
metric: 100
- to: 0.0.0.0/0
via: 11.0.0.1
metric: 100
You may want to explain how to configurenetplan
to make use of the second IP address/alias?
– Thomas
Dec 16 at 12:35
You should add the relevant part to your answer, not in the comment.
– Thomas
Dec 16 at 13:28
add a comment |
Seems like you cannot create eth0:0
Check this out: https://netplan.io/examples
Multiple addresses on an interface
network:
version: 2
renderer: networkd
ethernets:
enp3s0:
addresses:
- 10.100.1.38/24
- 10.100.1.39/24
gateway4: 10.100.1.1
Multiple gateways and multiple ips
network:
version: 2
renderer: networkd
ethernets:
enp3s0:
addresses:
- 9.0.0.9/24
- 10.0.0.10/24
- 11.0.0.11/24
#gateway4: # unset, since we configure routes below
routes:
- to: 0.0.0.0/0
via: 9.0.0.1
metric: 100
- to: 0.0.0.0/0
via: 10.0.0.1
metric: 100
- to: 0.0.0.0/0
via: 11.0.0.1
metric: 100
Seems like you cannot create eth0:0
Check this out: https://netplan.io/examples
Multiple addresses on an interface
network:
version: 2
renderer: networkd
ethernets:
enp3s0:
addresses:
- 10.100.1.38/24
- 10.100.1.39/24
gateway4: 10.100.1.1
Multiple gateways and multiple ips
network:
version: 2
renderer: networkd
ethernets:
enp3s0:
addresses:
- 9.0.0.9/24
- 10.0.0.10/24
- 11.0.0.11/24
#gateway4: # unset, since we configure routes below
routes:
- to: 0.0.0.0/0
via: 9.0.0.1
metric: 100
- to: 0.0.0.0/0
via: 10.0.0.1
metric: 100
- to: 0.0.0.0/0
via: 11.0.0.1
metric: 100
edited Dec 16 at 13:49
answered Dec 16 at 12:25
user3926766
12
12
You may want to explain how to configurenetplan
to make use of the second IP address/alias?
– Thomas
Dec 16 at 12:35
You should add the relevant part to your answer, not in the comment.
– Thomas
Dec 16 at 13:28
add a comment |
You may want to explain how to configurenetplan
to make use of the second IP address/alias?
– Thomas
Dec 16 at 12:35
You should add the relevant part to your answer, not in the comment.
– Thomas
Dec 16 at 13:28
You may want to explain how to configure
netplan
to make use of the second IP address/alias?– Thomas
Dec 16 at 12:35
You may want to explain how to configure
netplan
to make use of the second IP address/alias?– Thomas
Dec 16 at 12:35
You should add the relevant part to your answer, not in the comment.
– Thomas
Dec 16 at 13:28
You should add the relevant part to your answer, not in the comment.
– Thomas
Dec 16 at 13:28
add a comment |
Thanks for contributing an answer to Ask Ubuntu!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1102295%2fconvert-etc-network-interfaces-to-netplan-for-floating-ip%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Are you using Ubuntu Desktop or Ubuntu Server? When you say "floating IP", do you mean that you want a dynamic IP address, or a static IP address? Is eth0 or ens4 your ethernet device? Do you have multiple machines where you want failover?
– heynnema
Dec 16 at 16:51
I am using google cloud platform. The vm was generated with 'ens4' ethernet device. When creating the vm, I choose static ip (10.142.0.62), /etc/netplan/50-cloud-init.yaml was autogenerated. What I want to do is to add the floating ip as explained in option#4 in the link that is in the question.
– justadev
Dec 16 at 17:05