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 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 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

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 ( 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.