S
S
Stanislav2018-02-04 23:54:48
linux
Stanislav, 2018-02-04 23:54:48

How to set up additional IP addresses?

This is the first time I've encountered this, I ask for help, because nothing happens
Initial config
/etc/network/interfaces

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
auto eth0
iface eth0 inet static
    address x.x.11.42
    netmask 255.255.255.0
    gateway x.x.11.1

    # add additional IP addresses this way
    # up ip address add xxx.xxx.xxx.xxx/XX dev eth0


iface eth0 inet6 static
    address ipv6.....
    netmask 64
    gateway x::1
    accept_ra 0
    autoconf 0
    privext 0

Ordered an additional IP from the host
IP xx29.26
Sent IP and data
Network: xx29.0
Gateway: xx29.1
Broadcast: xx29.255 Netmask
: 255.255.255.0
Prefix: /24
# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
auto eth0:1
iface eth0:1 inet static
    address x.x.11.42
    netmask 255.255.255.0
    gateway x.x11.1

auto eth0:2
iface eth0:2 inet static
    address x.x.29.26
    gateway x.x.29.1
    netmask 255.255.255.0


    # add additional IP addresses this way
    # up ip address add xxx.xxx.xxx.xxx/XX dev eth0


iface eth0 inet6 static
    address ipv6...
    netmask 64
    gateway ...::1
    accept_ra 0
    autoconf 0
    privext 0

Reboot, IP addresses are working, but service networking status shows an error
● networking.service - Raise network interfaces
   Loaded: loaded (/lib/systemd/system/networking.service; enabled; vendor preset: enabled)
   Active: failed (Result: exit-code) since Sun 2018-02-04 21:36:08 CET; 16min ago
     Docs: man:interfaces(5)
  Process: 618 ExecStart=/sbin/ifup -a --read-environment (code=exited, status=1/FAILURE)
  Process: 611 ExecStartPre=/bin/sh -c [ "$CONFIGURE_INTERFACES" != "no" ] && [ -n "$(ifquery --read-environment --list --exclude=lo)" ] && udevadm settle (code=exited, status=0/SUCCESS)
 Main PID: 618 (code=exited, status=1/FAILURE)

Feb 04 21:36:08 ....systemd[1]: Starting Raise network interfaces...
Feb 04 21:36:08 ....ifup[618]: RTNETLINK answers: File exists
Feb 04 21:36:08 ....ifup[618]: ifup: failed to bring up eth0:2
Feb 04 21:36:08 .... systemd[1]: networking.service: Main process exited, code=exited, status=1/FAILURE
Feb 04 21:36:08 .... systemd[1]: Failed to start Raise network interfaces.
Feb 04 21:36:08 .... systemd[1]: networking.service: Unit entered failed state.
Feb 04 21:36:08 ..... systemd[1]: networking.service: Failed with result 'exit-code'.

What am I doing wrong?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
K
ky0, 2018-02-05
@ms-dred

Why do you need a separate interface for the new address?

auto eth0
iface eth0 inet static
    address x.x.11.42
    netmask 255.255.255.0
    gateway x.x.11.1
    post-up ip addr add x.x.29.26/24 dev eth0
    pre-down ip addr del x.x.29.26/24 dev eth0

PS - right in your listing it says: "add additional IP addresses this way" :)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question