You are not logged in.

#1 2015-09-17 21:52:27

TheChosenOne
Member
Registered: 2012-09-27
Posts: 130

[SOLVED] Cannot share internet

I've got 2 pcs here. One has very bad wireless. What I'm trying to do is forward my wireless from one pc to the other.

What I'm doing on the forwarding pc as on https://wiki.archlinux.org/index.php/Internet_sharing:

ip link set up dev enp2s0
ip addr add 192.168.123.100/24 dev enp2s0
sysctl net.ipv4.ip_forward=1
iptables -t nat -A POSTROUTING -o wlp1s0 -j MASQUERADE
iptables -A FORWARD -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT
iptables -A FORWARD -i enp2s0 -o wlp1s0 -j ACCEPT

enp2s0 is the wired connection and wlp1s0 is the wireless connection on my forwarding pc.
DHCP is enabled on my receiving pc so I shouldn't change anything on that end.

I get an error on my forwarding pc for a very brief moment (connection failed or something like that).
Does anyone have an idea here? Or just directions on how I can debug this (like reading error logs).

Thanks.

Last edited by TheChosenOne (2015-09-20 15:36:10)

Offline

#2 2015-09-17 23:03:34

fukawi2
Ex-Administratorino
From: .vic.au
Registered: 2007-09-28
Posts: 6,231
Website

Re: [SOLVED] Cannot share internet

TheChosenOne wrote:

DHCP is enabled on my receiving pc so I shouldn't change anything on that end.

Have you set up a DHCP server anywhere?

TheChosenOne wrote:

I get an error on my forwarding pc for a very brief moment (connection failed or something like that).

"something like that" is totally useless information for us to help you with. It's like going to the doctor, sitting down and saying nothing except "it hurts".

TheChosenOne wrote:

Does anyone have an idea here? Or just directions on how I can debug this (like reading error logs).

Give us the actual errors you're seeing, and post the output of the following commands.

On the "sharing" PC:

ip a s
ip r s
iptables-save

On the "client" PC:

ip a s 
ip r s
cat /etc/resolv.conf

Offline

#3 2015-09-19 21:40:47

TheChosenOne
Member
Registered: 2012-09-27
Posts: 130

Re: [SOLVED] Cannot share internet

fukawi2 wrote:

Have you set up a DHCP server anywhere?

DHCP is enabled on the sharing pc.

fukawi2 wrote:

"something like that" is totally useless information for us to help you with. It's like going to the doctor, sitting down and saying nothing except "it hurts".

It goes away very fast, so I can't read it. Silly gnome hmm

fukawi2 wrote:

On the "sharing" PC:

ip a s
ip r s
iptables-save

ip a s:

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default 
    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: enp2s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
    link/ether c8:60:00:3c:5c:39 brd ff:ff:ff:ff:ff:ff
3: wlp1s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1492 qdisc mq state UP group default qlen 1000
    link/ether 00:08:ca:ce:a1:15 brd ff:ff:ff:ff:ff:ff
    inet 192.168.0.6/24 brd 192.168.0.255 scope global dynamic wlp1s0
       valid_lft 259162sec preferred_lft 259162sec
    inet6 fe80::208:caff:fece:a115/64 scope link 
       valid_lft forever preferred_lft forever

ip r s:

default via 192.168.0.1 dev wlp1s0  proto static  metric 600 
192.168.0.0/24 dev wlp1s0  proto kernel  scope link  src 192.168.0.6  metric 600 

iptables-save:

# Generated by iptables-save v1.4.21 on Fri Sep 18 21:47:53 2015
*filter
:INPUT ACCEPT [6:1281]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [3:238]
-A FORWARD -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT
-A FORWARD -i enp2s0 -o wlp1s0 -j ACCEPT
-A FORWARD -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT
-A FORWARD -i enp2s0 -o wlp1s0 -j ACCEPT
COMMIT
# Completed on Fri Sep 18 21:47:53 2015
# Generated by iptables-save v1.4.21 on Fri Sep 18 21:47:53 2015
*nat
:PREROUTING ACCEPT [7:2226]
:INPUT ACCEPT [0:0]
:OUTPUT ACCEPT [2:154]
:POSTROUTING ACCEPT [0:0]
-A POSTROUTING -o wlp1s0 -j MASQUERADE
-A POSTROUTING -o wlp1s0 -j MASQUERADE
COMMIT
# Completed on Fri Sep 18 21:47:53 2015
fukawi2 wrote:

On the "client" PC:

ip a s 
ip r s
cat /etc/resolv.conf

ip a s:

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default 
    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: enp7s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
    link/ether 20:cf:30:17:ba:20 brd ff:ff:ff:ff:ff:ff
    inet6 fe80::22cf:30ff:fe17:ba20/64 scope link 
       valid_lft forever preferred_lft forever
3: wlp3s0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN group default qlen 1000
    link/ether 74:f0:6d:37:8c:e1 brd ff:ff:ff:ff:ff:ff

ip r s:

*nothing*

cat /etc/resolv.conf:

*also nothing*

Offline

#4 2015-09-19 22:15:41

respiranto
Member
Registered: 2015-05-15
Posts: 479
Website

Re: [SOLVED] Cannot share internet

TheChosenOne wrote:
fukawi2 wrote:

Have you set up a DHCP server anywhere?

DHCP is enabled on the sharing pc.

Installing a dhcp server is not the same as starting dhcpcd, see dhcpd.
However for only one connected machine, a dhcp server seems a little overkill to me.
A little info about static IP's: Network_configuration#Static_IP_address.

Offline

#5 2015-09-20 12:57:06

TheChosenOne
Member
Registered: 2012-09-27
Posts: 130

Re: [SOLVED] Cannot share internet

I've added a static ip by doing (on the receiving pc):

ip addr add 192.168.123.201/24 dev enp7s0
ip link set up dev enp7s0
ip route add default via 192.168.123.100 dev enp7s0

Which doesn't work. I can't even ping the default gateway (192.168.123.100).

Edit: For some reason NetworkManager was making my life difficult. Now it is fixed.
I obviously had to add the right DNS server.

Last edited by TheChosenOne (2015-09-20 15:17:32)

Offline

#6 2015-09-20 15:30:09

respiranto
Member
Registered: 2015-05-15
Posts: 479
Website

Re: [SOLVED] Cannot share internet

I'm not on expert on this area, but you certainly need a (static) IP on both ends of the connection.
I.e. to have internet on both computers, the sharing computer will need an IP for both interfaces.
First the one for the wlp* interface, responsible for the connection to the router and
second the one for the enp* interface, to connect to the other computer.

By the way, 192.168.123.100 was just an example IP in the Wiki.
However it should work if you also use it for your sharing computer.
So you most probably simply have to reread Internet_sharing#Static_IP_address.

Edit: grammar

Last edited by respiranto (2015-09-20 15:31:32)

Offline

Board footer

Powered by FluxBB