Debian 9.8 binding 2 mutliple IPs using Interfaces.dVirtual Box Bridged network w/ Static IP Win7 host Ubuntu...

How to not let the Identify spell spoil everything?

Could a warlock use the One with Shadows warlock invocation to turn invisible, and then move while staying invisible?

How vim overwrites readonly mode?

Book where a space ship journeys to the center of the galaxy to find all the stars had gone supernova

Renting a 2CV in France

Can we "borrow" our answers to populate our own websites?

Translation needed for 130 years old church document

Equivalent of "illegal" for violating civil law

Is there a verb that means to inject with poison?

What is the difference between "...", '...', $'...', and $"..." quotes?

Can a player sacrifice a creature after declaring that creature as blocker while taking lethal damage?

Critique vs nitpicking

Subsurf on a crown. How can I smooth some edges and keep others sharp?

Why didn't the 2019 Oscars have a host?

Does Skippy chunky peanut butter contain trans fat?

If angels and devils are the same species, why would their mortal offspring appear physically different?

Calculate of total length of edges in Voronoi diagram

Why is the "Domain users" group missing from this Powershell AD Query?

Describe a span of time of 1 or 2 years, without being too literal

How do I prevent a homebrew Grappling Hook feature from trivializing Tomb of Annihilation?

Which RAF squadrons and aircraft types took part in the bombing of Berlin on the 25th of August 1940?

Custom shape shows unwanted extra line

Does the US government have any planning in place to ensure there's no shortages of food, fuel, steel and other commodities?

When obtaining gender reassignment/plastic surgery overseas, is an emergency travel document required to return home?



Debian 9.8 binding 2 mutliple IPs using Interfaces.d


Virtual Box Bridged network w/ Static IP Win7 host Ubuntu GuestNetwork communication slowdown after setting gateway on linuxConfigure network Linux on VMware (Nat or Bridged)Wired Network Occasionally Fails (Debian)Set a gateway which is in another subnetDisabling NetworkManager on RHEL 7how to network between 2 ubuntu virtual machines (so that i can open a user via SSH from VM1 on VM2)Manually assign an IPCannot connect to internet in Kali LinuxInterconnecting two networks connected by two linux routers on Raspberry Pi













0















I am trying to set up 2 ip addresses on interface enp0s25. I am using 3 right now just for troubleshooting purposes.



Here is my setup
this is the content of /etc/network/interfaces.d/enp0s25



auto enp0s25
auto enp0s25:0
auto enp0s25:1

iface enp0s25 inet static
address 192.168.1.95
netmask 255.255.255.0
gateway 192.168.1.1
dns-nameservers 8.8.8.8 8.8.4.4

iface enp0s25:0 inet static
address 192.168.1.96
netmask 255.255.255.0
gateway 192.168.1.1
dns-nameservers 8.8.8.8 8.8.4.4

# This is the actual second ipaddress that I want
iface enp0s25:1 inet static
address 172.16.28.250
netmask 255.255.255.0
gateway 172.16.28.1
dns-nameservers 8.8.8.8 8.8.4.4


This is the contents of /etc/interfaces



# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

