how to use IF aliases for outgoing packets?

I do have physical inteface if0
which is carrying several IPs
Code:
ifconfig_if0="inet xxx.xxx.xxx.xxx"
ifconfig_if0_alias0="inet yyy.yyy.yyy.yyy"
ifconfig_if0_alias1="inet zzz.zzz.zzz.zzz"
how can I manage the outgoing traffic to flow from different ips?

e.g. rinetd uses yyy.yyy.yyy.yyy
and postfix knocks out via zzz.zzz.zzz.zzz

now all goes through the first xxx
 
You cau use NAT in pf(). For example to map all outgoing traffic on port 25 to zzz.zzz.zzz.zzz:

Code:
nat on if0 proto tcp port = 25 -> zzz.zzz.zzz.zzz
 
Normaly you have to tell each application which IP they should bind to.

a few examples:
Code:
ping -S yyy.yyy.yyy.yyy www.example.com
Code:
traceroute -s yyy.yyy.yyy.yyy www.example.com
Code:
ssh -b yyy.yyy.yyy.yyy www.example.com
 
Back
Top