1

I am using a VMware photon OS VM.

I want to configure a secondary IP address for my eth0 interface. And following the lead in : How to configure interface aliases using Systemd-Networkd?

I added an additional Address and Gateway values as shown below:

[Match]
Name=eth0

[Network]
DHCP=no
Address=10.196.57.202/23
Gateway=10.196.57.253

Address=10.196.57.203/23
Gateway=10.196.57.253

DNS=10.202.22.165
LinkLocalAddressing=no
IPv6AcceptRA=no

202 is the primary and 203 is the secondary:

root@fgh-57-202 [ /etc/systemd/network ]# ip addr show
1: lo: <LOOPBACK,UP,LOWER_UP> 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
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
    link/ether 00:50:56:b8:8f:20 brd ff:ff:ff:ff:ff:ff
    inet 10.196.57.202/23 brd 10.196.57.255 scope global eth0
       valid_lft forever preferred_lft forever
    inet 10.196.57.203/23 brd 10.196.57.255 scope global secondary eth0
       valid_lft forever preferred_lft forever

However, after the reboot, the contents of the file : /etc/systemd/network/10-eth0.network Gets reset to:


[Match]
Name=eth0

[Network]
DHCP=no
Address=10.196.57.202/23
Gateway=10.196.57.253
DNS=10.202.22.165
LinkLocalAddressing=no
IPv6AcceptRA=no

I checked the dhclient.conf But cannot find anything suspicious:

root@fgh-57-202 [ /etc/systemd/network ]# cat /etc/dhcp/dhclient.conf
# Begin /etc/dhcp/dhclient.conf
#
# Basic dhclient.conf(5)

#prepend domain-name-servers 127.0.0.1;
request subnet-mask, broadcast-address, time-offset, routers,
        domain-name, domain-name-servers, domain-search, host-name,
        netbios-name-servers, netbios-scope, interface-mtu,
        ntp-servers;
require subnet-mask, domain-name-servers;
#timeout 60;
#retry 60;
#reboot 10;
#select-timeout 5;
#initial-interval 2;

# End /etc/dhcp/dhclient.conf

I am trying to get the secondary address to persist across reboots.

gkns
  • 111
  • 1
  • 5

0 Answers0