Sharing Internet Between Two Computers via Ethernet: Linux to Windows
In this article, we will discuss how to share an Internet connection between two computers, one running Linux and the other running Windows, using an Ethernet connection. The Windows machine is connected to the Internet via a USB modem.
Prerequisites
- Two computers, one running Linux and the other running Windows
- An Ethernet cable to connect the two computers
- A USB modem connected to the Windows machine
Setting up the Ethernet Connection
First, connect the two computers using an Ethernet cable. Once connected, follow the steps below for each operating system to configure the Ethernet connection:
On Linux:
- Go to the network settings and click on the wired connection.
- Configure the IPv4 settings to use the following values:
- Address: 192.168.0.2
- Netmask: 255.255.255.0
- Gateway: 192.168.0.1
# nmcli connection modify "Wired connection 1" ipv4.addresses 192.168.0.2/24 ipv4.gateway 192.168.0.1
# nmcli connection up "Wired connection 1"
On Windows:
- Go to the network settings and click on the Ethernet connection.
- Configure the IPv4 settings to use the following values:
- IP address: 192.168.0.1
- Subnet mask: 255.255.255.0
- Default gateway:
netsh interface ip set address "Ethernet" static 192.168.0.1 255.255.255.0
netsh interface ip set dns "Ethernet" static 8.8.8.8
Sharing the Internet Connection
Once the Ethernet connection is set up, follow the steps below to share the Internet connection from the Windows machine to the Linux machine:
- Go to the network sharing settings and click on the Ethernet connection.
- Check the box to allow other network users to connect through this computer's Internet connection.
- Select the Ethernet connection as the home network connection.
netsh interface portproxy add v4tov4 listenport=8080 listenaddress=0.0.0.0 connectport=80 connectaddress=192.168.0.2
Testing the Connection
To test the connection, open a web browser on the Linux machine and navigate to a website. If the connection is working, the website should load as expected. If not, check the Ethernet connection and the network sharing settings on the Windows machine.
- Connect the two computers using an Ethernet cable.
- Configure the Ethernet connection on both computers.
- Share the Internet connection from the Windows machine to the Linux machine.
- Test the connection.
References
-
Book:
William E. Shotts, Jr. "The Linux Command Line: A Complete Introduction". No Starch Press, 2012. -
Article:
"How to Share an Internet Connection in Windows 10". How-To Geek. -
Online Resource:
"NetworkManager Command Line Interface". GNOME Developer Center.