0

I am simply lost and very frustrated. I have 2 computers running Mageia (5) linux and to connect them together directly using crossover cable. So, my programs can communicate Ethernet to Ethernet. For the life, I can't seem to figure out how to do it. I searched on Google and Searched on sites like Stackoverflow for solution and followed some of the steps suggested by these answers. Nothing seem to help. I went on Mageia Website and on one of the page says simply set the ip address and netmask for each machine and connect them together with cable. Then, test the connection, which didn't WORK AT ALL. When I do add gateway 192.168.1.1 along with ip address and netmask and everything else blank, it says I am connected. However, when I try to PING the other machine, it says HOST is unreachable.

Any help or guidance will be greatly appreciated.

2
  • I think you'll need to disable wireless on both (in case it's active), set a static IP on both, say 192.168.1.10 on one, and 192.168.1.11 on the other, set gateway to 192.168.1.1, subnet mask to 255.255.255.0, restart networking (or reboot). Unfortunately I can't provide definitive steps hence this is a comment and not an answer ;-) Commented Nov 1, 2016 at 17:25
  • Please provide more details, e.g. what ip addresses you set on machines, what is netmask on both, how do you manage to set these configs. It would be better to provide what you have done step by step. The things you mention seem ok, there maybe small details you are forgetting.
    – vfsoraki
    Commented Nov 1, 2016 at 19:02

1 Answer 1

0

It should not be that difficult... were it not for your network manager, which tries to get an IP address from a non-existent DHCP server, and then gives precedence to the wired connection over the wifi, thus erasing your default gateway, and shutting you off from the Internet. So: stop your network manager

 systemctl stop network-manager
 service network-manager stop

(I do not know whether Mageia uses systemd or not, but at least one of the commands above will work), then give an IP address to your cable interface

ip addr add 10.0.122.1/24 dev eth0

(if the interface is not called eth0 please adjust accordingly). No need to add other routes. Do exactly the same on the other pc, except you will have to use

 ip addr add 10.0.122.2/24 dev eth0 

, i.e. a different IP address. Now you should be able to ping one machine from the other.

If you need to transfer data via wifi simultaneously, you will have to do that manually because network-manager will plunge you into the same pit you just dug yourself out of. So:

ip route del default
wpa_passphrase MyNetworkName MySecretPassword > mydata.txt
wpa-Supplicant -B -i wlan0 -Dnl80211 -c mydata.txt
dhclient -v wlan0 

And you should be good to go. If not, please just add the follwoing routing rule:

ip route add default via IPAddressOfYourRouter dev wlan0

and now you can do whatever you like. If you also need to have data go to the other pc, then you will have to give these commands on the pc which is connected via wifi:

 echo 1 > /proc/sys/net/ipv4/ip_forward
 iptables -t nat -A POSTROUTING -o wlan0 -j MASQUERADE

while on the pc which is only connected via cable,

 ip route add default via 10.0.122.1 dev eth0

and you are done.

When done, unplug the cable and restart the network-manager.

2
  • I tried to disable or shutdown the network-manager with systemctl stop network-manager, but it came back and said that it failed and that network-manager not loaded. So, I then proceeded with the next step in your answer, which it didn't complain about and I did the same on the other machine. However, I still can't ping the other machines from either of the machines. I keep getting Host unreachable. I skipped the wifi setup. Mine setup is strictly through Ethernet cable.
    – ThN
    Commented Nov 2, 2016 at 15:37
  • @Thn Please post yor routing tables, on both pcs. Commented Nov 2, 2016 at 16:46

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .