Trying to learn subnetting

Discussion in 'Linux Networking' started by ddougal2, Nov 4, 2012.

  1. ddougal2

    ddougal2 Guest

    I am just starting out to learn subnetting. As a test to learn subnetting I want to isolate my wireless network from my wired network. If I want to have two networks using subnet 255.255.255.128 which would give me:

    net1: 192.168.0.1 - 192.168.0.126
    net2: 192.168.0.129 - 192.168.0.254

    Will I need two physical routers for each network? I configured my router like so:

    IP 192.168.0.1
    IP Subnet: 255.255.255.128
    I assume I have to disable DHCP on router?

    network #1: Client wired nic:
    IP 192.168.0.2
    subnet: 255.255.255.128
    gw: 192.168.0.1

    network #2 Client wireless nic:
    IP 192.168.0.130
    subnet: 255.255.255.128
    gw: 192.168.0.1

    This doesn't seem to work?
     
    ddougal2, Nov 4, 2012
    #1
    1. Advertisements

  2. ddougal2

    druid Guest

    Yes - does not work.

    A gateway links members of one network to other nets. So it has to be a
    member of the specific net. You would need a second gateway set to e.g.
    192.168.0.129/25. If your router allows setting up a second (virtual)
    interface, you're on the bright side.

    About DHCP: If your router does what you want, it will work.
     
    druid, Nov 4, 2012
    #2
    1. Advertisements

  3. ddougal2

    Jorgen Grahn Guest

    That looks like a netmask, not a subnet. But I see what you mean --
    you split 192.168.0.0/24 in two.
    Four routers in total, you mean?

    First explain why you need even /one/. Connect N computers to a
    switch or hub, and you can have as many networks as you want there. No
    router needed. Do you have some requirement you forgot to mention?

    /Jorgen
     
    Jorgen Grahn, Nov 4, 2012
    #3
  4. ddougal2

    ddougal2 Guest

    I would need a router to provide wireless/wired connection to the internet for two networks. This is why I need a router to provide wireless access. Iwas hoping to just use one router to provide wireless and wired connectionon two different networks. The other post seems to say I need two routers.

    Currently I have a router which is connected to a switch. The router provides my wired/wireless connection to the internet. I connected the switch to the router because I needed more wired ports then what the router provided.

    My goal here is to learn how to subnet. Ive read about subnetting and now Iwant to try it.

    From the previous post I assume I need 2 physical routers if my router doesn't support vlan. So hear is my latest attempt:

    router #2
    IP 192.168.0.129
    IP Subnet Mask: 255.255.255.128
    DHCP enabled

    router #1
    IP 192.168.0.1
    IP Subnet Mask: 255.255.255.128
    DHCP enabled

    network #1: Client wired nic:
    IP 192.168.0.2
    subnet mask: 255.255.255.128
    gw: 192.168.0.1

    network #2 Client wireless nic:
    IP 192.168.0.130
    subnet mask: 255.255.255.128
    gw: 192.168.0.129

    Are these settings correct? Is there a better way to do this?
     
    ddougal2, Nov 4, 2012
    #4
  5. ddougal2

    Moe Trin Guest

    On Sun, 4 Nov 2012, in the Usenet newsgroup comp.os.linux.networking,
    NOTE: Posting from groups.google.com (or some web-forums) dramatically
    reduces the chance of your post being seen. Find a real news server.
    That would be the address ranges - yes. The "network" addresses would
    be 192.168.0.0 and 192.168.0.128, while the "broadcast" addresses
    would be 192.168.0.127 and 192.168.0.255.
    One router located between the two subnets, and if you have a route
    the the world, that could be a separate one. On the other hand, it
    might have three interfaces - one to the world, and one on each subnet.
    DHCP is a separate matter that complicates things. My systems rarely
    go "walkies", so I have them with static addresses. If you must use
    DHCP, the setup will depend on how the networks are physically set up.
    IF the _router_ has three interfaces (world, Ethernet and wireless)
    and the DHCP server is in the router, then the DHCP server has to be
    configured to hand out addresses in the 192.168.0.0/25 (192.168.0.1 to
    192.168.0.126) on the Ethernet interface, _and_ addresses in the
    192.168.0.128/25 (192.168.0.129 to 192.168.0.254) on the wireless
    interface. If the DHCP server is "elsewhere", or if you use a
    separate router between the 192.168.0.0/25 and 192.168.0.128/25 subnets
    then that router has to have a DHCP "relay agent" to relay DHCP
    requests from one subnet to the server on the other (told you it was
    complicated). For now, using static addresses may be easier.
    Nope - the "gateway address is the address on "THIS" subnet that you
    send packets to to be forwarded. Let's assume the following setup:

    world router1 Ethernet wireless
    198.51.100.8 router1 192.168.0.1
    host1 192.168.0.2
    host2 192.168.0.3
    host3 192.168.0.4
    router2 192.168.0.100 192.168.0.129
    host4 192.168.0.130
    host5 192.168.0.130

    So, router1 has an address on the "world side", and 192.168.0.1 on
    the home side. Hosts one, two and three are on the Ethernet side of
    things, while hosts four and five are on the wireless side, and router2
    sets between the two.

    On the Ethernet hosts, the routing table (shown by the command
    '/sbin/route -n') would look like this:

    Kernel IP routing table
    Destination Gateway Genmask Flags Metric Ref Use Iface
    192.168.0.0 0.0.0.0 255.255.255.128 U 0 0 4198 eth0
    192.168.0.128 192.168.0.100 255.255.255.128 UG 0 0 519 eth0
    0.0.0.0 192.168.0.1 0.0.0.0 UG 0 0 3125 eth0

    This says 192.168.0.0/25 is local on eth0 - talk direct. The wireless
    net 192.168.0.128/25 is reachable through router 192.168.0.100, and
    "everything else" (0.0.0.0/0) is reachable through router 192.168.0.1.
    On the wireless net, it would look like this:

    Kernel IP routing table
    Destination Gateway Genmask Flags Metric Ref Use Iface
    192.168.0.128 0.0.0.0 255.255.255.128 U 0 0 857 wlan0
    192.168.0.0 192.168.0.129 255.255.255.128 UG 0 0 418 wlan0
    0.0.0.0 192.168.0.129 0.0.0.0 UG 0 0 415 wlan0

    although that _can_ be simplified to

    Kernel IP routing table
    Destination Gateway Genmask Flags Metric Ref Use Iface
    192.168.0.128 0.0.0.0 255.255.255.128 U 0 0 857 wlan0
    0.0.0.0 192.168.0.129 0.0.0.0 UG 0 0 833 wlan0

    because if you're not talking "locally (to 192.168.0.128/25), you have
    to send the packets to 192.168.0.129 for forwarding. Router2 would
    look like:

    Kernel IP routing table
    Destination Gateway Genmask Flags Metric Ref Use Iface
    192.168.0.0 0.0.0.0 255.255.255.128 U 0 0 418 eth0
    192.168.0.128 0.0.0.0 255.255.255.128 U 0 0 519 wlan0
    0.0.0.0 192.168.0.1 0.0.0.0 UG 0 0 312 eth0

    A problem many people forget is that router1 has to know how to reach
    hosts on the wireless subnet: It's routing table might look like:

    Kernel IP routing table
    Destination Gateway Genmask Flags Metric Ref Use Iface
    198.51.100.0 0.0.0.0 255.255.255.0 U 0 0 19 sr0
    192.168.0.0 0.0.0.0 255.255.255.128 U 0 0 4198 eth0
    192.168.0.128 192.168.0.100 255.255.255.128 UG 0 0 519 eth0
    0.0.0.0 198.51.100.1 0.0.0.0 UG 0 0 3645 sr0
    As shown here, it can be complicated. I haven't spoken about hostname
    resolution which can also be complicated. Any DNS server you ask to
    resolve names has to know how to answer ALL questions - and your ISP
    is unlikely to know your internal hostnames. A solution is to use
    static addresses (no DHCP, or DHCP serving static addresses based on
    the hardware address) with those static values in /etc/hosts.

    There are other networking setups - I mentioned the router to the
    world having both an Ethernet and wireless interface, and the setups
    would be similar - but different ;-) Another complication is the
    "let me do this for you" ``helper'' tools that your unnamed Linux
    distribution may provide.

    Old guy
     
    Moe Trin, Nov 5, 2012
    #5
  6. ddougal2

    Jorgen Grahn Guest

    Sorry -- I still cannot understand what you have now, or what you
    want to accomplish. A drawing could have helped, but I trust Google
    Groups to mangle such a thing beyond recognition.

    I think Moe Trin's answers elsethread may be helpful.

    /Jorgen
     
    Jorgen Grahn, Nov 5, 2012
    #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.