Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I would like to manually set up routing to subnet 95.168.0.0/16 through IP which is an alias: 94.23.94.161. IP alias is set up like that:

 /sbin/ifconfig eth0:0 94.23.94.161 netmask 255.255.255.255 broadcast 94.23.94.161

At the beginning i tried something like that:

route add -net 95.168.0.0 netmask 255.255.0.0 gw 94.23.94.161 dev eth0

and everything worked just fine, until i got an email from my datacenter that IP address is sending wrong ARP packets:

Wed Jun 6 08:07:15 2012 : arp who-has 95.168.204.130 tell 94.23.94.161
Wed Jun 6 08:37:13 2012 : arp who-has 95.168.204.130 tell 94.23.94.161
Wed Jun 6 09:07:19 2012 : arp who-has 95.168.204.130 tell 94.23.94.161

Conversation with their support went to nothing and now i'm still trying to fix that. Another setup which worked (but still was sending these wrong ARP packets) was:

ip route add 95.168.0.0/16 via 94.23.94.161

i think this one internally worked just the same.

Next i tried configuring routing through iptables and SNAT. I enabled ip-forwarding and tried different crazy stuff like:

iptables -t nat -A POSTROUTING -s 94.23.94.161 -o eth0 -j SNAT --to-source 95.168.0.0-95.168.255.255
iptables -t nat -A POSTROUTING -s 94.23.94.161 -o eth0 -j SNAT --to-source 95.168.0.0-95.168.255.254
iptables -t nat -A POSTROUTING -s 95.168.0.0/16 -o eth0 -j SNAT --to 94.23.94.161
iptables -t nat -A PREROUTING -p tcp -d 94.23.94.161 -j DNAT --to-destination 95.168.0.0-95.168.255.254

None of these changed routing. Could anyone give me any sort of advice how to change route to this subnet without sending spare/wrong ARP packets?

share|improve this question
    
I don't understand what you're trying to do. Where would you like packets bound for 95.168.204.130 to go? (Your machine is sending the ARP packets because it has no idea which machine to send those packets to. How is it supposed to know?) Is 94.23.94.161 assigned to this machine? –  David Schwartz Jul 29 '12 at 11:20

2 Answers 2

As I understand your question, 94.23.94.161 is the IP address of some machine on your LAN that you want to route packets bound for 95.168.0.0/16 to. If that's correct, either of your two route statements will do the job. Just get rid of the aliased eth0:0 interface. That's for local IP addresses assigned to this machine.

share|improve this answer
    
If i undestand you correctly, you suggest removing the alias... I can't do that because this alias is one of my additional IP addresses ("ip failover" technology of OVH - ovh.co.uk/dedicated_servers/ip_failover.xml help.ovh.co.uk/IpFailover) –  WMP Jul 29 '12 at 19:04
    
Oh, then it should be assigned to a loopback interface, not an Ethernet interface. –  David Schwartz Jul 29 '12 at 19:27
up vote 0 down vote accepted
ip addr add 94.23.94.161/32 brd 94.23.94.161 dev eth0
ip route add 95.168.0.0/16 src 94.23.94.161 via 176.31.243.253
ip neigth flush

Where 176.31.243.253 is gateway

share|improve this answer

Your Answer

 
discard

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.