Directly connect MacBook to Linux desktop via ethernet for fast SSH?

Is it possible to directly connect my MacBook Pro to the Linux box via Ethernet?

Yes, you can directly connect systems via Ethernet. What you would do is on the Linux box you would assign a static IP address in /etc/network/interfaces something like this:

# The local hostmachine access interface.
auto eth1
iface eth1 inet static
address 192.168.99.10
netmask 255.255.255.0

Reboot your machine and now the eth1 physical port will have the IP address of 192.168.99.10.

Now on your Mac, hook up the Ethernet cable and set the network connection to the following IP address:

192.168.99.20

And set the “Subnet Mask” to 255.255.255.0 as well.

Then you will have a magical “two computer network” where the Linux machine has the IP address of 192.168.99.10 and your Mac’s Ethernet port has 192.168.99.20.

And to make your life even easier you can add the Linux equivalent of Bonjour broadcast networking by installing the Avahi daemon. On Ubuntu you would install it like this:

sudo aptitude install avahi-daemon avahi-utils

Then after it installs wait a second or two and on your Mac you will be able to reach the Linux box via it’s hostname. So let’s say your Linux box has a hostname of “LinuxDesktop” with Avahi installed it could be reached via the address of LinuxDesktop.local. And if you pinged LinuxDesktop.local it would return 192.168.99.10.

Now the big “gotcha” here is the actual network address scheme. I am using 192.168.99.x because typical LAN network addresses have the 192.168.x.x prefix octet. But in some cases it might be better for you to go with a 10.x.x.x address. What determines what is “better” is what address range your actual network outside of this Ethernet cable operates on. You basically do not want conflicts. Create a network address range for this Ethernet cable-based network based on an IP range your LAN—or even WAN—is not using.

But honestly, I am pretty sure addresses in the 192.168.99.x range will be fine.


Is it possible to directly connect my MacBook Pro to the Linux box via Ethernet?

Yes. In the old days, you needed an Ethernet cross-over cable. Now a days, I think the engineers build the intelligence into the port (on the desktop or server) so that if the port detects the TX and RX are crossed, then it switches them in the port fabric.

Or will I have to go through the building’s wired connection and then back into my Linux box?

In this case, you should only need a small desktop switch or hub. No need to go through the building's hard lines. In fact, if you have problems with directly connecting them, I would recommend a low-end switch or hub.

... to use my MacBook as my keyboard and main monitor ...

I'm not sure about this...

Directly connect macbook to linux desktop via ethernet for fast SSH?

And, from the title... If you use a switch, then you should not see an appreciable difference. The switch will handle creating the virtual circuit between computers for you.

There are other things this setup does (like not expose one machine to the network), but that does not seem to be a concern for you.