You are not logged in.

#1 2018-07-02 14:23:13

mkkot
Member
From: Poland
Registered: 2009-12-20
Posts: 287

Share a service from PC to a laptop through wifi AP

Hello,

I'm sharing my Internet connection from a PC to a laptop via Wifi AP from TP-Link and following network configuration:

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

http://img.koci.net.pl/images/schematsie.png

I know that this looks a bit strange but that's what I want. Now lets say that I installed a remote desktop server on my PC. How I can enable my laptop to see my PC and be able to connect to certain port?

Mod Edit - Replaced oversized image with link.
CoC - Pasting pictures and code

Last edited by Slithery (2018-07-02 14:47:27)

Offline

#2 2018-07-03 13:46:06

Lone_Wolf
Forum Moderator
From: Netherlands, Europe
Registered: 2005-10-04
Posts: 11,922

Re: Share a service from PC to a laptop through wifi AP

What kind of connection is lte0 ?
Is it directly connected to an internet provider or through a router ?

(a modem in bridge mode or a tethered smartphone counts as a direct connection)


Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.


(A works at time B)  && (time C > time B ) ≠  (A works at time C)

Offline

#3 2018-07-03 14:36:41

mkkot
Member
From: Poland
Registered: 2009-12-20
Posts: 287

Re: Share a service from PC to a laptop through wifi AP

Hi Lone Wolf,
it's an Internet connection through LTE USB dongle with NAT function (Hi-Link).

Last edited by mkkot (2018-07-03 14:37:02)

Offline

#4 2018-07-03 15:43:21

progandy
Member
Registered: 2012-05-17
Posts: 5,193

Re: Share a service from PC to a laptop through wifi AP

I guess the best option would be to let the RDS listen on the internal IP (192.168.123.100) as well.


| alias CUTF='LANG=en_XX.UTF-8@POSIX ' |

Offline

#5 2018-07-03 15:49:34

mkkot
Member
From: Poland
Registered: 2009-12-20
Posts: 287

Re: Share a service from PC to a laptop through wifi AP

I thought this is easy but not that much easy. So it is enough to tell iptables to open remote desktop port on eth0?

Last edited by mkkot (2018-07-03 15:49:59)

Offline

#6 2018-07-04 12:17:37

Lone_Wolf
Forum Moderator
From: Netherlands, Europe
Registered: 2005-10-04
Posts: 11,922

Re: Share a service from PC to a laptop through wifi AP

Functionally speaking your network has multiple network devices, some of which are virtual.

PC has lte0 , eth0 and localhost.
laptop has 3 interfaces : localhost, laptopethernet , laptop-to-lte0

These devices connect through several subnets and you need some sort of routing to allow them access toi each other.
This can be done through iptables, but is tricky and can get complicated fast.


Basically you're trying to add routing capabilities to an internet sharing solution without setting up a router.
Switching to a genuine routing setup , https://wiki.archlinux.org/index.php/Router , might be a better idea.

please post your current iptables setup.

Last edited by Lone_Wolf (2018-07-04 12:17:57)


Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.


(A works at time B)  && (time C > time B ) ≠  (A works at time C)

Offline

Board footer

Powered by FluxBB