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 have a Ubuntu server with 128 ip's (static external ips 86.xx.xx.16), and I want to crawl pages thru different ip's. The gateway is xx.xxx.xxx.1, the main ip is xx.xxx.xxx.16, and the other 128 ip's are xx.xxx.xxx.129/255. I tried this configuration in /etc/network/interfaces but I doesn't work. It work if I remove the gateway for the aliases eth0:0 and eth0:1. I think this is routing problem.

auto lo
iface lo inet loopback

auto eth0
auto eth0:0
auto eth0:1

iface eth0 inet static
address xx.xxx.xxx.16
netmask 255.255.255.128
gateway xx.xxx.xxx.1

iface eth0:0 inet static
address xx.xxx.xxx.129
netmask 255.255.255.128
gateway xx.xxx.xxx.1

iface eth0:1 inet static
address xx.xxx.xxx.130
netmask 255.255.255.128
gateway xx.xxx.xxx.1

Also, please tell me how to "reset" every changes that I made in networking and routing.


Update:
I removed the gateway and now it works. I can reach the website thru all 128 ip's.

But when I try to bind a socket connection in php to a specific ip I get no answer.

socket_bind($sock, "xx.xxx.xx.xxx");
socket_connect($sock, 'google.com', 80);

I tryed to use a sniffer to see the packets, and I see the packet sent from binded ip to google.com but the "connection" can't be established.

I don't know anything about "route" command, but I have a feeling that this is the solution.

share|improve this question

3 Answers 3

It doesn't work because it's only one interface and one gateway... unless you want to do some thraffic sharing/balancing/... there should be just ONE default gateway.

What you want is BINDING whatever program you use to "crawl the web" to the wanted ip address.

just keep the gateway on eth0 and remove it from eth0:X and you should be good...

share|improve this answer
    
Yep that is good. But how to bind a program to wanted ip? –  Andrew Mar 19 '10 at 10:40

The problem is solved. My ISP rerouted the IPs and now works.

share|improve this answer

Just edit your question when you have a update, unless that update is actually an answer. You should delete this answer. I moved it to the question for you.

-Kyle

share|improve this answer

Your Answer

 
discard

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