How to setup a network between a windows computer and a linux computer?

Published on Author Code Father

In order to acquire an IP adress on the Linux machine using the DHCP method you have to install an DHCP-Server on the Windows machine first and configure it.

I assume that is not really what you want. In order to exchange network packages between both hosts you have to assure that both hosts are on the same network. In this hardware setting the best way to do so is to manually set up static network configurations on both hosts.

Configuration on the Windows (7?) machine:

When the cable is connected via ethernet your networking notifier in the windows task bar should show a wired connection symbol (or a spinning circle notifying you it is trying to automatically get an IP via DHCP).

Click on the symbol and then open the network and sharing center. On the right hand side of the upcoming window you should see something like an underlined “LAN-connection 1”. Click on it an then go to “Properties”. In the upcoming list mark “Internet Protocol Version 4 (TCP/IPv4)” and then again click on “Properties”. Now check “Use the following IP-Adresses” (or something like that – I only have the german version of Windows on my screen and can’t tell what the exact english translation is). Now type in the following fields:

  • IP-adress:
  • subnet mask:
  • gateway: (does not matter as there is no way out of your small two host network. Using the following configuration steps, your Linux host will be the gateway host)

Confirm by clicking “OK”.

Configuration on the Linux machine (Debian/Ubuntu):

Open up a terminal window and do the following commands (as superuser):

ifconfig enp5s0 up
ifconfig enp5s0
ifconfig enp5s0 netmask

You have now set up a small network containing the two hosts with the Linux machine being the gateway host (when the Linux host has a second interface connected to an WAN and the forwarding is set up properly then it can act as a “real” internet-gateway for the windows machine).

Verify the setup using the ping command on the both hosts (the terminal can be used on both OSes to do so).

On the Linux machine:


On the Windows machine:


And both should consecutively show up successfully issued ping packets.