Jump to content

Internet and file sharing through ethernet

Mikuo0139

I know you can share files from pc to pc through ethernet and also internet but can you do both at the same time?

I'm using my laptop to connect to the wifi and share the internet to my primary pc using ethernet. Is there a way I can share internet and access files from the laptop to the pc and vice versa?

Link to comment
Share on other sites

Link to post
Share on other sites

Sharing internet shouldn't affect Windows shares in any way. The PCs are still on the same network, so they should be able to see one another and share files.

Remember to either quote or @mention others, so they are notified of your reply

Link to comment
Share on other sites

Link to post
Share on other sites

17 minutes ago, Eigenvektor said:

Sharing internet shouldn't affect Windows shares in any way. The PCs are still on the same network, so they should be able to see one another and share files.

If it's via the method I'm thinking of then last I checked no. It does not put you on the same network. It makes you traverse NAT and makes your computer act kind of like a router.

 

There may be a way to pass-though the network but I've not heard of any methods that work. (Bridging the network adapters does not work)

 

You might be able to do something with Tunneling. I've not tried it myself though. May not work.

 

The only other option I can think of would be to make a request out to the Internet and have that request come back in to the computer you want to access. Such as setup a SFTP server and port forward it to your computer then make a request to your Public IP on the Client PC. That should work in theory.

Link to comment
Share on other sites

Link to post
Share on other sites

10 minutes ago, Windows7ge said:

If it's via the method I'm thinking of then last I checked no. It does not put you on the same network. It makes you traverse NAT and makes your computer act kind of like a router.

Correct me if I'm wrong, but a PC and its router are on the same network?

 

Let's say the ISPs router has 192.168.0.1. The PC connected to that router will receive an IP in the range 192.168.0.x/24. If I share that computer's internet connection, it will switch the second NIC to something like 192.168.1.1 and the second computer will get an IP in the range 192.168.1.x/24. Meaning both PCs are on the same network and should be able to talk to one another. Or am I misremembering how Internet sharing works on Windows?

Remember to either quote or @mention others, so they are notified of your reply

Link to comment
Share on other sites

Link to post
Share on other sites

5 minutes ago, Eigenvektor said:

Correct me if I'm wrong, but a PC and its router are on the same network?

 

Let's say the ISPs router has 192.168.0.1. The PC connected to that router will receive an IP in the range 192.168.0.x/24. If I share that computer's internet connection, it will switch the second NIC to something like 192.168.1.1 and the second computer will get an IP in the range 192.168.1.x/24. Meaning both PCs are on the same network and should be able to talk to one another. Or am I misremembering how Internet sharing works on Windows?

192.168.0.0/24 & 192.168.1.0/24 are different networks. The subnet mask dictates where the first network bit starts and the last bit (generally the Broadcast address) ends.

For 192.168.0.0/24 that means the first addressable bit is 192.168.0.1 which is usually taken by the router. The last addressable bit is 192.168.0.255 which is usually taken by the Broadcast. DHCP will had out addresses between .2 and .254. Any address higher or lower than this .255 range is a different network. This is because the subnet is /24 which means there are only 8 (255 - 2 addresses) host bits available for that network.

 

And really Windows doesn't increment the network by 1 like a router does it does some crazy arbitrary number such as 192.168.163.0/24.

 

Because of this the computer doing the sharing acts kind of like a router it translates requests coming from this sub-network and forwards them to the Internet. Devices on the client network cannot talk to devices on the host network. We call this translation NAT (Network Address Translation) where a group of devices share one "Public IP" by creating a sub-network for said devices.

 

Sharing a network adapter on Windows is fine if all you want is internet access but trying to do local File Sharing with it enabled is not going to work well. You'd be better off getting some USB to Ethernet adapters and making a second network for P2P file sharing (Windows will likely auto-handout 169.254.X.X/16)

Link to comment
Share on other sites

Link to post
Share on other sites

34 minutes ago, Windows7ge said:

192.168.0.0/24 & 192.168.1.0/24 are different networks. The subnet mask dictates where the first network bit starts and the last bit (generally the Broadcast address) ends.

For 192.168.0.0/24 that means the first addressable bit is 192.168.0.1 which is usually taken by the router. The last addressable bit is 192.168.0.255 which is usually taken by the Broadcast. DHCP will had out addresses between .2 and .254. Any address higher or lower than this .255 range is a different network. This is because the subnet is /24 which means there are only 8 (255 - 2 addresses) host bits available for that network.

 

And really Windows doesn't increment the network by 1 like a router does it does some crazy arbitrary number such as 192.168.163.0/24.

 

Because of this the computer doing the sharing acts kind of like a router it translates requests coming from this sub-network and forwards them to the Internet. Devices on the client network cannot talk to devices on the host network. We call this translation NAT (Network Address Translation) where a group of devices share one "Public IP" by creating a sub-network for said devices.

 

Sharing a network adapter on Windows is fine if all you want is internet access but trying to do local File Sharing with it enabled is not going to work well. You'd be better off getting some USB to Ethernet adapters and making a second network for P2P file sharing (Windows will likely auto-handout 169.254.X.X/16)

Dude, I don't need a lecture in basic networking ;) The IPs were just examples, who cares what the actual IPs are.

 

I've just set up my notebook to share its Internet connection. The notebook is on the router's network and is sharing this connection on 192.168.137.1. This means my desktop computer now has 192.168.137.2. This means it is on the same network as the notebook (which is also on the router's network, since it is itself now acting as a router, meaning it is part of two networks).

 

So yes, the desktop can absolutely see the notebook and talk to it. I was just able to mount a Windows share that is on my laptop on my Linux desktop. The desktop can also connect to my router, exactly because the notebook is routing requests that I make to this other (private) network.

 

~edit: And, since I can still post, my desktop is still connected to the Internet (via LAN to the notebook, which is connected to the router via Wi-Fi)

Remember to either quote or @mention others, so they are notified of your reply

Link to comment
Share on other sites

Link to post
Share on other sites

5 minutes ago, Eigenvektor said:

Dude, I don't need a lecture in basic networking ;) The IPs were just examples, who cares what the actual IPs are.

 

I've just set up my notebook to share its Internet connection. The notebook is on the router's network and is sharing this connection on 192.168.137.1. This means my desktop computer now has 192.168.137.2. This means it is on the same network as the notebook (which is also on the router's network, since it is itself now acting as a router, meaning it is part of two networks).

 

So yes, the desktop can absolutely see the notebook and talk to it. I was just able to mount a Windows share that is on my laptop on my Linux desktop. The desktop can also connect to my router, exactly because the notebook is routing requests that I make to this other (private) network.

Interesting. I tested this before posting because I didn't want to look like a fool and despite my home network being 192.168.0.0 the network Windows created for my Linux desktop was vastly different. I didn't consider that because you're still directly connected to the Windows computer that it may still let you use protocols such as SMB to talk to it but I would still expect that you cannot talk to devices beyond the Windows host (accessing the home router WebUI. Accessing another computer. Etc.)

 

But those are beyond the scope of what OP wants so I guess it doesn't matter.

 

Damn...try hard and still get it wrong. My life in a nutshell.

Link to comment
Share on other sites

Link to post
Share on other sites

1 minute ago, Windows7ge said:

Interesting. I tested this before posting because I didn't want to look like a fool and despite my home network being 192.168.0.0 the network Windows created for my Linux desktop was vastly different. I didn't consider that because you're still directly connected to the Windows computer that it may still let you use protocols such as SMB to talk to it but I would still expect that you cannot talk to devices beyond the Windows host (accessing the home router WebUI. Accessing another computer. Etc.)

 

But those are beyond the scope of what OP wants so I guess it doesn't matter.

 

Damn...try hard and still get it wrong. My life in a nutshell.

It's fine, I wasn't entirely sure myself, which is why I've set it up to test it ;)

 

In any case, the desktop is able to connect to my router's web UI, so Windows seems to route from its own network (192.168.137.x) to the router's network (172.16.4.x) just fine (and the Internet, obviously)

 

The only thing that doesn't work is the reverse direction, meaning other devices on the router's network can't see the desktop (with the exception of the notebook which is directly connected to it). So the notebook isn't acting as a router in this direction. Not sure if it can't or won't though (meaning maybe some security option I'd need to disable).

Remember to either quote or @mention others, so they are notified of your reply

Link to comment
Share on other sites

Link to post
Share on other sites

7 minutes ago, Eigenvektor said:

In any case, the desktop is able to connect to my router's web UI, so Windows seems to route from its own network (192.168.137.x) to the router's network (172.16.4.x) just fine (and the Internet, obviously)

I was going to ask if the sub-network Windows was creating was /16. This could explain why you can communicate out beyond the Windows host. It may also explain why you cannot communicate back in except for the Windows host itself. However if your native network is 172.16.4.0 then I'm royally confused as to why it's working at all.

Link to comment
Share on other sites

Link to post
Share on other sites

1 minute ago, Windows7ge said:

I was going to ask if the sub-network Windows was creating was /16. This could explain why you can communicate out beyond the Windows host. It may also explain why you cannot communicate back in except for the Windows host itself. However if your native network is 172.16.4.0 then I'm royally confused as to why it's working at all.

No, both networks are /24. They are separate networks so I would expect routing in either direction to work, as long as the notebook is set as the default router (and forwards connections).

 

Basically when I say "ping 172.16.4.x" on my desktop, it sends the request to its default router (the notebook), which is also part of that network so it forwards the request (and also accepts the response and routes it back). Essentially the same type of NAT it is doing for requests out to the Internet, except those get forwarded to the notebook's default router in turn (the ISP's router). I expect the only reason the reverse direction isn't working is because the Windows firewall isn't set up to forward request from 172.16.4.x to 192.168.137.x.

Remember to either quote or @mention others, so they are notified of your reply

Link to comment
Share on other sites

Link to post
Share on other sites

5 hours ago, Eigenvektor said:

No, both networks are /24. They are separate networks so I would expect routing in either direction to work, as long as the notebook is set as the default router (and forwards connections).

 

Basically when I say "ping 172.16.4.x" on my desktop, it sends the request to its default router (the notebook), which is also part of that network so it forwards the request (and also accepts the response and routes it back). Essentially the same type of NAT it is doing for requests out to the Internet, except those get forwarded to the notebook's default router in turn (the ISP's router). I expect the only reason the reverse direction isn't working is because the Windows firewall isn't set up to forward request from 172.16.4.x to 192.168.137.x.

The devices off the Windows PC Internet sharing can access the router because the NAT is between your LAN and the second LAN windows Internet sharing is creating.  If you couldn't, you wouldn't be able to access the Internet either.

Router:  Intel N100 (pfSense) WiFi6: Zyxel NWA210AX (1.7Gbit peak at 160Mhz)
WiFi5: Ubiquiti NanoHD OpenWRT (~500Mbit at 80Mhz) Switches: Netgear MS510TXUP, MS510TXPP, GS110EMX
ISPs: Zen Full Fibre 900 (~930Mbit down, 115Mbit up) + Three 5G (~800Mbit down, 115Mbit up)
Upgrading Laptop/Desktop CNVIo WiFi 5 cards to PCIe WiFi6e/7

Link to comment
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×