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

I want to visit a site through assigned IP address. I run the following commands:

ifconfig eth0:1 [ip address]
route add -host [the target host ip] dev eth0:1 gw [gateway]

This works fine on Ubuntu. But when I want to do the same on a Redhat AS4 server, it doesn't work. ping works for the new IP address, but after running route, the target site can't be visited. Anyone know the reason?

share|improve this question

migrated from stackoverflow.com Sep 18 '09 at 7:33

This question came from our site for professional and enthusiast programmers.

not programming - should be on superuser –  Timothy Pratley Sep 18 '09 at 7:22

2 Answers 2

Last time I checked route wasn't "aware" of interface aliases. For route eth0:1 == eth0.

The solution is to use the ip route command:

ifconfig eth0:1 [ip address]
ip route add [the target host ip]/32 via [gateway] dev eth0 src [ip address]

This command should do the trick. Make sure you're not using iptables MASQUERADE on the interface, it seems to conflict with these things.

share|improve this answer

It might help to use wireshark (http://www.wireshark.org/) and figure out, to what address the packets are being sent.

share|improve this answer

Your Answer


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