How to network two Ubuntu computers using ethernet (without a router)?

  command line example cause it is so quick and simple.

  On newer version of Linux the network card names have changed. , . Look for something with similar names to being ethernet / being wireless.

  You would need to update the below command to use different etc.

  On computer A

  sudo ip ad add dev eth0

  On computer B

  sudo ip ad add dev eth0

  To test from A to B


  To test from B to A


  Provided that a cable is connecting the two computers and the network interface on both of them is enabled and called eth0 this should work. The rest of this post is to help trouble shoot if there are problems.

  10.0.0.xx is the ip address of the computers.

  /24 tells the computers that the last 8 bits of the 32 bit ip address can change. It is similar to saying netmask This set ups the routes that the computer / network has available to it.

  you should see some thing similar to this using

  ip route dev eth0 proto kernel scope link src

  If you don’t see some thing like above in the route table but see some thing like this when you use ip ad. You need add the address again using /24 subnet syntax.

  ip ad

  inet scope global eth0

  Notice the /32 which effectively is saying that is the only computer that exists on a network of one computer. Which is its self. Net mask Hence no routes and the network does not work.

  To find out which network interfaces you have and which are working

  # ip ad

  1: lo: mtu 16436 qdisc noqueue

  link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00

  inet scope host lo

  inet6 ::1/128 scope host

  valid_lft forever preferred_lft forever

  2: eth0: mtu 1500 qdisc pfifo_fast qlen 1000

  link/ether 46:fd:51:f9:f5:2e brd ff:ff:ff:ff:ff:ff

  inet brd scope global eth0

  inet scope global eth0

  inet scope global eth0

  inet6 fe80::44fd:51ff:fef9:f52e/64 scope link

  valid_lft forever preferred_lft forever

  3: eth1: mtu 1500 qdisc noop qlen 1000

  link/ether 72:3f:92:eb:a4:cc brd ff:ff:ff:ff:ff:ff

  If you need to delete an ip address cause you made a mistake

  ip ad del dev eth0

  ip ad del dev eth0

  This will remove the routes as well as the ip address.

Leave a Comment