Share a cable connection without using a router

The providers of many ADSL connections are charged by IP address, that is, each connected computer is assigned only one IP address on its own VPN or subnet.
This prevents those who have multiple computers from sending them to the internet simultaneously with the same connection (for example the provider Alternatyva or Fastweb which allows a maximum of 3 independent connections).
It also becomes convenient to share the connection to connect wirelessly from a mobile phone or from the Playstation console or other devices.
Through a router you can configure the VPN authentication on the router itself to share the connection but in several cases this is not allowed by the provider.
You then need to use the Microsoft Windows ICS sharing service and, optionally, a netsh script to connect quickly.
First of all, I recommend reading the following articles as appropriate:
Share the Internet ADSL at home wirelessly on PCs and mobiles from Windows XP
Connect 2 PCs in an ad hoc wireless network to share internet browsing and files with Windows 7 and Vista
Use your computer as a wireless router in Windows 7
Below are the instructions to share the connection in case the connection is via cables and a switch, therefore not wirelessly.
1) Create a home subnet using a switch and give it a simple name, for example "home" (you can also use a cross or "cross" cable but one of the two computers must have a double network card so in the end it is not convenient)
2) One of the PCs is a Master and another Slave PC, The Master will be the one who accesses the internet with the account predefined by the provider, the slave connects to the master and goes on the internet via this; In our case both PCs will be both Master and Slave depending on who connects first.
3) On the two PCs set the connection that goes on the internet (not the home subnet that has been created but the one that is used with authentication) as shared .
4) The first one to connect will be the Master, the second will be Slave: The Master must have a static IP and a default Gateway which is the address of the router (start -> run -> cmd -> ipconfig to see the IP of the gateway of the internal LAN, not of the VPN that goes on the internet); The Slave must have a static IP different from the master and as the Gateway the Master IP; The DNS are the same, they must be defined and are those used by the provider (always IPconfig).
5) Create 4 .bat files (create new text file and change the extension from txt to bat) similar to this (just change the IPs inside):
@ECHO OFF
netsh interface ip set address name = "Connection to the local network (LAN)" source = static addr = 10.10.46.2 mask = 255.255.254.0 gateway = 10.10.46.1 gwmetric = 0
netsh interface ip set dns "Connection to the local area network (LAN)" static 10.10.46.1 primary
netsh interface ip add dns "Connection to the local network (LAN)" 10.16.57.184 index = 2
IF NOT% ERRORLEVEL% == 0 GOTO error
GOTO: EOF
:error
ECHO Unable to configure the network
PAUSE
The first file.bat will have the same parameters as if there were only one pc and we call it "pc1master.bat"
the second we call it "pc2master.bat" and only the first IP address changes (for example 10.10.46.3 instead of 10.10.46.2)
the third one will be "pc1slave.bat" equal to pc1master.bat but as gateway there must be the IP of pc2
the fourth will be "pc2slave.bat" equal to pc2master.bat but as the gateway there must be the IP of pc1.
The files called pc1 must be copied on one pc the pc2 files on the other pc.
6) Final: If pc1 wants to go on the internet and pc2 is off, click on pc1master.bat and then on the provider connection; if pc2 also lights up, on pc2 I click on the pc2slave.bat file and, if everything went well, it is already connected to the internet if pc1 disconnects, pc2 also loses the connection, and vice versa.

Leave Your Comment

Please enter your comment!
Please enter your name here