Routing / binding 128 IPs to one server

Posted by Andrew on Server Fault See other posts from Server Fault or by Andrew
Published on 2010-03-19T09:28:32Z Indexed on 2010/03/19 12:21 UTC
Read the original article Hit count: 268

Filed under:
|
|
|

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.

© Server Fault or respective owner

Related posts about ubuntu

Related posts about bind