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 |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
|
04-23-2017, 11:15 AM
|
#1
|
LQ Newbie
Registered: Apr 2017
Posts: 3
Rep:
|
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!
|
|
|
04-23-2017, 01:11 PM
|
#2
|
LQ Guru
Registered: Sep 2011
Location: Upper Hale, Surrey/Hants Border, UK
Distribution: One main distro, & some smaller ones casually.
Posts: 5,632
Rep:
|
Quote:
Originally Posted by platterofhotfish
.... so please keep the answer simple for me. Thanks!
|
Yes.
|
|
|
04-23-2017, 04:54 PM
|
#3
|
LQ Newbie
Registered: Apr 2017
Posts: 3
Original Poster
Rep:
|
Haha, My fault. Maybe a little more complex than that.
Since it is possible, how would one go about doing this?
|
|
|
04-23-2017, 05:40 PM
|
#4
|
LQ Guru
Registered: Apr 2008
Distribution: Slackware, Ubuntu, PCLinux,
Posts: 10,794
|
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.
|
04-24-2017, 05:23 AM
|
#5
|
Moderator
Registered: Aug 2002
Posts: 26,128
|
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.
|
04-25-2017, 03:35 PM
|
#6
|
Moderator
Registered: Mar 2008
Posts: 22,110
|
|
|
|
04-26-2017, 03:19 PM
|
#7
|
Member
Registered: Nov 2010
Posts: 223
Rep:
|
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.
|
|
|
04-26-2017, 03:52 PM
|
#8
|
Senior Member
Registered: Dec 2014
Location: Montreal, Quebec and Dartmouth, Nova Scotia CANADA
Distribution: Arch, AntiX, ArtiX
Posts: 1,364
|
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,
|
|
|
All times are GMT -5. The time now is 10:08 AM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|