Unable to connect two machines through an Ethernet cable

2

I have 2 Ubuntu machines, connected via Ethernet cable, machine A at interface eth0 and machine B at eth6. I have configured IP on both machine.

ifconfig -a on machine A (showing for eth0 only):

eth0      Link encap:Ethernet  HWaddr 98:90:96:9b:83:f1  
          inet addr:100.0.2.1  Bcast:100.0.2.255  Mask:255.255.255.0
          inet6 addr: fe80::9a90:96ff:fe9b:83f1/64 Scope:Link
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:372 errors:0 dropped:0 overruns:0 frame:0
          TX packets:280 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:101005 (101.0 KB)  TX bytes:30148 (30.1 KB)
          Interrupt:20 Memory:f7c00000-f7c20000

route -n on Machine A:

Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         203.135.63.1    0.0.0.0         UG    0      0        0 eth3
100.0.2.0       0.0.0.0         255.255.255.0   U     0      0        0 eth0
169.254.0.0     0.0.0.0         255.255.0.0     U     1000   0        0 eth3
203.135.63.0    0.0.0.0         255.255.255.192 U     1      0        0 eth3

ifconfig -a on Machine B (Showing for eth6 only)

eth6      Link encap:Ethernet  HWaddr ec:08:6b:0b:85:72  
          inet addr:100.0.2.3  Bcast:100.0.2.225  Mask:255.255.255.0
          inet6 addr: fe80::ee08:6bff:fe0b:8572/64 Scope:Link
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:1 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:0 (0.0 B)  TX bytes:90 (90.0 B)

route -n on machine B:

Kernel IP routing table Destination     Gateway         Genmask        Flags Metric Ref    Use Iface
0.0.0.0         10.102.72.1     0.0.0.0         UG    0      0        0 eth7
10.102.72.0     0.0.0.0         255.255.254.0   U     1      0        0 eth7
100.0.0.0       0.0.0.0         255.0.0.0       U     0      0        0 eth0
100.0.2.0       0.0.0.0         255.255.255.0   U     0      0        0 eth6
169.254.0.0     0.0.0.0         255.255.0.0     U     1000   0        0 eth0

When I ping 100.0.2.1 from machine B, I get this:

PING 100.0.2.1 (100.0.2.1) 56(84) bytes of data.
From 100.0.2.3 icmp_seq=1 Destination Host Unreachable
From 100.0.2.3 icmp_seq=2 Destination Host Unreachable
From 100.0.2.3 icmp_seq=3 Destination Host Unreachable
From 100.0.2.3 icmp_seq=4 Destination Host Unreachable
From 100.0.2.3 icmp_seq=5 Destination Host Unreachable
From 100.0.2.3 icmp_seq=6 Destination Host Unreachable
From 100.0.2.3 icmp_seq=7 Destination Host Unreachable
From 100.0.2.3 icmp_seq=8 Destination Host Unreachable
From 100.0.2.3 icmp_seq=9 Destination Host Unreachable
^C
--- 100.0.2.1 ping statistics ---
11 packets transmitted, 0 received, +9 errors, 100% packet loss, time 10054ms
pipe 3

Please let me know what I am doing wrong.

Ramzah Rehman

Posted 2018-09-19T08:44:49.883

Reputation: 35

1Why are you using 100.0.0.0/8 for your internal network? You're squatting on Verizon's IP space, as well as Sprint's, Amazon EC2's, T-Mobile's, &c… The only reserved "private use" space in that region is actually 100.64.0.0/10 with netmask 255.192.0.0. That is of course, unless you meant 10.0.0.0/8 (one zero). – user1686 – 2018-09-19T08:51:54.487

You should be using a crossover Ethernet cable. Are you?

– harrymc – 2018-09-19T09:39:04.243

3

@harrymc: Should you? Crossover cables are generally a thing of the past now.

– user1686 – 2018-09-19T10:00:29.007

1The first thing that stands out are the overlapping routes on machine B (100.../8 on eth0), on top of eth0 having a link-local address. You didn't say what's behind eth0 there, but remove this route, and see if the ping then works. Also use ip route get 100.0.2.1 on B to test if routing is correct. And while you are at it, change the `100...IP range to a proper private IP range, e.g.10.../8and10.0.2./24`, as the other comment said. – dirkt – 2018-09-19T10:07:52.457

Investigating with ip route get is a good idea, but generally routes are longest-prefix-match so it would be very curious if that were the problem. (Indeed most computers have 2–3 overlapping routes anyway.) – user1686 – 2018-09-19T10:52:04.193

Answers

1

One reason for such a problem is that you are not using a crossover Ethernet cable or a crossover adapter.

Gigabit Ethernet crossover cable endsGigabit Ethernet crossover cable ends

8P8C modular crossover adapter8P8C modular crossover adapter

harrymc

Posted 2018-09-19T08:44:49.883

Reputation: 306 093

3This seems unlikely given the nearly ubiquitous prevalence of auto-MDIX NICs. – I say Reinstate Monica – 2018-09-19T11:01:37.517

This was the issue, I had connected one end of the crossover cable it to a USB port via TP-LINK Ethernet Adapter, which didn't work. Thank you! – Ramzah Rehman – 2018-09-19T11:14:30.750

@RamzahRehman You already had a crossover cable, and it wasn't working? – Xen2050 – 2018-09-19T11:58:47.157

@Xen2050 Believe it or not, there are some media access controllers out there that technically implement MDI-X, but don't work correctly if there is a crossover cable involved. I've not seen one in quite a while, and I've never seen a Gigabit one, but a handful of older computers I've dealt with that had 100BaseT cards had the same issues. – Austin Hemmelgarn – 2018-09-19T18:37:33.370

@AustinHemmelgarn That's what it sounded like... OP already tried a crossover cable and it was not working, but if true then why would he pick this answer as the correct one? It's the opposite of what solved the problem...? – Xen2050 – 2018-09-20T05:02:39.780

@Xen2050 I had a crossover cable but I had not plugged it in crossover adapter, I had plugged it in a USB adapter, not a 8P8C modular crossover adapter. That's why it didn't work. – Ramzah Rehman – 2018-09-20T11:29:46.173

1@RamzahRehman But using a crossover cable together with a crossover adapter... that just turns it back into a regular (patch) cable – Xen2050 – 2018-09-20T11:38:21.170