2 Subnets on 1 Lan

Mail List lists at sapience.com
Sat Jul 14 03:52:52 UTC 2007




On Friday 13 July 2007 08:32:52 am Thom Paine wrote:
> I have a small network that is 10.10.10.x and I have a few PLC devices
> that I'd like to be able to talk to that are on a 192.168.0.x segment.
>
> Can I put some sort of a route statement into my fedora server that
> will link these two so that I can talk to the 192 devices from my pc
> on my 10 network? I use my fedora box as my router and dhcp server.
>

 Yes - this is no problem at all. Here's how to do it.
 You can put these into a script and call it from /etc/rc.local

 #!/bin/bash
 # Script may be called from rc.local
 # FIrst off use the following to add an address to the device (say eth0).

 ip address add 192.168.0.1 dev eth1
 
# Now add a route if you need it.
ip ro add 192.168.1.0/24 via 192.168.0.1 dev eth0

# end script

# ------------------------------------------------------------
# Make sure you allow packets to be forwarded 
# ie this will now route between the 2 networks
# Add this line to /etc/sysctl.conf
net.ipv4.ip_forward = 1

# To have above take effect without a reboot do
sysctl -p

g/




More information about the users mailing list