Create a second network on same physical LAN?
I have a LAN at home using the subnetwork 192.168.1.0/24
. I know this subnet mask supports 254 hosts.
Two Questions:
- How can I create a subnetwork like
192.168.2.0/24
on the same physical network? - Would a host on the
192.168.2.0/24
network be able to access the Internet if I pointed its default gateway to my router's IP address of192.168.1.1
?
Question #1:
How can I create a subnetwork like 192.168.2.0/24 on the same physical network?
You can create a separate subnetwork alongside your existing LAN network simply by configuring hosts on the second network using IP addresses from the 192.168.2.0/24
subnet.
For example:
Existing Subnetwork "A" (using 255.255.255.0 mask):
Router: 192.168.1.1
Computer 1: 192.168.1.2
Computer 2: 192.168.1.3New Subnetwork "B" (using 255.255.255.0 mask):
Computer 3: 192.168.2.2
Computer 4: 192.168.2.3
Let's assume you configure all of the hosts in this example to use the router's IP address 192.168.1.1
as their default gateway. The hosts on subnetwork A will have Internet access, but those on subnetwork B will not. That's where you next question comes into play:
Question #2:
Would a host on the 192.168.2.0/24 network be able to access the Internet if I pointed its default gateway to my router's IP address of
192.168.1.1?
Your router's internal IP address is 192.168.1.1
. This address places it on subnetwork A but makes it inaccessible to hosts on subnetwork B. In short, this is because a host can only communicate directly with another host on the same subnet. Subnet B hosts can send packets to any host that has an IP address of 192.168.2.0
through 192.168.2.255
(assuming our 24 bit mask). Because the router's IP address doesn't fall in this range, it's inaccessible to subnet B.
The solution is to use a real router (I'm assuming your router is actually a gateway). A true router has multiple interfaces and thus connects to multiple subnetworks to route traffic between them. So in your case, your router would have two internal IP addresses:
-
192.168.1.1
for subnetwork A -
192.168.2.1
for subnetwork B
Hosts on each subnetwork would use the respective IP address as their default gateway. When the host 192.168.2.3
tries to talk to host 192.168.1.3
it would send the traffic to the router which would "route" the packets between the two subnets. Traffic destined for the Internet works the same way. Since an Internet site's IP address isn't on the local subnetwork, the host sends the packets to the router which forwards them on to the Internet.
For a detailed explanation of IPv4 subnetting, check out this question on ServerFault.