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.

  • 1
    Why 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). – grawity Sep 19 '18 at 8:51
  • You should be using a crossover Ethernet cable. Are you? – harrymc Sep 19 '18 at 9:39
  • 3
    @harrymc: Should you? Crossover cables are generally a thing of the past now. – grawity Sep 19 '18 at 10:00
  • 1
    The 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.*.*.*/8 and 10.0.2.*/24, as the other comment said. – dirkt Sep 19 '18 at 10:07
  • 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.) – grawity Sep 19 '18 at 10:52
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

  • 3
    This seems unlikely given the nearly ubiquitous prevalence of auto-MDIX NICs. – Twisty Impersonator Sep 19 '18 at 11:01
  • 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 Sep 19 '18 at 11:14
  • @RamzahRehman You already had a crossover cable, and it wasn't working? – Xen2050 Sep 19 '18 at 11:58
  • @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 Sep 19 '18 at 18:37
  • 1
    @RamzahRehman But using a crossover cable together with a crossover adapter... that just turns it back into a regular (patch) cable – Xen2050 Sep 20 '18 at 11:38

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.