Re: 2 Subnets on 1 Lan

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Mail List wrote:
> 
> 
> 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/
> 
A couple of questions - first, why would you need to forward
anything between the two subnets when they are on the same LAN?
Unless this machine is the default gateway, aren't you are going to
have to add a route on any other machine in the 10.10.10.x network
anyway? Or are the PLCs configured to use 192.168.0.1 as their
default gateway?

Second, why would you need to add the 192.168.0.1 address to the
interface? Unless the PLCs are configured or firewalled to only work
with 192.168.0.x addresses, they should have no problem talking to
the 10.10.10.x address. (They already have the MAC address of the
NIC from the packets coming from it to the PLC.)

Third, why not use the standard network configuration setup instead
of running a script from rc.local? You can add a second IP address
to a NIC using the ifcfg-eth0:0 form. You can add a route to an
interface by using the route-eth0 form. You can turn on forwarding
in /etc/sysctl.conf. By using the standard interface, you can then
use the normal network configuration tools to configure the
interfaces, and they would be in the standard place. It tends to
make troubleshooting easier...

Mikkel
-- 

  Do not meddle in the affairs of dragons,
for thou art crunchy and taste good with Ketchup!

Attachment: signature.asc
Description: OpenPGP digital signature


[Index of Archives]     [Current Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux