# [SOLVED] Moving network from class A to calss C

## pmam

I replaced my old router with new one so I have to do some changes - 

Old router has this address: 10.0.0.138 and new one has: 192.168.1.1 - and as I can see from the router data,

the range is: 192.168.1.1 - 192.168.1.234 and I see also this - Subnet Mask: 255.255.255.0

I know I can change the new router's address to the old one but I prefer to keep the new address.

Most of my machines work with DHCPCD Network manger (rather than .net) so I changed my /etc/dhcpcd.conf as following:

```
interface enp2s0

   static ip_address=192.168.1.7/8

   static routers=192.168.1.1

   static domain_name_servers=192.168.1.1

   interface wlp3s0

   static ip_address=192.168.1.9/8

   static routers=192.168.1.1

   static domain_name_servers=192.168.1.1
```

Now every thing is working ok however, I need your advise in order to be sure it is configured properly - 

as you can see in the outputs below, netmask is 255.0.0.0,

so please let me know if it is ok /8 as subnet mask instead of the old one /24?

Here some additional outputs that may help (I activated wireless interface as well just for this testing):

```
ifconfig

enp2s0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500

        inet 192.168.1.7  netmask 255.0.0.0  broadcast 192.255.255.255

        inet6 fe80::e0d0:cd24:9af8:9540  prefixlen 64  scopeid 0x20<link>

        ether 8c:89:a5:66:22:7b  txqueuelen 1000  (Ethernet)

        RX packets 164860  bytes 143146090 (136.5 MiB)

        RX errors 0  dropped 0  overruns 0  frame 0

        TX packets 139997  bytes 26584176 (25.3 MiB)

        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536

        inet 127.0.0.1  netmask 255.0.0.0

        inet6 ::1  prefixlen 128  scopeid 0x10<host>

        loop  txqueuelen 0  (Local Loopback)

        RX packets 596  bytes 50396 (49.2 KiB)

        RX errors 0  dropped 0  overruns 0  frame 0

        TX packets 596  bytes 50396 (49.2 KiB)

        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

wlp3s0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500

        inet 192.168.1.9  netmask 255.0.0.0  broadcast 192.255.255.255

        inet6 fe80::ef63:1e46:f7ed:a823  prefixlen 64  scopeid 0x20<link>

        ether 00:1d:0f:c6:8b:67  txqueuelen 1000  (Ethernet)

        RX packets 2418  bytes 1522385 (1.4 MiB)

        RX errors 0  dropped 0  overruns 0  frame 0

        TX packets 1641  bytes 523217 (510.9 KiB)

        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
```

```
route -n

Kernel IP routing table

Destination     Gateway         Genmask         Flags Metric Ref    Use Iface

0.0.0.0         192.168.1.1     0.0.0.0         UG    202    0        0 enp2s0

0.0.0.0         192.168.1.1     0.0.0.0         UG    303    0        0 wlp3s0

127.0.0.0       0.0.0.0         255.0.0.0       U     0      0        0 lo

192.0.0.0       0.0.0.0         255.0.0.0       U     202    0        0 enp2s0

192.0.0.0       0.0.0.0         255.0.0.0       U     303    0        0 wlp3s0
```

```
route

Kernel IP routing table

Destination     Gateway         Genmask         Flags Metric Ref    Use Iface

default         smartbox.home   0.0.0.0         UG    202    0        0 enp2s0

default         smartbox.home   0.0.0.0         UG    303    0        0 wlp3s0

loopback        *               255.0.0.0       U     0      0        0 lo

192.0.0.0       *               255.0.0.0       U     202    0        0 enp2s0

192.0.0.0       *               255.0.0.0       U     303    0        0 wlp3s0
```

----------

## ct85711

In general, when you are using a 192.168.x.x address, your subnet mask would be 255.255.255.0.  Unless you really do have tons of hosts on the network, or several subnets you should be safe to use the new /8 subnet mask.

----------

## Buffoon

You are in violation of RFC 1918 (and others) if you use routable addresses that do not belong to you. 

These addresses are at your disposal for private networking. 192.168.0.0/16 (255.255.0.0)

----------

## pmam

ct85711 & Buffoon Hi,

Thanks but I do not know what to do according your replies - 

I agree that /8 is ok but why I get 255.0.0.0 in these outputs??? 

If I work only with DHCPD (rather than .net) and I put /8 in /etc/dhcpcd.conf - Is it not enough?

Where or how else can I  change networking configuration, so I will get 255.255.255.0 in the relevant outputs?

I do not have much experience with subnet masks so please be detailed as you can...

----------

## ct85711

You may want to double check that Buffoon, as 10, 172.{16-31) and 192.168 are all considered for private networking.  The usage just depends on your network requirements.

Now, why are are still getting a /24 mask, I'd double check the configuration of your router/dhcp server.  DHCPCD just requests an ip address (and the subsequent subnet mask) from an dhcp server (commonly on your router, but not required to be).

----------

## Buffoon

@ct85711

OP stated he wants to use 192.168 subnet.

----------

## ct85711

I know, I was more of correcting you on the valid private networking address ranges, as he wasn't violating anything with his old IP address.  Now if I got mixed up between /8 and /24 notion, I may be wrong; which I'll accept that blame (part of why I don't like using that notation too often).

----------

## gordonb3

Oh, for Christ sake...

Netmask is the number of 'first' bits that are enabled within the given address space. Thus, a netmask of 8 means that the first 8 bits are '1' which in IPV4 translates to the ridiculous decimal value 4,278,190,080, but if you split the total amount of bits in 4 groups of 8 bits it becomes 255.0.0.0. Looks familiar?

As a rule, in every home environment you'll find the netmask /24, which in decimal notation and grouped as above translates to 255.255.255.0. This gives you a range of 254 possible addresses (0 and 255 have a special meaning), which is seriously over the top but results in the intuitive advantage that in the grouped decimal notation the first three numbers are fixed while the fourth number can have any value (except 0 en 255 as mentioned before).

In short: unless you fully understand what netmask is about, I recommend you stick to the rule of thumb and use /24.

----------

## pmam

gordonb3 Hi,

I thought that /24 is for 255.0.0.0 so after your nice explanation I see my confusion...

So, at the moment, the outputs above are according my configuration in /etc/dhcpcd.conf:

/8 is for 255.0.0.0 and it is ok. But I am going to change it to /24 (255.55.55.0) as you recommended me - It means I can have 254 hosts.

For closing this issue, please let me know why someone would change this netmask? For what purpose? 

Thanks you all

----------

## szatox

 *Quote:*   

> Old router has this address: 10.0.0.138 and new one has: 192.168.1.1 - and as I can see from the router data,
> 
> the range is: 192.168.1.1 - 192.168.1.234 and I see also this - Subnet Mask: 255.255.255.0 

 

A few tips from me:

1) Change your new router's configuration to match the old one. This way you only have 1 devie you reconfigure.

2) Ignore it. Cheap routers designed for "regular users" come with sane defaults and dhcp server so the other devices in your network will receive new settings and hopefully obey.

 *Quote:*   

> For closing this issue, please let me know why someone would change this netmask? For what purpose? 

 

one reason is to split the network into smaller sections. Another reason is to bump the address space so you can stuff more devices together and manage them on layer 2 (MAC) rather than layer 3 (IP).

I used to have 2 networks with netmask 25 which means 2 router IPs, 2 broadcast IPs, 125 IPs available for wifi and 125 IPs for wired ethernet. And then added another subnet for virtual machines. How many ways to organize those can you imagine? 

And why block 64k IPs when you only need to connect like 10 hosts? (netmask of 28 would be enough for this, taking out 16 addresses of which 13 you can use).

----------

## gordonb3

The reason to change the netmask would be that you *need* more addresses or *want* less addresses. For instance, if you change the netmask to /16 you're already up to 64k addresses (256 x 256) minus 2. There are very few instances where you'd need that many addresses. A more likely example is that you would want to restrict the maximum number of people connecting to a specific network. Most likely a wifi network, because obviously a wired network is already restricted by the number of physical connections. e.g. on my guest network I use a netmask of /29 (255.255.255.248), which gives me a range of 6 (2^3 minus 2) possible addresses. This can be difficult to grasp because the lowest possible address in the range is the network address (i.e you cannot use this for any device) and the highest possible address is the broadcast address. So suppose you have 10.0.0.138/29, then the network address is 10.0.0.136, the broadcast address is 10.0.0.143 and the addresses you can use within this range for devices/computers are 10.0.0.137-142.Last edited by gordonb3 on Mon Aug 03, 2015 8:17 pm; edited 1 time in total

----------

## NeddySeagoon

pmam,

The netmask serves to divide your network up for routing as gordonb3 described.

The default settings for a class C (private) network is an address oy the form 192.168.x.y/24  You can choose x in the range 0..255, so that allows for 256 networks of 254 hosts each.

Class A, B and C networks have been obsolete for a long time.  Instead you can set the netmask to whatever works for you, as long as you don't help yourself to public IP addresses.

Suppose I want to have 256 hosts on a single network.  That's too many for a Class C.  I could use two class C networks and a router., 

I could use a Class B network, or I could use a classless system and change the netmask to /23.  Thats 255.255.254.0

Going back to our  192.168.x.y/24, it becomes 192.168.x.y/23 giving 128 networks earh with 510 addresses for hosts.

As long as the netmask is /16 or more and I use 192.168.x.y, The netmask can be between /16 and /30  (/31 is not useful and /32 is a special case used for PPP.

This is classless networking.  The classes are now just special cases of classless networking.

Classless networking is more common than you might think.  If you ask your ISP for 8 static public IP addresses, you will get a /29   

This Wikipedai page is worth reading. There are many other.

----------

## krinn

The netmask is telling who is from your local network, with /8 you are telling so 255.0.0.0 and so that your local network is x.local.local.local

And it may (i honestly don't know the real result) problematic that an IP not from your local network range is assume to be in your local network, and this is what you are doing with 192.x.x.x/8 because this mean your local network is 192.anything ; making 192.178.x.x or 192.1.x.x and other ranges assume as your local network, while these IP are not for private network usage and can be use by an internet service.

----------

## pmam

szatox,

 *Quote:*   

> 1) Change your new router's configuration to match the old one. This way you only have 1 devie you reconfigure.
> 
> 2) Ignore it. Cheap routers designed for "regular users" come with sane defaults and dhcp server so the other devices in your network will receive new settings and hopefully obey.
> 
> 

 

I know I can change my new router's configuration - but if I were do it,

I would miss all yours helpful explanations of netmask and IP classes   :Very Happy: 

But seriously - I saw that most of you use class C (hope I am right?) - 

and I got some remarks from friends here, like: 'Why do you use class A?' - 

so I guess that there are some good reasons to do it - 

though I am not sure I quite understand why to prefer class C for home/small office usage? 

Anyway I start to see some sense to do it, but mostly I want to be in the safe side - i.e: your side...   :Smile: 

Of course that class A should be ok , as well - this was the default of my old router - what do you mean by 'sane defaults'? class C or A or both of them?

BTW: In the new router I have only 3 LAN inputs (in old one got 4) - Please advise the simple way for extending LAN inputs?

I see the flexibility of classless networking, and I am going to read some stuff for better understanding!

Thanks for all yours explanations - It is really helpful!

----------

## ct85711

well, for extending the number of ports is easy, just attach additional routers/switches/hubs (recommended to use switches) to your current one; like in a daisy chain.  Attaching routers to another one is sometimes easy in that the second one will automatically run as a switch, but not always.  This is the same way on how to add wifi capabilities to your network.  The other alternative is getting a bigger router/switch with more ports (but more expensive).

As far as using a class C over class A, I don't know of any performance disadvantage right off hand beyond the thing of taking a Olympic sized pool when you only need a small cup.

Now if your network has several computers (typicaly you are looking over 100+ computers/devices), then you do get into performance issues; but that's a thing of trying to stuff too much in a pipe.  You may get everything in there, but slows everyone down.

----------

## NeddySeagoon

pmam,

If you don't have a switch, you can use your old router as a switch.

First, log into the old router and turn off all the services. Especially the dhcp server.

Now, connect one of the LAN ports on your old router to one of the LAN ports on the new router.

This gets you from three to five LAN parts for your hosts.

Its likely that your new router provides 1G LAN ports and the old router only 100MHz ports.

That means you need to be careful how you will connect things to got the best network speed.

If you want to spend money, buy an 8 port unmanaged 1G switch.  Take care you do get a 1G switch and not a 10/100 one.

If you post the part numers of your two routers, I'll look up the speeds.

----------

## Buffoon

OpenWrt allows "Switch" setting, all ports can be used as switch ports. I have an old 100 Mbit/s router I use as a switch for security cameras and as a wireless AP.

----------

## gordonb3

pmam,

I think you're being thrown on the wrong foot here. Like you stated in your first post, the netmask on your old router was /24, which belongs to a class C network. Why do most people use a class C network you ask. This is in fact rarely a deliberate choice. The truth is that essentially every commercially available router for the consumer market is preconfigured to serve a class C network and very little people bother to change it.

The first generation consumer routers used the address 10.0.0.138, which was the same as the old 'dumb' modems (likely a reference to the separator frequency for sending and receiving in ADSL), and they called them 'smart' modems. While 10.x.x.x is a class A network and dedicated for local use by RFC 1918, these ADSL modems and routers were in fact configured to use 10.0.0.x, thus class C. If you buy a router today, or receive one from your ISP, it will likely come with an address in the 192.168.x.x RFC 1918 range. Commonly you'll see 192.168.1.1/24, 192.168.2.1/24 and in some cases 192.168.1.254/24. As said, all of them are and have always been preconfigured for class C networks.

----------

## szatox

 *Quote:*   

> But seriously - I saw that most of you use class C (hope I am right?) -

 No, we are not using any class.

There are a few pools of private IPs:

Class A 10.0.0.0 - 10.255.255.255 	

Class B 172.16.0.0 - 172.31.255.255

Class C 192.168.0.0 - 192.168.255.255

We define size of block we need (netmask) and pick some arbitrary chunk of any pool we like. Typically it's the lowest chunk possible within any range, for sake of convenience as you only have to remember 3 digits in this case instead of 12 when you're troubleshooting it.

However it's often a good idea to pick different "class" for your LAN than your ISP gives you. Why? Makes configuration easier, as it prevents accidentally overlaping ranges (so you won't unintentionally screw up routing table in your router) Also, lets you see from the first glance in which network segment you are.

----------

## NeddySeagoon

I use 

192.168.10.0/24 for my internet accesable servers.

192.160.100.0/24 for my wired network

192.168.54.0/24 for my wireless network.

Once upon a time the 10, 54 and 100 referred to the speeds.

The 10 was coax thin net, the 54 was wireless G and the 100 was UTP. 

Today its all 1G, even the wireless, which is 1.2G ac but the subnets remain the same.

Its still easy to remember, even if I can't look at the cable and tell which network it belongs to.

----------

## pmam

gordonb3

 *Quote:*   

>  Like you stated in your first post, the netmask on your old router was /24

 

Sorry but I was wrong - in my old router it was class A with netmask /8 - not /24 as I mentioned before

Now in the new router I have class C/24

Thanks for your info regarding  'preconfigured for class C' - 

I thought there is something important in this choice but as you said it is 'rarely a deliberate choice'  

ct85711 & szatox & NeddySeagoon - I am starting to get the idea of flexibility of classless networking, and how to use it right   

Regarding extending the number of ports: I thought it could implement by a simple T-connector...   :Smile: 

Actually,  Ethernet is based on collisions - so why not??

I will see if I can manage with 3 ports - if not I will add my old router - Should I change its address: 10.0.0.138, or/and change its settings?

Buffoon - OpenWrt means just software? Is it suitable to any router?

I just wanted to move from A to C and now exploring classes networking's world...   :Very Happy: 

Thanks

----------

## gordonb3

No. Nothing important. Although it does help people doing things right without needing immediate assistance. This is because it is very unlikely that anyone would choose the number 0 (the network address) to use for a computer, since you normally start counting at 1. At the same time they're also not likely to ever reach 255 (the broadcast address) and if you do find someone who changed the router address to 254, which is more or less an IT standard, that person will know not to use 255.

If you set your network up to use a larger netmask things can get hairy. See my previous example for 10.0.0.136/29. The simplest approach is to keep the number 0 as the base of your network and start counting at 1 like you're used to. But you don't need to. You can start at any multiple of 4 (/30), 8 (/29), 16 (/2 :Cool: , 32 (/27), 64 (/26) or 128 (/25) that is less than 256. Note that you cannot use a netmask of /31, because the two possible addresses in that range would be already in use as the network address and the broadcast address, meaning you cannot connect any device to such a range.

As far as using a T-connector, you cannot do that because it will change the electrical properties of the cable and terminals. In an ideal world the impedance of both is exactly the same, preventing ripple and echoing. If you put a T-connector in there it will divide the total impedance by 2 and havoc will be your part because everything you try to send through that cable will be distorted by its own echoes bouncing in between the original sender and the two other nodes.

That said, it is possible to let multiple devices share the same cable. The theory behind this is that Ethernet actually only uses two wire pairs while the cable has four. In fact, the weird wiring scheme with the blue wire pair in the middle of the connectors is because the original idea was to have telephony and data run through that cable simultaneously and the telephone companies insisted that their wires would stay in the middle (if you plug the rj11 plug of an analog phone into an rj45 socket wired to a PABX it will function). What you do is connect the orange and green wire pairs as usual and then wire the brown an blue pairs using the orange and green pins onto a second connector. You need to do this on both ends, so you end up with a cable that has two connectors at each end. There is a downside to it: it will only work with speeds up to 100Mbit and you may need to manually set that speed to keep it from falling back to a safe 10Mbit.

Of course this doesn't help you because you still need the extra terminal, but it's one of those nice to know things.

----------

## szatox

About that T-connector, older versions of ethernet can tolerate it falling back to half-duplex mode and CSMA/CD - that collision avoidance you mentioned. So you have echoes mentioned by gordonb3, fail-sleep-retry mode, clients competing for bandwidth and only up to 1 pair in use at any time. 4 reasons to degrade performance for the whole segment of network.

Yes, it will work. It's poor man's networking though. Packets in switched network can't collide which means there is no concurrency for resources, no collissions (and retransmissions), no iddle time between packets (as nobody else is waiting for line), and then you can even have full duplex allowing simultanous use of 2 pairs in 10/100Mbps mode or 4 pairs in 1/10Gbps mode.

So yes, you can use T. But you don't want (unless you are absolutely positive that you want)

----------

## NeddySeagoon

pmam,

If you want to use youl old router as an unmanaged switch, you need to turn off all the routing functions..

It will not have an address on your network and it must not offer IP addresses to any connected devices.

You really don't want to use a T piece on UTP ethernet.

----------

## krinn

When i read NeddySeagon, it's not good, but when i quote him, it's magically fix ; that forum software is really buggy...

 *NeddySeagoon wrote:*   

> It will have an address on your network and it can even offer IP addresses to any connected devices.

 

----------

## NeddySeagoon

krinn,

:)

Its a very bad thing to have two dhcp servers on the same network segment.

If they offer the same address to two different systems, the network won't work.

If they offer addresses in different subnets some hosts won't have the right routing table to get to the default gateway.

Hence the advice to use the old router as an unmanaged switch.

----------

## pmam

No worry - T-connector was as a semi-jock - just for thinking of

Now, after your replies it is a full jock   :Smile: 

----------

