I'm trying to figure out a way to get my networking.service to work properly, so networking service restarts work.
How do I setup those 20 IP'S with 2 different Gateways but only 1 NIC? With 2 NIC's I wouldn't have any problem, but is that possible on 1 NIC?
This is what I get when I try to restart it by using systemctl restart networking.service
:
Feb 06 22:37:40 v4033 ifup[1276]: ifup: failed to bring up eth0:16
Feb 06 22:37:40 v4033 ifup[1276]: RTNETLINK answers: File exists
Feb 06 22:37:40 v4033 ifup[1276]: ifup: failed to bring up eth0:17
Feb 06 22:37:40 v4033 ifup[1276]: RTNETLINK answers: File exists
Feb 06 22:37:40 v4033 ifup[1276]: ifup: failed to bring up eth0:18
Feb 06 22:37:40 v4033 ifup[1276]: RTNETLINK answers: File exists
Feb 06 22:37:40 v4033 ifup[1276]: ifup: failed to bring up eth0:19
Feb 06 22:37:40 v4033 systemd[1]: networking.service: Main process exited, code=exited, status=1/FAILURE
Feb 06 22:37:40 v4033 systemd[1]: networking.service: Failed with result 'exit-code'.
Feb 06 22:37:40 v4033 systemd[1]: Failed to start Raise network interfaces.
A explanation of the IPS:
45.XX.XX.XX are the first IP's from subnet 1 with Gateway 45.XX.XX.1
5.XX.XX.XX are the second IP's subnet 2 with Gateway 5.XX.XX.1
My /etc/network/interfaces
looks like this:
source /etc/network/interfaces.d/*
# The loopback network interface
auto lo
iface lo inet loopback
# The primary network interface
auto eth0
iface eth0 inet static
address 45.XX.XX.XX
gateway 45.XX.XX.1
netmask 255.255.255.0
# dns-* options are implemented by the resolvconf package, if installed
dns-nameservers 8.8.8.8
auto eth0:1
iface eth0:1 inet static
address 45.XX.XX.XX
netmask 255.255.255.0
auto eth0:2
iface eth0:2 inet static
address 45.XX.XX.XX
netmask 255.255.255.0
auto eth0:3
iface eth0:3 inet static
address 45.XX.XX.XX
netmask 255.255.255.0
auto eth0:4
iface eth0:4 inet static
address 45.XX.XX.XX
netmask 255.255.255.0
auto eth0:5
iface eth0:5 inet static
address 45.XX.XX.XX
netmask 255.255.255.0
auto eth0:6
iface eth0:6 inet static
address 45.XX.XX.XX
netmask 255.255.255.0
auto eth0:7
iface eth0:7 inet static
address 45.XX.XX.XX
netmask 255.255.255.0
auto eth0:8
iface eth0:8 inet static
address 45.XX.XX.XX
netmask 255.255.255.0
auto eth0:9
iface eth0:9 inet static
address 45.XX.XX.XX
netmask 255.255.255.0
auto eth0:10
iface eth0:10 inet static
address 45.XX.XX.XX
netmask 255.255.255.0
auto eth0:11
iface eth0:11 inet static
address 45.XX.XX.XX
netmask 255.255.255.0
auto eth0:12
iface eth0:12 inet static
address 45.XX.XX.XX
netmask 255.255.255.0
auto eth0:13
iface eth0:13 inet static
address 5.XX.XX.XX
netmask 255.255.255.0
post-up ip route add 5.XX.XX.0/24 dev eth0:13 src 5.XX.XX.XX table rt2
post-up ip route add default via 5..XX.XX.1 dev eth0:13 table rt2
post-up ip rule add from 5.XX.XX.XX/32 table rt2
post-up ip rule add to 5.XX.XX.XX9/32 table rt2
auto eth0:14
iface eth0:14 inet static
address 5.XX.XX.XX
netmask 255.255.255.0
post-up ip route add 5.XX.XX.0/24 dev eth0:14 src 5.XX.XX.XX table rt2
post-up ip route add default via 5..XX.XX.XX.1 dev eth0:14 table rt2
post-up ip rule add from 5.XX.XX.XX/32 table rt2
post-up ip rule add to 5.XX.XX.XX/32 table rt2
auto eth0:15
iface eth0:15 inet static
address 5.XX.XX.XX
netmask 255.255.255.0
post-up ip route add 5.XX.XX.0/24 dev eth0:15 src 5.XX.XX.XX table rt2
post-up ip route add default via 5..XX.XX.XX.1 dev eth0:15 table rt2
post-up ip rule add from 5.XX.XX.XX/32 table rt2
post-up ip rule add to 5.XX.XX.XX/32 table rt2
auto eth0:16
iface eth0:16 inet static
address 5.XX.XX.XX
netmask 255.255.255.0
post-up ip route add 5.XX.XX.0/24 dev eth0:16 src 5.XX.XX.XX table rt2
post-up ip route add default via 5..XX.XX.XX.1 dev eth0:16 table rt2
post-up ip rule add from 5.XX.XX.XX/32 table rt2
post-up ip rule add to 5.XX.XX.XX/32 table rt2
auto eth0:17
iface eth0:17 inet static
address 5.XX.XX.XX
netmask 255.255.255.0
post-up ip route add 5.XX.XX.0/24 dev eth0:17 src 5.XX.XX.XX table rt2
post-up ip route add default via 5..XX.XX.XX.1 dev eth0:17 table rt2
post-up ip rule add from 5.XX.XX.XX/32 table rt2
post-up ip rule add to 5.XX.XX.XX/32 table rt2
auto eth0:18
iface eth0:18 inet static
address 5.XX.XX.XX
netmask 255.255.255.0
post-up ip route add 5.XX.XX.0/24 dev eth0:18 src 5.XX.XX.XX table rt2
post-up ip route add default via 5..XX.XX.XX.1 dev eth0:18 table rt2
post-up ip rule add from 5.XX.XX.XX/32 table rt2
post-up ip rule add to 5.XX.XX.XX/32 table rt2
auto eth0:19
iface eth0:19 inet static
address 5.XX.XX.XX
netmask 255.255.255.0
post-up ip route add 5.XX.XX.0/24 dev eth0:19 src 5.XX.XX.XX table rt2
post-up ip route add default via 5..XX.XX.XX.1 dev eth0:19 table rt2
post-up ip rule add from 5.XX.XX.XX/32 table rt2
post-up ip rule add to 5.XX.XX.XX/32 table rt2
And I have a /etc/iproute2/rt_tables
which looks like this:
#
# reserved values
#
255 local
254 main
253 default
0 unspec
#
# local
#
#1 inr.ruhep
1 rt2
Thanks in advance!