default virtual network interface

Zulakis asked:

I got a single ethernet connection to a network but with multiple ips.
Because of this, I am using virtual network interfaces like this:

auto intern
iface intern inet static
        address ...
        netmask ...
        gateway ...

auto intern:1
iface intern:1 inet static
        address ...
        netmask ...
        gateway ...

I need to configure which IP should be used by default for outgoing traffic.

How can I do that?

My answer:


I need to configure which IP should be used by default for outgoing traffic.

Make it the first one listed in /etc/network/interfaces for that interface.

Example:

iface intern inet static
    address 198.51.100.30 # This one is it

View the full question and answer on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.