You are not logged in.

#1 2014-12-21 10:18:20

kuba_66
Member
Registered: 2012-12-07
Posts: 28

Easiest way to share internet connection?

Please advise the easiest way to share internet  connection. I have a default network setup. Just a desktop with dhspcd for client connections and no network manager. I've inserted another nic and want to share internet connection with another computer.
I followed instructions from "Internet sharing" and "dhcpd" wikis, but these articles aren't foolproof enough for me. I'm getting the following errors:

systemctl status dhcpd4@enp1s9.service
● dhcpd4@enp1s9.service - IPv4 DHCP server on enp1s9
   Loaded: loaded (/etc/systemd/system/dhcpd4@.service; enabled; vendor preset: disabled)
   Active: failed (Result: exit-code) since nie 2014-12-21 10:45:53 CET; 3min 3s ago
  Process: 291 ExecStart=/usr/bin/dhcpd -4 -q -pf /run/dhcpd4.pid %I (code=exited, status=1/FAILURE)

gru 21 10:45:53 jakamal dhcpd[291]: 
gru 21 10:45:53 jakamal dhcpd[291]: 
gru 21 10:45:53 jakamal dhcpd[291]: Not configured to listen on any interfaces!
gru 21 10:45:53 jakamal dhcpd[291]: 
gru 21 10:45:53 jakamal dhcpd[291]: If you think you have received this message due to a bug rather
gru 21 10:45:53 jakamal dhcpd[291]: than a configuration issue please read the section on submitting
gru 21 10:45:53 jakamal systemd[1]: dhcpd4@enp1s9.service: control process exited, code=exited status=1
gru 21 10:45:53 jakamal systemd[1]: Failed to start IPv4 DHCP server on enp1s9.
gru 21 10:45:53 jakamal systemd[1]: Unit dhcpd4@enp1s9.service entered failed state.
gru 21 10:45:53 jakamal systemd[1]: dhcpd4@enp1s9.service failed.

Offline

#2 2014-12-21 12:29:17

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,480
Website

Re: Easiest way to share internet connection?

Which wiki page have you followed?  Which method did you use?

I believe you should be following this page but that shows four distinct methods.


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#3 2014-12-21 18:54:42

ewaller
Administrator
From: Pasadena, CA
Registered: 2009-07-13
Posts: 20,655

Re: Easiest way to share internet connection?

Or, if you prefer a NAT configuration,  this page


Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
The shortest way to ruin a country is to give power to demagogues.— Dionysius of Halicarnassus
---
How to Ask Questions the Smart Way

Offline

#4 2014-12-21 20:09:56

TheSaint
Member
From: my computer
Registered: 2007-08-19
Posts: 1,536

Re: Easiest way to share internet connection?

If it is a wired connection between 2 computer, why do you want to use DHCP, better static IP and adjust iptables rule as ewaller pointed.


do it good first, it will be faster than do it twice the saint wink

Offline

#5 2014-12-24 03:56:50

kuba_66
Member
Registered: 2012-12-07
Posts: 28

Re: Easiest way to share internet connection?

Trilby, ewaller, The Saint: thanks for your replies.
@Trilby
I followed these wikis: Internet sharing and dhcpd, but yes, a bridge is simpler, so I'll go for it. After Christmas, I think.

Trilby wrote:

(...) but that shows four distinct methods

– that's a bit of a problem, but I'll try method 1.
@TheSaint
I need a socket to plug in various devices without configuring them, so DHCP suits me better.

Going back on all the commands I had issued in following the said wikis was difficult. I hope I've managed to revert to defaults.

Offline

#6 2014-12-24 07:01:09

TheSaint
Member
From: my computer
Registered: 2007-08-19
Posts: 1,536

Re: Easiest way to share internet connection?

That's means that every DHCP lease will get its own iptable rule. It will take a bit of scripting, I think.


do it good first, it will be faster than do it twice the saint wink

Offline

#7 2014-12-28 04:52:35

kuba_66
Member
Registered: 2012-12-07
Posts: 28

Re: Easiest way to share internet connection?

Setting up a bridge is easy, but i get disconnected by my provider (one computer policy), and it doesn't survive reboots, so I need a NAT anyway.
Trouble is I can't configure my internal interface to use dhcpd on it.
How do I make this persistent:

#ip addr add 139.96.30.100/24 dev eth0

?
In other systems I can configure interfaces with /etc/network/interfaces, but there is no such thing here.
Or in other words, what should be done to enable NAT with DHCP in a few steps? Writing bash scripts doesn't seem a proper solution. I tried using shorewall – it starts, but I can't get it to route and the local interface isn't persistent either. Neither did Firestarter work for me.

Last edited by kuba_66 (2014-12-28 05:12:21)

Offline

#8 2014-12-28 06:52:23

TheSaint
Member
From: my computer
Registered: 2007-08-19
Posts: 1,536

Re: Easiest way to share internet connection?

Please try last wiki wink


do it good first, it will be faster than do it twice the saint wink

Offline

#9 2014-12-28 12:18:18

kuba_66
Member
Registered: 2012-12-07
Posts: 28

Re: Easiest way to share internet connection?

@The Saint
Do you mean I should manually assign a static IP to my local interface using Persistent configuration on boot using systemd? It's so ruddy complicated! I am deliberately posting in the Newbie Corner to find a simple solution.
What address, subnet, netmask, etc. should I choose if my primary interface has: inet 192.168.0.11  netmask 255.255.255.0  broadcast 192.168.0.255, if it matters at all?
Or perhaps I could use netctl to set up the interface as suggested here: [link=https://wiki.archlinux.org/index.php/NAT%27ing_firewall_-_Share_your_broadband_connection#IP_configuration]IP configuration[/link], but I am not sure what provides the existing connection. It's a default setup. I think it's dhcpcd. Would it be OK to have one interface configured through dhcpcd and another through netctl?

Last edited by kuba_66 (2014-12-28 12:34:29)

Offline

#10 2014-12-28 14:37:48

Xyne
Forum Fellow
Registered: 2008-08-03
Posts: 6,965
Website

Re: Easiest way to share internet connection?

You may find this useful, at least as an example. I have added a link to the Internet sharing wiki page.


My Arch Linux StuffForum EtiquetteCommunity Ethos - Arch is not for everyone

Offline

#11 2014-12-29 00:37:40

kuba_66
Member
Registered: 2012-12-07
Posts: 28

Re: Easiest way to share internet connection?

Thank you for sharing, Xyne. Your script is a great way for an ad-hoc dhcp server. I was looking for a more stateful solution.

Offline

#12 2014-12-29 02:45:59

TheSaint
Member
From: my computer
Registered: 2007-08-19
Posts: 1,536

Re: Easiest way to share internet connection?

What Xyne pointed and what is in create_ap are the keys to your solutions. It takes some little study.
If you have other distro that semplify your doing, also those may give you the clues.


do it good first, it will be faster than do it twice the saint wink

Offline

#13 2014-12-29 13:24:15

kuba_66
Member
Registered: 2012-12-07
Posts: 28

Re: Easiest way to share internet connection?

Thanks for the link to create_ap, Saint. Yes, Xyne's ingredients are very good.

Offline

#14 2014-12-30 03:16:00

TheSaint
Member
From: my computer
Registered: 2007-08-19
Posts: 1,536

Re: Easiest way to share internet connection?

You aren't lonely, let us know your developments. If you have more questions don't hesitate to ask for more.
I'm keen to give my best.


do it good first, it will be faster than do it twice the saint wink

Offline

#15 2014-12-30 03:49:33

Xyne
Forum Fellow
Registered: 2008-08-03
Posts: 6,965
Website

Re: Easiest way to share internet connection?

kuba_66 wrote:

Thank you for sharing, Xyne. Your script is a great way for an ad-hoc dhcp server. I was looking for a more stateful solution.

After adapting the subnet launcher script to your needs, you could just create and enable a systemd service file to start and stop it using the ExecStart and ExecStop options, respectively. See the service file manpage for details.


My Arch Linux StuffForum EtiquetteCommunity Ethos - Arch is not for everyone

Offline

Board footer

Powered by FluxBB