msgbartop
A chronological documentation test project, nothing serious, really!
msgbarbottom

19 May 2007 Linux routing magic

Posted by

Suppose you’re setting up a test environment, and you want a server to be able to handle some improbably large number of IP addresses, like a /16 or even larger. You could just write a script to add them all one at a time, or you could use this little shortcut and add the entire netblock at once:

# ip route add local 10.0.0.0/8 dev eth0 proto kernel scope host table local

That’ll make the entire 10/8 block local to the box. It’ll answer pings sent to any address in the 10.x.x.x space, and you can bind to any address in the netblock and use it as the source address for packets. For all intents and purposes, it’ll act just like the addresses were added with ip addr add or ifconfig.

Tags: ,

Comments are closed.