[SLL] Router config help needed

Robert Woodcock rcw at blarg.net
Tue Jun 19 20:05:56 PDT 2007


On Tue, Jun 19, 2007 at 10:09:21AM -0700, Ralph Sims wrote:
> I have set up a simple Linux router that I want to use to help test some
> applications.  Is there a simple way to assign a full private address block
> (176.16.0 /16) to eth0?  I need to be able to ping and traceroute to these
> addresses.  I can break the /16 into subnets to get around any limitation to
> the number of addresses I don't need to "route" these beyond the test box
> nor make them publicly available beyond the lab.

Ok, this is icky, but it works:

* Set up your eth0 network on something other than the target IP block (say
  the target is 172.16.0.0/16 - make your eth0 network 172.17.0.0/16 -
  configure eth0 to be 172.17.0.1)

* Set up the other lab machines on the eth0 network to use eth0's IP address
  as their gateway address. If you can't do this, add a route for the target
  subnet to each lab machine or to the existing default gateway system.

* Add a dummy interface (modprobe dummy) and give it an IP address in the
  target IP block (ip addr add 172.16.0.1/16 dev dummy0)

* At this point, you should be able to ping 172.16.0.1 from the other lab
  machines. If not, check firewall rules and perhaps turn IP forwarding on.

* iptables -t nat -A PREROUTING -d 172.16.0.0/16 -j DNAT --to 172.16.0.1

* You should now be able to ping 172.16.whatever.whatever from any lab
  machine.
-- 
Robert Woodcock - rcw at blarg.net
"I always make it a point to tell people that 'Halon' is French for
'Exit,' so if they ever get locked in the data center, they know how
to get out."
	-- seen on slashdot



More information about the linux-list mailing list