You are not logged in.

#1 2017-01-24 14:17:57

ttomsen89
Member
Registered: 2017-01-24
Posts: 9

[SOLVED] Sharing wifi via ethernet failed

Hello everyone,
the headline points to my problem.
I want to share the wifi-signal, that I receive from a router, via an ethernet-cable with another PC.

I already tried to solve it myself with wiki.archlinux.org/Network_configuration  and this help.ubuntu.com/.../connectionsharing

There seems to be a connection between the PCs (I get desktop messages, that tell me so). But when I try browse the internet, no success.
I'm relatively new to Linux Arch. I really love that (usually) things work just fine, so I mostly just use it. But I always like to learn something new about it.

For your information, I use network-manager.

# ip addr 

prints this

 1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: enp2s0f0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
    link/ether 20:1a:06:14:88:80 brd ff:ff:ff:ff:ff:ff
3: wlp3s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
    link/ether 48:d2:24:da:60:50 brd ff:ff:ff:ff:ff:ff
    inet 192.168.0.14/24 brd 192.168.0.255 scope global dynamic wlp3s0
       valid_lft 85501sec preferred_lft 85501sec
    inet6 fe80::4ad2:24ff:feda:6050/64 scope link 
       valid_lft forever preferred_lft forever

Can someone help me?
Thanks in advance,
tt

Last edited by ttomsen89 (2017-01-25 16:07:20)

Offline

#2 2017-01-24 14:26:30

Slithery
Administrator
From: Norfolk, UK
Registered: 2013-12-01
Posts: 5,776

Re: [SOLVED] Sharing wifi via ethernet failed

How about trying the page in the Arch wiki instead of the Ubuntu one?

https://wiki.archlinux.org/index.php/Internet_sharing


No, it didn't "fix" anything. It just shifted the brokeness one space to the right. - jasonwryan
Closing -- for deletion; Banning -- for muppetry. - jasonwryan

aur - dotfiles

Offline

#3 2017-01-24 14:52:10

ttomsen89
Member
Registered: 2017-01-24
Posts: 9

Re: [SOLVED] Sharing wifi via ethernet failed

I did this, too. But first the ethernet seemed to block the wifi, and now it's trying to connect without success (on the client)

Offline

#4 2017-01-24 15:16:07

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

Re: [SOLVED] Sharing wifi via ethernet failed

If you followed that guide, I would have expected enp2s0f0 to have a static IPv4 address.  It doesn't, so you need to fix that.  The address space for that interface should not be in 192.168.0.x0/24.  I suggest 192.168.1.1.
After you get that sorted, set up dhcpd (not to be confused with dhcpcd)  to provide DHCP services to the 192.168.1.0/24 network.  Read your journal to ensure it is working.  Connect a client computer via a cable to enp2s0f0.  Check that all the link light come on.  Verify that the computer is able to get an address in the 192.168.1.x/24 space from the Arch box.  Verify the Arch box can ping the client.  Verify the client can ping the Arch box.

Now you are ready to enable NAT.


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

#5 2017-01-24 16:25:19

The Loko
Member
From: Spain
Registered: 2014-07-23
Posts: 103

Re: [SOLVED] Sharing wifi via ethernet failed

You can also use Network Manager creating a new wired connection and setting IPv4 mode to "Shared to other computers". This will assign a static IP and enable a DHCP server.
Then set the client PC to use DHCP.

Offline

#6 2017-01-24 17:10:51

ttomsen89
Member
Registered: 2017-01-24
Posts: 9

Re: [SOLVED] Sharing wifi via ethernet failed

@ewaller

This are are too many steps for me. I'm reading in the wiki to figure out what to do, but so far didn't fully understand.

I entered this

# ip addr add 192.168.1.1 dev enp2s0f0

# ip addr show enp2s0f0

2: enp2s0f0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
    link/ether 20:1a:06:14:88:80 brd ff:ff:ff:ff:ff:ff
    inet 192.168.1.1/32 scope global enp2s0f0
       valid_lft forever preferred_lft forever

It' strange, that when I ping the other mashine my IP seems to 192.168.0.14

# ping -c3 192.168.0.11
PING 192.168.0.11 (192.168.0.11) 56(84) bytes of data.
From 192.168.0.14 icmp_seq=1 Destination Host Unreachable
From 192.168.0.14 icmp_seq=2 Destination Host Unreachable
From 192.168.0.14 icmp_seq=3 Destination Host Unreachable

How do I set up dhcpd? I read wiki.archlinux/Dhcpd and created  the conf-file with minimal configuration. Is that all?

@The Loko

This was my preferred option, but it didn't work.

Offline

#7 2017-01-24 17:38:53

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

Re: [SOLVED] Sharing wifi via ethernet failed

This is very important.  There are two network cards.  There are two networks. One of those networks is 192.168.0.0/24, the other is 192.168.1.0/24.

The "other machine" will have a 192.168.1.0/24 address.  What address does it report?   From that machine, you want to ping 192.168.1.1; the address of  enp2s0f0
Once you get this little network of two machines running, then we can talk about bridging or tunneling between the two networks.


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

#8 2017-01-24 18:11:30

ttomsen89
Member
Registered: 2017-01-24
Posts: 9

Re: [SOLVED] Sharing wifi via ethernet failed

This is what I did on the 2nd mashine

 # ip addr add 192.168.1.0 dev enp2s0

2: enp3s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP
link/ether 98:e7:f4:2f:17:78 brd ff:ff:ff:ff:ff:ff
inet 192.168.1.0/32 scope global enp2s0
valid_lft forever preferred_lft forever
inet6 fe80: :9ae7:f4ff:fe2f:1778/64 scope link
valid_lft forever preferred_lft forever 

