Connect two computers running Fedora Linux via ethernet

Connect the computers

Option 1: Plug the computers into the same router.

Option 2: Connect the computers using a crossover cable.

Assign IP addresses

Make sure that both computers have IP addresses and share the same netmask.

ifconfig eth0

If a computer does not have an IP address, you must assign one. In the following example, we are assigning the computer an IP address of using netmask over ethernet device eth0. Remember that both computers must have different IP addresses and the same netmask.

    ifconfig eth0 netmask up

You can have a computer assign itself a static IP through the NetworkManager applet. Checking the Available to all users option assigns the static IP without requiring a login at boot. This is useful if the computer you are preparing might not have a monitor or keyboard attached to it in the future.

Edit Connections
            IPv4 Settings
                Method: Manual
            Available to all users: Checked

Start SSH server on host

Start the SSH server daemon on the computer that you want to access remotely.

    service sshd start

You can have the SSH server start automatically every time you restart the computer by enabling the service. The easiest way to do this is by installing system-config-services, selecting sshd and clicking Enable.

    yum -y install system-config-services

Open SSH port in firewall on host

Even though you might see SSH checked in system-config-firewall, the port might not actually be open. Uncheck and check SSH, then click Apply. The following line should be visible when you run iptables-save as root.

-A INPUT -p tcp -m state --state NEW -m tcp --dport 22 -j ACCEPT

SSH into the host

Here we SSH into the computer with IP address with agent key and trusted X11 forwarding. Key forwarding passes the SSH keys of our client computer so that we can access our Git repositories. X11 forwarding lets us run programs on the host computer that require an X11 graphical display.

ssh -A -Y

You might want to write a Bash script to automate the client-side connection, assuming that the host has a static IP.

if [[ ! `ifconfig eth0` =~ $IP_LOCAL ]]
    su -c 'ifconfig eth0 $IP_LOCAL netmask $NETMASK up'
ssh -A -Y $IP_REMOTE


SSH to a remote computer behind a router

If you want to SSH remotely into a host computer that is behind a router, you might need to enable port forwarding on the router to port 22 of the local IP address of your host computer. Router configuration settings are usually accessible at You can tell when your computer is behind a router if your internal IP address as returned by ipconfig is different from your external IP address as returned by IP lookup websites.

Set wireless card as internet source when ethernet cable is connected

Suppose you have SSHed into a monitor-less computer with your laptop using the instructions above. Suppose also that you want the monitor-less computer to use its own wireless card for internet. Make sure the monitor-less computer is connected to the wireless network and try the following.

    service NetworkManager stop
    ip route del default
    ip route add default via