0

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?

3 Answers 3

0

You need to use the option -b src.ip.addr.ess. For other tools, you need to at the manual to check for the right option. Also, telnet and ssh use the same option -b.

5
  • I am not looking for all those interface options, but for a way I can set the DEFAULT for all network-connected tools.
    – Zulakis
    Sep 24, 2012 at 7:12
  • By default, each program/tool will use the "primary" interface address. I am not aware of a way to change this behavior globally unless you change this primary address.
    – Khaled
    Sep 24, 2012 at 7:29
  • How can I set the primary interface? What other effects could changing it have?
    – Zulakis
    Sep 24, 2012 at 8:18
  • the primary interface is the first interface it finds on the subnet, otherwise its the first interface it finds which is on the subnet where the gateway is.
    – Flash
    Sep 24, 2012 at 9:38
  • "It finds"... There must be a way on how to set this.
    – Zulakis
    Sep 24, 2012 at 10:24
0

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
3
  • This does not work. The second one (out of three) is getting used.
    – Zulakis
    Sep 24, 2012 at 18:11
  • OK, then please edit your question to provide a more realistic view of what your interfaces file looks like. Sep 24, 2012 at 18:12
  • It it not that different, just intern, intern:1 and intern:2 - intern:1 is getting used
    – Zulakis
    Sep 24, 2012 at 18:13
0

It looks like the first sub-interface (intern:1) of the first interfac eis getting used as default device. It's a little bit weird that not just the primary interface (intern) is getting used.

If anyone has a fix for this, feel free to post.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .