Set Up a Wired 1 to 1 Network Connection Between Two Computers

centosethernetnetworkingwindowswindows 8.1

I have two computers connected by an Ethernet cable. One is a Windows 8.1 devbox, and the other is a CentOS 7 development server with only a terminal interface (No GUI). The development server will at first only interface with the devbox.

How can I set up Windows 8.1 to enable PuTTY SSH connections to the CentOS 7 server through the Ethernet cable?

Here is a screen shot of the Network Connections dialog box in Windows 8.1 showing that it sees the Ethernet connection, but is calling it unidentified by default:

enter image description here

I need to learn the IP of the CentOS 7 server box and also set up home networking to make the connection happen. However what specific steps do I take to set this up?

Best Answer

As there is no routing device between the two, you need to assign an IP address for each of them, additionally being both in the same subnet. So, for example, you can assign the IP address (assuming these are not used, otherwise, you need to choose a different LAN segment):

192.168.100.1 and 255.255.255.0 to the Windows box. 192.168.100.2 and 255.255.255.0 to the Linux box.

For the windows machine:

  • Right click on the interface you refer on the snapshot, and click Properties.
  • Click on Internet Protocol Version 4 (IPv4)
  • Click on Use the following IP address
  • As the IP address field, enter 192.168.100.1 (or a different one if this is already been used)
  • As the subnet mask, enter 255.255.255.0

For the linux machine:

You need to find out which interface matches your physical interface. To do that, you can access the /etc/sysconfig/network-scripts directory and run ls ifcfg-*. You'll get one file for each network address card you have. To edit the settings of the one that is connected, assuming it's called ifcfg-eth0, you would run vi ifcfg-eth0 (vi is the editor, you can use nano or pico or whatever you feel comfortable with), and put a content like this:

DEVICE="eth0"
NM_CONTROLLED="no"
ONBOOT=yes
TYPE=Ethernet
BOOTPROTO=static
IPADDR=192.168.100.2
NETMASK=255.255.255.0

Then you just need to run:

ifdown eth0 && ifup eth0

There's no need for a gateway since as said there's no routing (and is not needed).

Now, on the linux box, you need to make sure that the sshd daemon is listening to that interface too. You can check that running:

netstat -atpn

And see what is the local address for SSH. It should be something like 0.0.0.0:22. That would mean it listens to all interfaces, which is what you need. If not, you'll need to edit your /etc/ssh/sshd_config file and make it listen for this P2P interface as well.

Related Question