source /etc/network/interfaces.d/*

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
allow-hotplug enp0s25
# iface enp0s25 inet dhcp


When I do a sudo service network restart it fails
so then I do sudo service network status and I get



● networking.service - Raise network interfaces
Loaded: loaded (/lib/systemd/system/networking.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Mon 2019-02-25 15:15:37 EST; 3min 8s ago
Docs: man:interfaces(5)
Process: 481 ExecStart=/sbin/ifup -a --read-environment (code=exited, status=1/FAILURE)
Process: 477 ExecStartPre=/bin/sh -c [ "$CONFIGURE_INTERFACES" != "no" ] && [ -n "$(ifquery --read-environment --lis
Main PID: 481 (code=exited, status=1/FAILURE)

Feb 25 15:15:37 trmi-ral-server systemd[1]: Starting Raise network interfaces...
Feb 25 15:15:37 trmi-ral-server ifup[481]: RTNETLINK answers: File exists
Feb 25 15:15:37 trmi-ral-server ifup[481]: ifup: failed to bring up enp0s25:0
Feb 25 15:15:37 trmi-ral-server ifup[481]: RTNETLINK answers: File exists
Feb 25 15:15:37 trmi-ral-server ifup[481]: ifup: failed to bring up enp0s25:1
Feb 25 15:15:37 trmi-ral-server systemd[1]: networking.service: Main process exited, code=exited, status=1/FAILURE
Feb 25 15:15:37 trmi-ral-server systemd[1]: Failed to start Raise network interfaces.
Feb 25 15:15:37 trmi-ral-server systemd[1]: networking.service: Unit entered failed state.
Feb 25 15:15:37 trmi-ral-server systemd[1]: networking.service: Failed with result 'exit-code'.


but if I restart, then they work.



ip address shows them all assigned.



I can ping them from another computer on both networks (swapping the ethernet cable between them)



But, service networking status still shows that it is failed.



how can I have networking not running but actually have network connectivity?










share|improve this question























  • Try using :0, :1 and :2, not <blank> and :0?

    – djsmiley2k
    6 hours ago











  • Try not using :numbers at all? They're a 15-year-old relic.

    – grawity
    6 hours ago
















0















I am trying to set up 2 ip addresses on interface enp0s25. I am using 3 right now just for troubleshooting purposes.



Here is my setup
this is the content of /etc/network/interfaces.d/enp0s25



auto enp0s25
auto enp0s25:0
auto enp0s25:1

iface enp0s25 inet static
address 192.168.1.95
netmask 255.255.255.0
gateway 192.168.1.1
dns-nameservers 8.8.8.8 8.8.4.4

iface enp0s25:0 inet static
address 192.168.1.96
netmask 255.255.255.0
gateway 192.168.1.1
dns-nameservers 8.8.8.8 8.8.4.4

# This is the actual second ipaddress that I want
iface enp0s25:1 inet static
address 172.16.28.250
netmask 255.255.255.0
gateway 172.16.28.1
dns-nameservers 8.8.8.8 8.8.4.4


This is the contents of /etc/interfaces



# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

source /etc/network/interfaces.d/*

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
allow-hotplug enp0s25
# iface enp0s25 inet dhcp


When I do a sudo service network restart it fails
so then I do sudo service network status and I get



● networking.service - Raise network interfaces
Loaded: loaded (/lib/systemd/system/networking.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Mon 2019-02-25 15:15:37 EST; 3min 8s ago
Docs: man:interfaces(5)
Process: 481 ExecStart=/sbin/ifup -a --read-environment (code=exited, status=1/FAILURE)
Process: 477 ExecStartPre=/bin/sh -c [ "$CONFIGURE_INTERFACES" != "no" ] && [ -n "$(ifquery --read-environment --lis
Main PID: 481 (code=exited, status=1/FAILURE)

Feb 25 15:15:37 trmi-ral-server systemd[1]: Starting Raise network interfaces...
Feb 25 15:15:37 trmi-ral-server ifup[481]: RTNETLINK answers: File exists
Feb 25 15:15:37 trmi-ral-server ifup[481]: ifup: failed to bring up enp0s25:0
Feb 25 15:15:37 trmi-ral-server ifup[481]: RTNETLINK answers: File exists
Feb 25 15:15:37 trmi-ral-server ifup[481]: ifup: failed to bring up enp0s25:1
Feb 25 15:15:37 trmi-ral-server systemd[1]: networking.service: Main process exited, code=exited, status=1/FAILURE
Feb 25 15:15:37 trmi-ral-server systemd[1]: Failed to start Raise network interfaces.
Feb 25 15:15:37 trmi-ral-server systemd[1]: networking.service: Unit entered failed state.
Feb 25 15:15:37 trmi-ral-server systemd[1]: networking.service: Failed with result 'exit-code'.


but if I restart, then they work.



ip address shows them all assigned.



I can ping them from another computer on both networks (swapping the ethernet cable between them)



But, service networking status still shows that it is failed.



how can I have networking not running but actually have network connectivity?










share|improve this question























  • Try using :0, :1 and :2, not <blank> and :0?

    – djsmiley2k
    6 hours ago











  • Try not using :numbers at all? They're a 15-year-old relic.

    – grawity
    6 hours ago














0












0








0








I am trying to set up 2 ip addresses on interface enp0s25. I am using 3 right now just for troubleshooting purposes.



Here is my setup
this is the content of /etc/network/interfaces.d/enp0s25



auto enp0s25
auto enp0s25:0
auto enp0s25:1

iface enp0s25 inet static
address 192.168.1.95
netmask 255.255.255.0
gateway 192.168.1.1
dns-nameservers 8.8.8.8 8.8.4.4

iface enp0s25:0 inet static
address 192.168.1.96
netmask 255.255.255.0
gateway 192.168.1.1
dns-nameservers 8.8.8.8 8.8.4.4

# This is the actual second ipaddress that I want
iface enp0s25:1 inet static
address 172.16.28.250
netmask 255.255.255.0
gateway 172.16.28.1
dns-nameservers 8.8.8.8 8.8.4.4


This is the contents of /etc/interfaces



# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

source /etc/network/interfaces.d/*

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
allow-hotplug enp0s25
# iface enp0s25 inet dhcp


When I do a sudo service network restart it fails
so then I do sudo service network status and I get



● networking.service - Raise network interfaces
Loaded: loaded (/lib/systemd/system/networking.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Mon 2019-02-25 15:15:37 EST; 3min 8s ago
Docs: man:interfaces(5)
Process: 481 ExecStart=/sbin/ifup -a --read-environment (code=exited, status=1/FAILURE)
Process: 477 ExecStartPre=/bin/sh -c [ "$CONFIGURE_INTERFACES" != "no" ] && [ -n "$(ifquery --read-environment --lis
Main PID: 481 (code=exited, status=1/FAILURE)

Feb 25 15:15:37 trmi-ral-server systemd[1]: Starting Raise network interfaces...
Feb 25 15:15:37 trmi-ral-server ifup[481]: RTNETLINK answers: File exists
Feb 25 15:15:37 trmi-ral-server ifup[481]: ifup: failed to bring up enp0s25:0
Feb 25 15:15:37 trmi-ral-server ifup[481]: RTNETLINK answers: File exists
Feb 25 15:15:37 trmi-ral-server ifup[481]: ifup: failed to bring up enp0s25:1
Feb 25 15:15:37 trmi-ral-server systemd[1]: networking.service: Main process exited, code=exited, status=1/FAILURE
Feb 25 15:15:37 trmi-ral-server systemd[1]: Failed to start Raise network interfaces.
Feb 25 15:15:37 trmi-ral-server systemd[1]: networking.service: Unit entered failed state.
Feb 25 15:15:37 trmi-ral-server systemd[1]: networking.service: Failed with result 'exit-code'.


but if I restart, then they work.



ip address shows them all assigned.



I can ping them from another computer on both networks (swapping the ethernet cable between them)



But, service networking status still shows that it is failed.



how can I have networking not running but actually have network connectivity?










share|improve this question














I am trying to set up 2 ip addresses on interface enp0s25. I am using 3 right now just for troubleshooting purposes.



Here is my setup
this is the content of /etc/network/interfaces.d/enp0s25



auto enp0s25
auto enp0s25:0
auto enp0s25:1

iface enp0s25 inet static
address 192.168.1.95
netmask 255.255.255.0
gateway 192.168.1.1
dns-nameservers 8.8.8.8 8.8.4.4

iface enp0s25:0 inet static
address 192.168.1.96
netmask 255.255.255.0
gateway 192.168.1.1
dns-nameservers 8.8.8.8 8.8.4.4

# This is the actual second ipaddress that I want
iface enp0s25:1 inet static
address 172.16.28.250
netmask 255.255.255.0
gateway 172.16.28.1
dns-nameservers 8.8.8.8 8.8.4.4


This is the contents of /etc/interfaces



# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

source /etc/network/interfaces.d/*

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
allow-hotplug enp0s25
# iface enp0s25 inet dhcp


When I do a sudo service network restart it fails
so then I do sudo service network status and I get



● networking.service - Raise network interfaces
Loaded: loaded (/lib/systemd/system/networking.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Mon 2019-02-25 15:15:37 EST; 3min 8s ago
Docs: man:interfaces(5)
Process: 481 ExecStart=/sbin/ifup -a --read-environment (code=exited, status=1/FAILURE)
Process: 477 ExecStartPre=/bin/sh -c [ "$CONFIGURE_INTERFACES" != "no" ] && [ -n "$(ifquery --read-environment --lis
Main PID: 481 (code=exited, status=1/FAILURE)

Feb 25 15:15:37 trmi-ral-server systemd[1]: Starting Raise network interfaces...
Feb 25 15:15:37 trmi-ral-server ifup[481]: RTNETLINK answers: File exists
Feb 25 15:15:37 trmi-ral-server ifup[481]: ifup: failed to bring up enp0s25:0
Feb 25 15:15:37 trmi-ral-server ifup[481]: RTNETLINK answers: File exists
Feb 25 15:15:37 trmi-ral-server ifup[481]: ifup: failed to bring up enp0s25:1
Feb 25 15:15:37 trmi-ral-server systemd[1]: networking.service: Main process exited, code=exited, status=1/FAILURE
Feb 25 15:15:37 trmi-ral-server systemd[1]: Failed to start Raise network interfaces.
Feb 25 15:15:37 trmi-ral-server systemd[1]: networking.service: Unit entered failed state.
Feb 25 15:15:37 trmi-ral-server systemd[1]: networking.service: Failed with result 'exit-code'.


but if I restart, then they work.



ip address shows them all assigned.



I can ping them from another computer on both networks (swapping the ethernet cable between them)



But, service networking status still shows that it is failed.



how can I have networking not running but actually have network connectivity?







networking debian






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked 6 hours ago









TheColonel26TheColonel26

1129




1129













  • Try using :0, :1 and :2, not <blank> and :0?

    – djsmiley2k
    6 hours ago











  • Try not using :numbers at all? They're a 15-year-old relic.

    – grawity
    6 hours ago



















  • Try using :0, :1 and :2, not <blank> and :0?

    – djsmiley2k
    6 hours ago











  • Try not using :numbers at all? They're a 15-year-old relic.

    – grawity
    6 hours ago

















Try using :0, :1 and :2, not <blank> and :0?

– djsmiley2k
6 hours ago





Try using :0, :1 and :2, not <blank> and :0?

– djsmiley2k
6 hours ago













Try not using :numbers at all? They're a 15-year-old relic.

– grawity
6 hours ago





Try not using :numbers at all? They're a 15-year-old relic.

– grawity
6 hours ago










1 Answer
1






active

oldest

votes


















1















service networking status still shows that it is failed.




The program doesn't tell you, but the failure message has nothing to do with your addresses; it is actually failing because you told it to configure the same route twice.



Yes, you can have two routes for the same network as long as they go over different interfaces. But you don't really have different interfaces; all you have is 3 entries for the same "enp0s25" interface. There is no such thing as "alias interfaces".



So your configuration file translates to these commands:



ip addr add 192.168.1.95/24 dev enp0s25
ip route add 0.0.0.0/0 via 192.168.1.1 dev enp0s25

ip addr add 192.168.1.96/24 dev enp0s25
ip route add 0.0.0.0/0 via 192.168.1.1 dev enp0s25

ip addr add 172.16.28.250/24 dev enp0s25
ip route add 0.0.0.0/0 via 172.16.28.1 dev enp0s25


Notice that the configuration asks the route for 0.0.0.0/0 ... dev enp0s25 to be added twice. The first attempt succeeds and gives you connectivity, the second attempt fails and crashes ifupdown (networking.service), the third attempt would do the same as well.



To avoid this, remove all gateway... lines except one.



(Note: Linux, by default, does not support per-subnet IPv4 gateways – if you add multiple default routes, it will just pick one and use it for everything, even if it's for the "wrong" subnet. So if 192.168.1.1 and 172.16.28.1 belong to the same router, you don't actually need to add both.)



The file, updated for Debian 9 syntax, would look like:



auto enp0s25

iface enp0s25 inet static
address 192.168.1.95/24
gateway 192.168.1.1
dns-nameservers 8.8.8.8 8.8.4.4

iface enp0s25 inet static
address 192.168.1.96/24

iface enp0s25 inet static
address 172.16.28.250/24



how can I have networking not running but actually have network connectivity?




It's never "running" in the first place. It's just a script that configures the IP addresses and exits, and that's all it does. The network is handled entirely by the Linux kernel itself.






share|improve this answer


























  • what if the networks are not sharing a route and I simply want to be able to move it between the networks (my physically moving the ethernet cable. Then would it make sense to have a gateway for 172.16.28 address? or would Linux just always pick the first one?

    – TheColonel26
    6 hours ago











  • It picks the one with lowest metric (which is kind of a "cost" parameter). To really have multiple gateways you'd need policy routing via ip rule (or alternatively, in IPv6 only, source-specific routing)... or it'd be much better to keep the network profiles separate.

    – grawity
    5 hours ago













Your Answer








StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "3"
};
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
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1409364%2fdebian-9-8-binding-2-mutliple-ips-using-interfaces-d%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









1















service networking status still shows that it is failed.




The program doesn't tell you, but the failure message has nothing to do with your addresses; it is actually failing because you told it to configure the same route twice.



Yes, you can have two routes for the same network as long as they go over different interfaces. But you don't really have different interfaces; all you have is 3 entries for the same "enp0s25" interface. There is no such thing as "alias interfaces".



So your configuration file translates to these commands:



ip addr add 192.168.1.95/24 dev enp0s25
ip route add 0.0.0.0/0 via 192.168.1.1 dev enp0s25

ip addr add 192.168.1.96/24 dev enp0s25
ip route add 0.0.0.0/0 via 192.168.1.1 dev enp0s25

ip addr add 172.16.28.250/24 dev enp0s25
ip route add 0.0.0.0/0 via 172.16.28.1 dev enp0s25


Notice that the configuration asks the route for 0.0.0.0/0 ... dev enp0s25 to be added twice. The first attempt succeeds and gives you connectivity, the second attempt fails and crashes ifupdown (networking.service), the third attempt would do the same as well.



To avoid this, remove all gateway... lines except one.



(Note: Linux, by default, does not support per-subnet IPv4 gateways – if you add multiple default routes, it will just pick one and use it for everything, even if it's for the "wrong" subnet. So if 192.168.1.1 and 172.16.28.1 belong to the same router, you don't actually need to add both.)



The file, updated for Debian 9 syntax, would look like:



auto enp0s25

iface enp0s25 inet static
address 192.168.1.95/24
gateway 192.168.1.1
dns-nameservers 8.8.8.8 8.8.4.4

iface enp0s25 inet static
address 192.168.1.96/24

iface enp0s25 inet static
address 172.16.28.250/24



how can I have networking not running but actually have network connectivity?




It's never "running" in the first place. It's just a script that configures the IP addresses and exits, and that's all it does. The network is handled entirely by the Linux kernel itself.






share|improve this answer


























  • what if the networks are not sharing a route and I simply want to be able to move it between the networks (my physically moving the ethernet cable. Then would it make sense to have a gateway for 172.16.28 address? or would Linux just always pick the first one?

    – TheColonel26
    6 hours ago











  • It picks the one with lowest metric (which is kind of a "cost" parameter). To really have multiple gateways you'd need policy routing via ip rule (or alternatively, in IPv6 only, source-specific routing)... or it'd be much better to keep the network profiles separate.

    – grawity
    5 hours ago


















1















service networking status still shows that it is failed.




The program doesn't tell you, but the failure message has nothing to do with your addresses; it is actually failing because you told it to configure the same route twice.



Yes, you can have two routes for the same network as long as they go over different interfaces. But you don't really have different interfaces; all you have is 3 entries for the same "enp0s25" interface. There is no such thing as "alias interfaces".



So your configuration file translates to these commands:



ip addr add 192.168.1.95/24 dev enp0s25
ip route add 0.0.0.0/0 via 192.168.1.1 dev enp0s25

ip addr add 192.168.1.96/24 dev enp0s25
ip route add 0.0.0.0/0 via 192.168.1.1 dev enp0s25

ip addr add 172.16.28.250/24 dev enp0s25
ip route add 0.0.0.0/0 via 172.16.28.1 dev enp0s25


Notice that the configuration asks the route for 0.0.0.0/0 ... dev enp0s25 to be added twice. The first attempt succeeds and gives you connectivity, the second attempt fails and crashes ifupdown (networking.service), the third attempt would do the same as well.



To avoid this, remove all gateway... lines except one.



(Note: Linux, by default, does not support per-subnet IPv4 gateways – if you add multiple default routes, it will just pick one and use it for everything, even if it's for the "wrong" subnet. So if 192.168.1.1 and 172.16.28.1 belong to the same router, you don't actually need to add both.)



The file, updated for Debian 9 syntax, would look like:



auto enp0s25

iface enp0s25 inet static
address 192.168.1.95/24
gateway 192.168.1.1
dns-nameservers 8.8.8.8 8.8.4.4

iface enp0s25 inet static
address 192.168.1.96/24

iface enp0s25 inet static
address 172.16.28.250/24



how can I have networking not running but actually have network connectivity?




It's never "running" in the first place. It's just a script that configures the IP addresses and exits, and that's all it does. The network is handled entirely by the Linux kernel itself.






share|improve this answer


























  • what if the networks are not sharing a route and I simply want to be able to move it between the networks (my physically moving the ethernet cable. Then would it make sense to have a gateway for 172.16.28 address? or would Linux just always pick the first one?

    – TheColonel26
    6 hours ago











  • It picks the one with lowest metric (which is kind of a "cost" parameter). To really have multiple gateways you'd need policy routing via ip rule (or alternatively, in IPv6 only, source-specific routing)... or it'd be much better to keep the network profiles separate.

    – grawity
    5 hours ago
















1












1








1








service networking status still shows that it is failed.




The program doesn't tell you, but the failure message has nothing to do with your addresses; it is actually failing because you told it to configure the same route twice.



Yes, you can have two routes for the same network as long as they go over different interfaces. But you don't really have different interfaces; all you have is 3 entries for the same "enp0s25" interface. There is no such thing as "alias interfaces".



So your configuration file translates to these commands:



ip addr add 192.168.1.95/24 dev enp0s25
ip route add 0.0.0.0/0 via 192.168.1.1 dev enp0s25

ip addr add 192.168.1.96/24 dev enp0s25
ip route add 0.0.0.0/0 via 192.168.1.1 dev enp0s25

ip addr add 172.16.28.250/24 dev enp0s25
ip route add 0.0.0.0/0 via 172.16.28.1 dev enp0s25


Notice that the configuration asks the route for 0.0.0.0/0 ... dev enp0s25 to be added twice. The first attempt succeeds and gives you connectivity, the second attempt fails and crashes ifupdown (networking.service), the third attempt would do the same as well.



To avoid this, remove all gateway... lines except one.



(Note: Linux, by default, does not support per-subnet IPv4 gateways – if you add multiple default routes, it will just pick one and use it for everything, even if it's for the "wrong" subnet. So if 192.168.1.1 and 172.16.28.1 belong to the same router, you don't actually need to add both.)



The file, updated for Debian 9 syntax, would look like:



auto enp0s25

iface enp0s25 inet static
address 192.168.1.95/24
gateway 192.168.1.1
dns-nameservers 8.8.8.8 8.8.4.4

iface enp0s25 inet static
address 192.168.1.96/24

iface enp0s25 inet static
address 172.16.28.250/24



how can I have networking not running but actually have network connectivity?




It's never "running" in the first place. It's just a script that configures the IP addresses and exits, and that's all it does. The network is handled entirely by the Linux kernel itself.






share|improve this answer
















service networking status still shows that it is failed.




The program doesn't tell you, but the failure message has nothing to do with your addresses; it is actually failing because you told it to configure the same route twice.



Yes, you can have two routes for the same network as long as they go over different interfaces. But you don't really have different interfaces; all you have is 3 entries for the same "enp0s25" interface. There is no such thing as "alias interfaces".



So your configuration file translates to these commands:



ip addr add 192.168.1.95/24 dev enp0s25
ip route add 0.0.0.0/0 via 192.168.1.1 dev enp0s25

ip addr add 192.168.1.96/24 dev enp0s25
ip route add 0.0.0.0/0 via 192.168.1.1 dev enp0s25

ip addr add 172.16.28.250/24 dev enp0s25
ip route add 0.0.0.0/0 via 172.16.28.1 dev enp0s25


Notice that the configuration asks the route for 0.0.0.0/0 ... dev enp0s25 to be added twice. The first attempt succeeds and gives you connectivity, the second attempt fails and crashes ifupdown (networking.service), the third attempt would do the same as well.



To avoid this, remove all gateway... lines except one.



(Note: Linux, by default, does not support per-subnet IPv4 gateways – if you add multiple default routes, it will just pick one and use it for everything, even if it's for the "wrong" subnet. So if 192.168.1.1 and 172.16.28.1 belong to the same router, you don't actually need to add both.)



The file, updated for Debian 9 syntax, would look like:



auto enp0s25

iface enp0s25 inet static
address 192.168.1.95/24
gateway 192.168.1.1
dns-nameservers 8.8.8.8 8.8.4.4

iface enp0s25 inet static
address 192.168.1.96/24

iface enp0s25 inet static
address 172.16.28.250/24



how can I have networking not running but actually have network connectivity?




It's never "running" in the first place. It's just a script that configures the IP addresses and exits, and that's all it does. The network is handled entirely by the Linux kernel itself.







share|improve this answer














share|improve this answer



share|improve this answer








edited 6 hours ago

























answered 6 hours ago









grawitygrawity

239k37506561




239k37506561













  • what if the networks are not sharing a route and I simply want to be able to move it between the networks (my physically moving the ethernet cable. Then would it make sense to have a gateway for 172.16.28 address? or would Linux just always pick the first one?

    – TheColonel26
    6 hours ago











  • It picks the one with lowest metric (which is kind of a "cost" parameter). To really have multiple gateways you'd need policy routing via ip rule (or alternatively, in IPv6 only, source-specific routing)... or it'd be much better to keep the network profiles separate.

    – grawity
    5 hours ago





















  • what if the networks are not sharing a route and I simply want to be able to move it between the networks (my physically moving the ethernet cable. Then would it make sense to have a gateway for 172.16.28 address? or would Linux just always pick the first one?

    – TheColonel26
    6 hours ago











  • It picks the one with lowest metric (which is kind of a "cost" parameter). To really have multiple gateways you'd need policy routing via ip rule (or alternatively, in IPv6 only, source-specific routing)... or it'd be much better to keep the network profiles separate.

    – grawity
    5 hours ago



















what if the networks are not sharing a route and I simply want to be able to move it between the networks (my physically moving the ethernet cable. Then would it make sense to have a gateway for 172.16.28 address? or would Linux just always pick the first one?

– TheColonel26
6 hours ago





what if the networks are not sharing a route and I simply want to be able to move it between the networks (my physically moving the ethernet cable. Then would it make sense to have a gateway for 172.16.28 address? or would Linux just always pick the first one?

– TheColonel26
6 hours ago













It picks the one with lowest metric (which is kind of a "cost" parameter). To really have multiple gateways you'd need policy routing via ip rule (or alternatively, in IPv6 only, source-specific routing)... or it'd be much better to keep the network profiles separate.

– grawity
5 hours ago







It picks the one with lowest metric (which is kind of a "cost" parameter). To really have multiple gateways you'd need policy routing via ip rule (or alternatively, in IPv6 only, source-specific routing)... or it'd be much better to keep the network profiles separate.

– grawity
5 hours ago




















draft saved

draft discarded




















































Thanks for contributing an answer to Super User!


  • 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.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1409364%2fdebian-9-8-binding-2-mutliple-ips-using-interfaces-d%23new-answer', 'question_page');
}
);

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







Popular posts from this blog

VNC viewer RFB protocol error: bad desktop size 0x0I Cannot Type the Key 'd' (lowercase) in VNC Viewer...

Tribunal Administrativo e Fiscal de Mirandela Referências Menu de...

looking for continuous Screen Capture for retroactivly reproducing errors, timeback machineRolling desktop...