Routing Linux 192.168.10.x network to Dlink router on 192.168.1.x network

Discussion in 'Linux Networking' started by q4n, Aug 5, 2006.

  1. q4n

    q4n Guest

    8/5/2006, 1:23AM

    Hi,

    Thanks for taking the time to shine some light!

    I have a Linux Redhat 7.2 box on a 192.168.10.x network and I have
    clients that need to connect also connected to the same Dlink router
    which is at 192.168.1.1

    All my boxes are physically plugged into the D-link router so they are
    all on the same physical network.

    I heard that if all machines are on the same router, then all one has
    to do is add the odd man out network to the routing page, which I did:


    Enable : Yes
    Destination IP 192.168.10.100
    Netmask : 255.255.255.0
    Gateway : 192.168.1.1
    Interface :LAN
    Metric : 1

    My router is on 192.168.1.1
    Linux box is on 192.168.10.100
    clients on 192.168.1.100

    I don't want to be sloppy and change the subnet mask to 255.255.0.0

    Shouldn't this work? But my Linux box at 192.168.10.100 can't ping my
    D-link router at 192.168.1.1

    I could probably do a "route add" command on the Linux box to be able
    to ping the D-link, but shouldn't the router, since it's on the same
    physical network, see the ping from anything on it's network? Yes...it
    should drop it from a different subnet...I know....but since I added
    the route in the D-link routing table, shouldn't it not only see it but
    route it and/or respond to it?

    I can ping the D-link 192.168.1.1 from my boxes on the 192.168.1.x
    network.

    I don't want to have to add "route print" statements on all my boxes. I
    thought this is what routers were for...connecting different subnets?

    Thanks for your input!

    Thanks,

    The "Route Guy"
     
    q4n, Aug 5, 2006
    #1
    1. Advertisements

  2. That would mean that packets for 192.168.10.100 are to be sent to
    192.168.1.1 which probably isn't what you want.

    If your 192.168.1.x and 192.168.10.x are on the same subnet, and there
    aren't any othe 192.168.y.x on different subnets, then setting the
    subnet mask to 255.255.0.0 is what you need to to.

    But why doesn't your Linux box have a 192.168.1.x address anyway? Why
    don't you just let your router assign its IP address like everybody else's?

    Robert
     
    Robert Harris, Aug 5, 2006
    #2
    1. Advertisements

  3. q4n

    q4n Guest

    Hi Robert,

    Thanks for the reply!

    The reason I don't let DHCP do it's dirty deeds is that most of my
    boxes are servers or other test clients whose addresses I need to stay
    static.

    So, opening up my subnet mask is one solution, but in situations where
    widening the subnetmask is not desired, shouldn't my router be able to
    "route" from one subnet to the other?

    I want my 192.168.10.100 to be able to send packets through 192.168.1.1
    (The D-link router) to get to 192.168.1.104 and other 192.168.1.x
    clients.

    Can't I get the D-link to route this way without just opening my subnet
    mask?

    And does this mean I have to open the subnet mask on all clients and
    servers? The reason I ask is that, again, I've read that the router
    should be able to handle all of this without changing the clients as
    long as they are all plugged into the same router, because the router
    gets all the packets, but makes decisions about which to route based on
    it's own configured routing table.

    I thought I modified the routing table sufficiently with my
    entry...but apparently not.

    Any direction on how to get the router to route without widening the
    subnet mask is appreciated!

    Sincerely,

    RG


     
    q4n, Aug 5, 2006
    #3
  4. q4n

    q4n Guest

    Hi Route Guy, this is Route Guy:

    I got it to work, not by sloppily widening the subnet, but by adding
    the route the correct way on the D-link router. After I RTFM, whose
    directions are below, I changed the route from this:
    Enable : Yes
    Destination IP 192.168.10.100
    Netmask : 255.255.255.0
    Gateway : 192.168.1.1
    Interface :LAN
    Metric : 1

    to this:

    Enable : Yes
    Destination IP 192.168.10.0 (specifies entire 10.x network)
    Netmask : 255.255.255.0 (left same)
    Gateway : 0.0.0.0 (0's indicate all clients plugged into one/same
    router)
    Interface :LAN
    Metric : 1 (indicates there are no hops other than to d-link router)

    192.168.1.x and 192.168.10.100 talk to each other now like it was high
    tea time at the All England Ladies Tea Club.

    Thanks for your input!

    Love,

    RG



    Adds a new route to the IP routing table or edits an existing route.
    Specifies whether the entry will be enabled or disabled.
    The IP address or network that the packets will be attempting to access
    Note: 192.168.1.0 with a Netmask of 255.255.255.0 means traffic will be
    routed to the entire 192.168.1.x network.
    Used to specify which portion of the Destination IP signifies the
    network
    trying to be accessed and which part signifies the host that the
    packets will
    be routed to
    Note: 255.255.255.255 is used to signify only the host that was entered
    in
    the Destination IP field.
    Specifies the next hop to be taken if this route is used. A gateway of
    0.0.0.0
    implies there is no next hop, and the IP address matched is directly
    connected
    to the router on the interface specified: LAN or WAN.
    Specifies the interface, LAN or WAN, that the IP packet must use to
    transit
    out of the router when this route is used.
    The amount of hops it will take to reach the Destination IP or network.
    A
    hop is considered to be traffic passing through a router from one
    network to
    another. If there is only one router between your network and the
    Destination
    network, then the Metric value would be 1.
     
    q4n, Aug 5, 2006
    #4
  5. q4n

    Unruh Guest

    It does. From the Wan to the Lan side of the box.

    ?? The problem is that you need to tell your system how to get to
    102.168.1.1
    route add -host 192.168.1.1 eth0
    on each of the machines might work.
    route add -network 192.168.1.0 netmask 255.255.255.0 gw 192.168.1.1 eth0
    should do it.

     
    Unruh, Aug 5, 2006
    #5
  6. Look: packets from one host on the subnet to another don't need to be
    processed by the router. You can get your router to redirect packets on
    the subnet if you want but that just means that each packet causes the
    router to generate an extra one for no good reason.

    If you keep the (IP address & netmask) the same for every member of a
    subnet, then you can add other subnets to your network and use simple
    routing decisions around it. If you don't, you will reach a situation
    where each host has to know how to reach every other host individually.

    If you want some IP addresses to be fixed (for servers), you can tell
    your router about them and get the router to assign fixed IP addresses
    to them for their given MAC addresses. That way the router, assuming it
    is the nameserver on the network, knows the hostname of all the hosts
    and the hosts can address one another by name without messing around
    with hosts files.
     
    Robert Harris, Aug 5, 2006
    #6
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.