How to set up persistent routes between 192.168.2.XXX and 192.168.0.XXX
My Fedora Core 17 sits on the 192.168.2 subnet and the rest of my network sits on the 192.168.0 subnet. I'm wondering if there's a way to set up a static route between FC and say..192.168.0.191
Computers on the 192.168.0 subnet can talk to (i.e. scp) to 192.168.2 but not the other way around. I was told that a route would fix it and I know how to set them up I'm just not sure what I should put in the entries Here's my ifcfg-eth0 on FC17 UUID="d09fea4f-b616-4815-afa4-30bb073cecc6" NM_CONTROLLED="yes" HWADDR="00:1C:25:EA:16:76" BOOTPROTO="static" DEVICE="eth0" ONBOOT="yes" IPADDR=192.168.2.12 NETMASK=255.255.255.0 GATEWAY=192.168.2.1 And here's the corresponding file on Debian - yes I know it's still DHCP but I don't think things will change once I get the routes on FC17 since Debian can see FC. Besides, I can convert it to static pretty easy. # This file describes the network interfaces available on your system # and how to activate them. For more information, see interfaces(5). # The loopback network interface auto lo iface lo inet loopback # The primary network interface allow-hotplug eth0 iface eth0 inet dhcp output from route command on debian Kernel IP routing table Destination Gateway Genmask Flags Metric Ref Use Iface 192.168.0.0 * 255.255.255.0 U 2 0 0 wlan0 link-local * 255.255.0.0 U 0 0 0 eth0 default 192.168.0.1 0.0.0.0 UG 0 0 0 wlan0 default * 0.0.0.0 U 1002 0 0 eth0 output from route command on fc17 Kernel IP routing table Destination Gateway Genmask Flags Metric Ref Use Iface default 192.168.2.1 0.0.0.0 UG 0 0 0 eth0 192.168.2.0 * 255.255.255.0 U 0 0 0 eth0 |
To add a static route on Fedora you create a file based on the interface used to reach the remote network
Code:
cat <<EOF> /etc/sysconfig/network-scripts/route-eth0 |
What do ADDRESS0 and ADDRESS1 represent?
|
Two different networks, I added 2 to make the naming/numbering obvious
|
Sorry to be so thick but now I'm kinda confused.
Are you saying that in order for my Fedora Core box with IPADDR=192.168.2.12 NETMASK=255.255.255.0 GATEWAY=192.168.2.1 to reach computers with GATEWAY=192.168.0.1 I need to have two *entries* in my routes file? Or do I only need one route for the entire 192.168.0.1 subnet? Something like this: # Dev subnet GATEWAY0=192.168.0.1 <-- this is the gateway of the subnet I want to reach NETMASK0=255.255.255.0 ADDRESS0=192.168.2.12 <--- this is the IP of the FC box EOF |
Ok .. let's slow this down, to communicate outside the network you are attached to you need a gateway. Your default gateway is a host on the same network as you to which your computer will send any traffic that isn't on the same network. A gateway is defined by the fact that it has interfaces on more than one network and it forwards traffic between them.
Local communication example (traffic is sent direct to the destination): Code:
[PC:192.168.0.50] -> [Printer:192.168.0.5] Code:
[PC:192.168.0.50] -> [DGW:192.168.0.1] -> [anywhere else:111:222:333:444] Code:
[PC:192.168.0.50] -> [GW:192.168.0.2] -> [somewhere else:10.0.0.1] Code:
GATEWAY0=192.168.2.? <-- this is address of the gateway's interface on *your* network Code:
GATEWAY0=192.168.2.? <-- this is address of the gateway's interface on *your* network |
Ok, I think I've got some of this sorted
The IP address of the wireless router that serves the 192.168.0.XXX subnet is 192.168.2.10 because it's hardwired into the same modem that serves the 192.168.2.XXX subnet so that would be the GATEWAY0 entry. And ADDRESS0 would be 192.168.0.1 because that's the (in terms of your nomenclature) the network address (not host address) for the destination host. IIRC I would have put 192.168.0.1 in as the GATEWAY entry in the /etc/sysconfig/network-scripts/ifcfg-eth0 file. Am I close? |
Almost, 192.168.0.1 would be a host address not a network address, on a class c network (most likely) the network would be 192.168.0.0 and the subnet mask would be 255.255.255.0
So you can use: Code:
GATEWAY0=192.168.2.10 Code:
GATEWAY0=192.168.2.10 |
Ok.. I'll give that a try when I get home. I'll update the thread with my results.
Thanks |
Ok, here's what I have in my /etc/sysconfig/network-scripts/route-eth0
GATEWAY0=192.168.2.10 NETMASK0=255.255.255.255 ADDRESS0=192.168.0.191 And when I run the route command I see static routes but it's still not working [root@leonard etc]# route Kernel IP routing table Destination Gateway Genmask Flags Metric Ref Use Iface default 192.168.2.1 0.0.0.0 UG 0 0 0 eth0 sheldon.cgeekwa 192.168.2.10 255.255.255.255 UGH 0 0 0 eth0 192.168.2.0 * 255.255.255.0 U 0 0 0 eth0 This is probably not going to work based on my network configuration. I have a modem connected to my high speed provider. That modem is serving the 192.168.2.XXX network Then I have a wireless router hard wired into the modem and it's IP is 192.168.2.10 The 192.168.0.XXX network is being served out of that. Unless I'm missing something obvious here. |
Don't forget that the other host will also need a route to your network/machine .. are you sure that your router and wireless access point don't support adding static routes?
|
All times are GMT -5. The time now is 08:37 PM. |