Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I ran curl on, and I got the wrong output ip address. My systemd service file is:

Description=Wired Networking dibbler-client.service dibbler-client.service

ExecStart=/sbin/ip link set dev ${interface} up
ExecStart=/sbin/ip addr add ${address}/24 dev ${interface}
ExecStart=/sbin/ip addr add ${failover}/32 dev ${interface}
ExecStart=/sbin/ip route add default via ${gateway} src ${failover}
ExecStart=/sbin/ip -6 addr add ${addressv6}/64 dev ${interface}

ExecStop=/sbin/ip addr flush dev ${interface}
ExecStop=/sbin/ip -6 addr flush dev ${interface}
ExecStop=/sbin/ip link set dev ${interface} down


And variables are:


Now, ip addr give me:

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host
       valid_lft forever preferred_lft forever
2: eno1: <BROADCAST,MULTICAST,PROMISC,UP,LOWER_UP> mtu 1500 qdisc mq state UP qlen 1000
    link/ether b8:ac:6f:94:e2:4e brd ff:ff:ff:ff:ff:ff
    inet scope global eno1
       valid_lft forever preferred_lft forever
    inet scope global eno1
       valid_lft forever preferred_lft forever
    inet6 fe80::baac:6fff:fe94:e24e/64 scope link
       valid_lft forever preferred_lft forever

and ip route:

default via dev eno1  src dev eno1  proto kernel  scope link  src tell me that the output ip address is How can I change this output address and make it

EDIT: tested to change the src of the route to the gateway... No changes.


share|improve this question
Have you tried ip route add dev eno1 src What happens when you do, ip addr del dev eno1? – Daniel Widrick Sep 30 '13 at 12:35

It appears your provider is playing some dirty tricks with IP routing. The second IP address you are using is on a completely different network. Your dedibox is on AS12322, while your other IP address is registered to Tiscali on AS12876. This seems to work because the involved service providers are making it work.

Anyway, most programs that can make network connections have an option that lets you specify the source IP address. For the curl command line, that option is --interface.

curl --interface
share|improve this answer
curl --interface -> – Cubox Sep 29 '13 at 16:37
Better have a talk with your provider, then. They really do seem to be doing some funky stuff with your IP routing. – Michael Hampton Sep 29 '13 at 16:37
I don't see how the above implies they are doing funky stuff with routing. It seems to me that the provider simply has a route that says " goes to", so they route traffic to that IP via the network. If he sources his packets from, as it is configured to do, then they will come back to him just fine, no tricks or funny business. – Jed Daniels Sep 29 '13 at 21:13

From the configuration you've posted it looks like you are specifying as the source for your default route:

default via dev eno1  src

You should probably change that, or remove it.

EDIT: Apparently I misread the question and thought that was being used as the source IP. If I re-read it correctly, is actually being used as the source IP, and the desired behavior is to have used instead. To diagnose, we'll need more information, but my guess is that you are being affected by this bug: where ip route ... src is broken in the kernel.

share|improve this answer
Hum... There is no typo in thip ip address in every single conf file... I don't see what you want to say here... – Cubox Sep 29 '13 at 10:59
ExecStart=/sbin/ip route add default via ${gateway} src ${failover} <-- now why exactly are you surprised that the failover-IP is used as source? – Karma Fusebox Sep 29 '13 at 11:48
I'm not saying there is a typo, I'm saying that it is doing EXACTLY what it is configured to do: use source IP of when routing via the default route. If the question is "why is my traffic sourced from instead of", then the answer is "because it is configured that way, and your provider has a static route to send it back to you via". If you don't want it to do that, then change the configuration so it doesn't source from that IP. – Jed Daniels Sep 29 '13 at 21:14
But... Did you read it? I want as the source ip. Actually, it's and I don't know why. – Cubox Sep 30 '13 at 12:39
Apparently I misread it. I thought you were saying the opposite (which was reinforced by Karma's comment). I'll edit the answer appropriately. – Jed Daniels Sep 30 '13 at 14:24

As my dedicated provider told me,

I added this: -t nat -A POSTROUTING -o eno1 \! -d -j SNAT --to-source and everything is now fine :)

If you are hosted by, it's the only way.

share|improve this answer
See, they were doing dirty tricks with their IP routing after all. – Michael Hampton Sep 30 '13 at 14:44

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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