Still no packets are being transmitted. But when the ethernet connection seems to be up, the wifi-connection is being interrupted.

Offline

#9 2017-01-24 18:18:38

loqs
Member
Registered: 2014-03-06
Posts: 19,184

Re: [SOLVED] Sharing wifi via ethernet failed

# ip addr add 192.168.1.0 dev enp2s0
2: enp3s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP
link/ether 98:e7:f4:2f:17:78 brd ff:ff:ff:ff:ff:ff
inet 192.168.1.0/32 scope global enp2s0

So enp2s0 and enp3s0 both have the address 192.168.1.0 assigned to them?

Offline

#10 2017-01-24 18:23:58

ttomsen89
Member
Registered: 2017-01-24
Posts: 9

Re: [SOLVED] Sharing wifi via ethernet failed

loqs wrote:

So enp2s0 and enp3s0 both have the address 192.168.1.0 assigned to them?

No, device enp2s0f0 has IP 192.168.1.1

Offline

#11 2017-01-24 18:36:26

loqs
Member
Registered: 2014-03-06
Posts: 19,184

Re: [SOLVED] Sharing wifi via ethernet failed

As there appeats to be some confusion here,  it might be useful if you provide the full output of

$ ip addr
$ ip route

For both the gateway and client machines.

Offline

#12 2017-01-24 20:55:35

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

Re: [SOLVED] Sharing wifi via ethernet failed

What loqs asks for will be useful.  I think I see what happened though.  I had said a 192.168.1.0 address; that does not mean use 192.168.1.0.  I meant 192.168.1.x where  2<-x<=254.  I envisioned this being dynamic -- provided by dhcpcd.  But, static works too; but you cannot use 192.168.1.0; it is not a valid address.


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

#13 2017-01-24 21:55:30

ttomsen89
Member
Registered: 2017-01-24
Posts: 9

Re: [SOLVED] Sharing wifi via ethernet failed

loqs wrote:

As there appeats to be some confusion here,  it might be useful if you provide the full output of

$ ip addr
$ ip route

For both the gateway and client machines.

After I followed @ewaller and changed the last number to 2, respective 3
Machine 1:

$ ip addr show enp2s0f0
2: enp2s0f0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
    link/ether 20:1a:06:14:88:80 brd ff:ff:ff:ff:ff:ff
    inet 192.168.1.2/32 scope global enp2s0f0
       valid_lft forever preferred_lft forever
    inet6 fe80::221a:6ff:fe14:8880/64 scope link 
       valid_lft forever preferred_lft forever

$ ip route
default via 192.168.0.1 dev wlp3s0 proto static metric 600 
192.168.0.0/24 dev wlp3s0 proto kernel scope link src 192.168.0.14 metric 600 

Machine 2:

$  ip addr show enp3s0 
2: enp3s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP
link/ether 98:e7:f4:2f:17:78 brd ff:ff:ff:ff:ff:ff
inet 192.168.1.3/32 scope global enp2s0 
$ ip route
default via 192.168.0.1 dev wlp2s0 proto static metric 600
169.254.0.0/16 dev enp3s0 scope link metric 1000
192.168.0.0/24 dev wlp2s0 proto kernel scope link src 192.168.0.15 metric 600 

Last edited by ttomsen89 (2017-01-24 21:56:02)

Offline

#14 2017-01-24 22:23:17

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

Re: [SOLVED] Sharing wifi via ethernet failed

I believe the /32 after the addresses on both machines are going to cause routing problems.  They should both be /24.  It might be that ip addr add defaults to 32; try it with the /24 at the end of the address.


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

#15 2017-01-24 22:41:43

ttomsen89
Member
Registered: 2017-01-24
Posts: 9

Re: [SOLVED] Sharing wifi via ethernet failed

ewaller wrote:

I believe the /32 after the addresses on both machines are going to cause routing problems.  They should both be /24.  It might be that ip addr add defaults to 32; try it with the /24 at the end of the address.

That did it, now pinging works smile

Now I can enable NAT?

Offline

#16 2017-01-24 23:01:41

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

Re: [SOLVED] Sharing wifi via ethernet failed

From the article linked by slithery, try sysctl net.ipv4.ip_forward=1  as root and see it it works.  It might not.  If it doesn't, a few lines down, the article continues with

# iptables -t nat -A POSTROUTING -o internet0 -j MASQUERADE
# iptables -A FORWARD -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT
# iptables -A FORWARD -i net0 -o internet0 -j ACCEPT

I am not sure exactly what those incantations do, but if I needed to know, man iptables is where I would go tongue


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

#17 2017-01-24 23:10:59

ttomsen89
Member
Registered: 2017-01-24
Posts: 9

Re: [SOLVED] Sharing wifi via ethernet failed

Thanks already!
I will go on further tomorrow.

Offline

#18 2017-01-25 15:10:46

ttomsen89
Member
Registered: 2017-01-24
Posts: 9

Re: [SOLVED] Sharing wifi via ethernet failed

Hello everyone,

it works now. I'm not sure what it did for me, but looking at this: wiki.archlinux.org/NetworkManager and this: xyne.archlinux.ca/dhcpwithdns I installed dnsmasq and -yes- dhcp.

So, I think Network Manager did it for me. I will reboot now and see, if I can repeat the settings.

Edit:

Yep, still works after reboot.

But as Network Manager is not part of the basic installation, I guess in case of a fresh installation of arch on a client machine, I have to use NAT and iptables, don't I?

Anyway, thanks a lot for time and advice : )
tt

Last edited by ttomsen89 (2017-01-25 15:20:38)

Offline

Board footer

Powered by FluxBB