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?

Zulakis
  • 4,153
  • 14
  • 48
  • 76

3 Answers3

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.

Khaled
  • 36,533
  • 8
  • 72
  • 99
  • 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 '12 at 07: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 '12 at 07:29
  • How can I set the primary interface? What other effects could changing it have? – Zulakis Sep 24 '12 at 08: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 '12 at 09:38
  • "It finds"... There must be a way on how to set this. – Zulakis Sep 24 '12 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
Michael Hampton
  • 244,070
  • 43
  • 506
  • 972
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.

Zulakis
  • 4,153
  • 14
  • 48
  • 76