LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 04-23-2017, 11:15 AM   #1
platterofhotfish
LQ Newbie
 
Registered: Apr 2017
Posts: 3

Rep: Reputation: Disabled
Sharing network connection from one linux machine to another via ethernet


Hello all,

I have two linux machines, Both are fairly old computers so I am running lighter distros. I have a laptop running sparky linux and a tower running lubuntu. The laptop has a wireless network card and it works just fine but the tower's network card is ethernet only.

Is it possible to connect the two computers with an Ethernet cable and share the internet connection from the laptop to the desktop?

Eventually I will be buying some new equipment so that this would not be necessary but in the meantime since I have the cable I wanted to know how I would do it.

As far as my level of technical acumen, I work for an ISP in data repair so I am very familiar with networking and TCP/IP. I have used linux many, many times but I never get really deep into it so I would still say I am a beginner to it so please keep the answer simple for me. Thanks!
 
Old 04-23-2017, 01:11 PM   #2
fatmac
Senior Member
 
Registered: Sep 2011
Location: Upper Hale, Surrey/Hants Border, UK
Posts: 3,093

Rep: Reputation: Disabled
Quote:
Originally Posted by platterofhotfish View Post
.... so please keep the answer simple for me. Thanks!
Yes.
 
Old 04-23-2017, 04:54 PM   #3
platterofhotfish
LQ Newbie
 
Registered: Apr 2017
Posts: 3

Original Poster
Rep: Reputation: Disabled
Haha, My fault. Maybe a little more complex than that.
Since it is possible, how would one go about doing this?
 
Old 04-23-2017, 05:40 PM   #4
yancek
LQ Guru
 
Registered: Apr 2008
Distribution: PCLinux, Slackware
Posts: 8,581

Rep: Reputation: 1761Reputation: 1761Reputation: 1761Reputation: 1761Reputation: 1761Reputation: 1761Reputation: 1761Reputation: 1761Reputation: 1761Reputation: 1761Reputation: 1761
What happens when you connect an ethernet cable to your laptop and the other end to the Desktop?
What have you tried?
How do you connect to the internet? Wireless modem, router, etc.. Most wireless modems and routers have ethernet ports.
 
1 members found this post helpful.
Old 04-24-2017, 05:23 AM   #5
michaelk
Moderator
 
Registered: Aug 2002
Posts: 18,921

Rep: Reputation: 2849Reputation: 2849Reputation: 2849Reputation: 2849Reputation: 2849Reputation: 2849Reputation: 2849Reputation: 2849Reputation: 2849Reputation: 2849Reputation: 2849
You can use NetworkManager in each computer to configure the ethernet adapter with a static IP address. Make sure it is not the same as your LAN like 192.168.56.1 and 192.168.56.2 netmask 255.255.255.0. The gateway of the desktop should be the static IP address of the laptop. Add the DNS servers from your ISP to the desktop settings.

On the laptop you need to enable forwarding.
sysctl -w net.ipv4.ip_forward=1

Not sure what firewall is running in sparky or how it is configured so the exact rules might need to be modified but you do need:
iptables -t nat -A POSTROUTING -o wlan0 -j MASQUERADE

Change wlan0 to match your actual wireless adapter device
 
1 members found this post helpful.
Old 04-25-2017, 03:35 PM   #6
jefro
Moderator
 
Registered: Mar 2008
Posts: 19,149

Rep: Reputation: 2918Reputation: 2918Reputation: 2918Reputation: 2918Reputation: 2918Reputation: 2918Reputation: 2918Reputation: 2918Reputation: 2918Reputation: 2918Reputation: 2918
Extra information. https://wiki.debian.org/BridgeNetworkConnections
 
Old 04-26-2017, 03:19 PM   #7
DVOM
Member
 
Registered: Nov 2010
Posts: 223

Rep: Reputation: 48
When I used to do this, I just opened the "edit connection" on the wireless machine, then on the IPv4 tab under "Method" check "shared to other computers". Then run your ethernet cable and you're good to go.
 
Old 04-26-2017, 03:52 PM   #8
Rickkkk
Senior Member
 
Registered: Dec 2014
Location: Montreal, Quebec, CANADA
Distribution: Arch
Posts: 1,104

Rep: Reputation: 417Reputation: 417Reputation: 417Reputation: 417Reputation: 417
I would have the same question as Yancek at this point: how is your laptop even connecting to the internet ? I would assume as well that it's via some router or modem and that a simpler solution would be to connect the tower directly to the router instead of using the laptop as a gateway.

If for some reason this is not possible, then michaelk has provided some pretty detailed info in post #5 on how to set up using the laptop as a gateway.

Cheers,
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Mounting a windows drive on a Linux machine (connected via an ethernet network) eddydw Linux - Networking 13 01-03-2009 03:13 PM
sharing net connection with xp machine frosty_kgp Linux - Networking 1 08-23-2005 12:44 AM
Network connection sharing XP+Linux Maverick1182 Linux - Networking 19 09-04-2004 03:06 AM
linux network ethernet cat 5 connection. xviddivxoggmp3 Red Hat 13 07-17-2004 02:15 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 07:28 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration