Ive got

eth0:0 (for bgp network announce, no vlan, alias on eth0)
eth0.1 (for bgp session 1,vlan3 transport to bgp router)
eth0.2 (for bgp session 2,vlan4 transport to bgp router)

default route is given by zebra ( or -- failover)

when external ip ( tries to connect to -> answered packets goes via (where source ip for this is This works correct. But i want source address to be Main problem is when asterisk is running on and clients try to register sip from -> answers are send from and packages are dropped on remote side .

How to fix/solve this? or is there any other way of configuration interfaces? Main idea is to switch routing for if one of bgp sessions goes down.

rp_filter=0 on all interfaces

If i put something like:

iptables -t nat -A POSTROUTING -d -j SNAT --to-source

this doesn't work either.

All the problem is that asterisk is behind nat in this scheme. if i run it on all interfaces -> sip client connects ok on and ip's , but not on one.

  • And where's loopback mentioned except the subject? – poige Aug 12 '12 at 11:38
  • «when external ip ( tryes to connect to -> answered packages goes via (where source ip for this is» — you're screwed with NAT, otherwise it wouldn't change IP-address. – poige Aug 12 '12 at 11:42
  • tryes → tries, packages → packets – poige Aug 12 '12 at 11:44
  • And finally I'd suggest drawing your network topology ;) – poige Aug 12 '12 at 11:45

lo on Linux is not the same as loopback on a Cisco.

Any address assigned to lo on Linux must be used solely for the machine to send traffic to itself; the kernel will consider any packet with a source IP that matches one assigned to lo as martian and will be dropped at ingress - this is hardcoded behaviour. The kernel does incidentally also use lo for sending traffic to itself for an IP on any other interface (so for example, if eth0 has and you ping it, a tcpdump on lo will show the echo request and reply)

For an equivalent to the Cisco style of a loopback interface, use the "dummy" kernel module - do be aware that the dummy module also acts as a sinkhole for traffic routed to it (like null0 on a Cisco) so any address you assign to it should be a /32 since obviously nothing will be on-link for a dummy interface.


Putting non-loopback addresses on the lo interface is bound to cause weirdness. I suggest that you attach to eth0 instead.

  • there is no difference. Ok. ive attached them on eth0:0 and eth0:1 aliases. Problem is the same. – MealstroM Jul 26 '12 at 7:11

Your Answer

By clicking "Post Your Answer", you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.