Hello,
(E-Mail Removed) a écrit :
> I have one physical interface eth0 with subinterfaces. All adresses of
> interfaces are from the same network. I have a serivce that listen on
> one of subinterfaces eth0:2 with ip 192.168.0.10 and everything is ok
> but the outgoing traffic from this service is via eth0 ip address
> 192.168.0.1.
Note : these are not subinterfaces but "IP aliases", i.e. multiple IP
addresses on a single interface.
> I want that this service to use eth0:2 ip address instead
> eth0 ip address.Is it possible to achive it without using iptables?
This may be possible through a configuration option of that service.
Otherwise, it may be possible to define that specific address as the
"primary" address on the interface, but this will be a system-wide
setting. If the outgoing communications are destined only to well-known
addresses, it may be possible to set specific routes to these
destinations using a specific default source address. But again, this is
a system-wide setting.