Ubuntu – How to connect two laptops with ethernet patch cable to share files

14.04ethernetnetwork-managernetworkingwindows 8

I have the same problem as this question( How do I connect my desktop and my laptop using an ethernet cable to transfer files? ).

I could not comment on the answer selected by OP, because of not having enough reputation. That's why I am posting my query as another question for clear answer.

My question is: How do I set the ip address for each machine? Because I have connected the windows laptop with ubuntu laptop with ethernet cat6 patch cable, but the windows laptop shows it to be an unidentified network. So, then I tried to change my ipv4 addresses for the ethernet connection on both machines and did this respectively with no luck(I could not post images directly because of not enough reputation and so, gave the links instead)

Windows 8.1,
Ubuntu 14.04.3

P.S: I am fairly new to networking and Linux. So, any detailed help on this will be much appreciated. Moreover, yes, I have googled, but could not find/understand a solution or got a solution to work for my problem.

Best Answer

On the Linux machine run this command:

sudo ifconfig address 169.254.5.1 netmask 255.255.0.0

On the windows machine, you will need to run a command prompt as Administrator and run this command:

netsh interface ip set address name="Local Area Connection" static 169.254.5.2 255.255.0.0 169.254.5.1 1

You can replace the 169.254.*.* with whatever almost address you want, although it is highly recommended to stay in the 169.254.*.* block.

Keep in mind that Windows will always say Unknown Network for an ad-hoc connection like this. The only way to get around it is to buy a router or a switch. If you want to enable Homegroup, then you'll need to change your network location (multiple ways to do so in Windows, covered here) to private/Home.