[SOLVED] Share wired SERIAL connection (ppp) over WiFi?

Post new topic   Reply to topic    DD-WRT Forum Index -> Advanced Networking
Author Message
flyingfishfinger
DD-WRT Novice


Joined: 26 Feb 2023
Posts: 31

PostPosted: Wed Apr 26, 2023 22:54    Post subject: [SOLVED] Share wired SERIAL connection (ppp) over WiFi? Reply with quote
Hi,
I've set up pppd on my router as a source of "internet". ppp assigns pairs of IP addresses manually, so I set the local IP address of the router to 10.0.5.2, and the host which provides internet connectivity over the serial line has 10.0.5.1, both from the pppd command used to invoke it:
Code:
pppd /dev/ttyUSB1 115200 10.0.5.2:10.0.5.1 crtscts noauth nodetach local dump defaultroute persist maxfail 0 holdoff 1 usepeerdns


Now I can SSH into the router over LAN and ping the host at 10.0.5.1, and also connect to the internet (pinging arbitrary domains works).

However, I can't figure out how to actually broadcast this connection over WiFi. I thought if I add an interface (ppp0) as the pppd command does, it might show up in the WAN dropdown menu somewhat like "Mobile Hotspot" does, but then it's not really WAN to begin with.

My guess is I need to add something to the routing tables, but networking generally is sort of foreign to me - hence this question. I would appreciate any tips.

Cheers,
R


Last edited by flyingfishfinger on Tue May 09, 2023 4:25; edited 1 time in total
Sponsor
dale_gribble39
DD-WRT Guru


Joined: 11 Jun 2022
Posts: 1899

PostPosted: Thu Apr 27, 2023 1:31    Post subject: Reply with quote
Without doing anything but invoking the pppd process, what are the available selections for the WAN interface on the Setup -> Networking tab? How were you adding ppp0 interface?
_________________
"The woods are lovely, dark and deep,
But I have promises to keep,
And miles to go before I sleep,
And miles to go before I sleep." - Robert Frost

"I am one of the noticeable ones - notice me" - Dale Frances McKenzie Bozzio

<fact>code knows no gender</fact>

This is me, knowing I've ruffled your feathers, and not giving a ****
Some people are still hard-headed.

--------------------------------------
Mac Pro (Mid 2012) - Two 2.4GHz 6-Core Intel Xeon E5645 processors 64GB 1333MHz DDR3 ECC SDRAM OpenSUSE Leap 15.5


Last edited by dale_gribble39 on Fri Apr 28, 2023 0:33; edited 1 time in total
flyingfishfinger
DD-WRT Novice


Joined: 26 Feb 2023
Posts: 31

PostPosted: Thu Apr 27, 2023 3:03    Post subject: Reply with quote
In the section itself:
- eth0
- vlan1
- wlan0
- wlan1

In the dropdown for WAN Port Assignment:
- Disabled
- eth0
- vlan1
- vlan2
- wlan0
- wlan1
- br0

When you invoke pppd, it creates a new network interface ppp0 by definition. I can do this either by pasting the command from my first post in the "USB Script" section (which successfully runs on boot and connects to my host) , or by entering it over SSH. ppp0 shows up in an "ifconfig" over SSH or in the command shell section of the web interface as well.
dale_gribble39
DD-WRT Guru


Joined: 11 Jun 2022
Posts: 1899

PostPosted: Thu Apr 27, 2023 17:32    Post subject: Reply with quote
So ppp0 never shows up as an assignable WAN interface in the webUI? I presume this is because no WAN configuration on Setup -> Basic Setup is chosen or the incorrect one is chosen or because your router's LAN IP is in the same subnet as the remote host. Is the remote host providing DHCP? Is DHCP server on the router disabled? Is the router running the pppd (client) configured as a switch? Visual aids would really help see what is exactly going on here since it seems we're starting in the middle of the conversation.
_________________
"The woods are lovely, dark and deep,
But I have promises to keep,
And miles to go before I sleep,
And miles to go before I sleep." - Robert Frost

"I am one of the noticeable ones - notice me" - Dale Frances McKenzie Bozzio

<fact>code knows no gender</fact>

This is me, knowing I've ruffled your feathers, and not giving a ****
Some people are still hard-headed.

--------------------------------------
Mac Pro (Mid 2012) - Two 2.4GHz 6-Core Intel Xeon E5645 processors 64GB 1333MHz DDR3 ECC SDRAM OpenSUSE Leap 15.5
flyingfishfinger
DD-WRT Novice


Joined: 26 Feb 2023
Posts: 31

PostPosted: Thu Apr 27, 2023 18:37    Post subject: Reply with quote
Quote:
So ppp0 never shows up as an assignable WAN interface in the webUI?

Yes, I was hoping it would show up automatically. Hence the question - and sorry for not providing much context.

My goal is to provide a local WiFi network with internet connectivity through what is effectively a serial connection (practically, a long-distance radio link). I have successfully done this with a pair of Raspberry Pi's, but I wanted to have a proper router on the receiving end. So I've replaced one of the Pi's with this router (a Netgear R6220 with the latest dd-wrt version available).

I first installed Entware to a USB stick with a couple of modules (nano, minicom and crucially, pppd), but because this router only has 1 USB port I added a USB hub to connect both the USB stick and the FTDI USB-Serial adapter.

I added two startup commands: "insmod usbserial" and "insmod ftdi_sio", which makes the serial port show up as ttyUSB1 as expected.

Once the USB port comes up, I run
Code:
pppd /dev/ttyUSB1 115200 10.0.5.2:10.0.5.1 crtscts noauth nodetach local dump defaultroute persist maxfail 0 holdoff 1 usepeerdns

as described before. This command creates the ppp0 interface.

On the other end, which for testing is just another PC with a matching FTDI adapter, I run the equivalent command to host the connectivity:
Code:
sudo sysctl -w net.ipv4.ip_forward=1
sudo iptables -t nat -A POSTROUTING -o [network adapter with internet here, "wlan0"] -j MASQUERADE
sudo pppd /dev/ttyUSB1 115200 10.0.5.1:10.0.5.2 crtscts proxyarp local noauth nodetach dump passive persist maxfail 0 holdoff 1 ms-dns 8.8.8.8 noccp


With this set of commands, the router gets a working internet connection.

Regarding your next question about the WAN section. I wasn't sure if that is where I would need to configure ppp0 as it does NOT show up in the "Basic Setup" dropdown box, so I just set it to "Disabled" for now. If there is no ppp0 shown, what should I select there, if anything?

The pppd command assigns the ppp0 interface (this client router) a static IP address, and I had left DHCP as enabled initially but that didn't work either. It is not configured as a switch as far as I know (left it as AP, if we're talking about the same section).

When I get home tonight I'll add some screenshots of the WebUI to this post. Please let me know if you'd like to see any specific screens or sections.

Thanks,
R
dale_gribble39
DD-WRT Guru


Joined: 11 Jun 2022
Posts: 1899

PostPosted: Fri Apr 28, 2023 0:41    Post subject: Reply with quote
Don't know why you installed a second instance of pppd on your router; it should be available already if you have PPPoE as an option for WAN on the Setup -> Basic Setup tab. Still think there is valuable information missing from the steps required to reproduce this scenario.

https://docs.kernel.org/usb/usb-serial.html

Setup -> Basic Setup
Setup -> Advanced Routing
Setup -> Networking


(for starters)

_________________
"The woods are lovely, dark and deep,
But I have promises to keep,
And miles to go before I sleep,
And miles to go before I sleep." - Robert Frost

"I am one of the noticeable ones - notice me" - Dale Frances McKenzie Bozzio

<fact>code knows no gender</fact>

This is me, knowing I've ruffled your feathers, and not giving a ****
Some people are still hard-headed.

--------------------------------------
Mac Pro (Mid 2012) - Two 2.4GHz 6-Core Intel Xeon E5645 processors 64GB 1333MHz DDR3 ECC SDRAM OpenSUSE Leap 15.5
flyingfishfinger
DD-WRT Novice


Joined: 26 Feb 2023
Posts: 31

PostPosted: Fri Apr 28, 2023 7:17    Post subject: Reply with quote
Ah, I didn't know pppd was included by default - but I tried removing the Entware USB drive and running the command. It still works so you're right, but I'm not sure what difference that would make.

In the attachments are a bunch of screengrabs, I added a couple that seemed relevant.

Please let me know if there's anything else you'd like to see or for me to try.

Cheers,
R
flyingfishfinger
DD-WRT Novice


Joined: 26 Feb 2023
Posts: 31

PostPosted: Fri Apr 28, 2023 7:19    Post subject: Reply with quote
Only 3 attachments, it seems - here are a couple more.

Thanks for helping, I really appreciate it.

R
flyingfishfinger
DD-WRT Novice


Joined: 26 Feb 2023
Posts: 31

PostPosted: Fri Apr 28, 2023 7:22    Post subject: Reply with quote
One more - the actual routing table the router shows.
dale_gribble39
DD-WRT Guru


Joined: 11 Jun 2022
Posts: 1899

PostPosted: Sat Apr 29, 2023 18:37    Post subject: Reply with quote
Is your point-to-point a static or DHCP link? The answer to that should give you an obvious answer to the possible problem.
_________________
"The woods are lovely, dark and deep,
But I have promises to keep,
And miles to go before I sleep,
And miles to go before I sleep." - Robert Frost

"I am one of the noticeable ones - notice me" - Dale Frances McKenzie Bozzio

<fact>code knows no gender</fact>

This is me, knowing I've ruffled your feathers, and not giving a ****
Some people are still hard-headed.

--------------------------------------
Mac Pro (Mid 2012) - Two 2.4GHz 6-Core Intel Xeon E5645 processors 64GB 1333MHz DDR3 ECC SDRAM OpenSUSE Leap 15.5
flyingfishfinger
DD-WRT Novice


Joined: 26 Feb 2023
Posts: 31

PostPosted: Sun Apr 30, 2023 2:23    Post subject: Reply with quote
The link is static, it assigns to the ppp0 interface the IP I give it with the initialization command. If you mean I should set WAN to "Static" and put in the IP I gave earlier - I already tried that. Still no internet connection, but I'll try again and see if I missed something.

R
dale_gribble39
DD-WRT Guru


Joined: 11 Jun 2022
Posts: 1899

PostPosted: Sun Apr 30, 2023 18:46    Post subject: Reply with quote
Well, it's obviously not passing the proper gateway route to the LAN for some reason. You may try entering gateway address manually with static WAN or passing gateway to clients manually via dnsmasq config.
_________________
"The woods are lovely, dark and deep,
But I have promises to keep,
And miles to go before I sleep,
And miles to go before I sleep." - Robert Frost

"I am one of the noticeable ones - notice me" - Dale Frances McKenzie Bozzio

<fact>code knows no gender</fact>

This is me, knowing I've ruffled your feathers, and not giving a ****
Some people are still hard-headed.

--------------------------------------
Mac Pro (Mid 2012) - Two 2.4GHz 6-Core Intel Xeon E5645 processors 64GB 1333MHz DDR3 ECC SDRAM OpenSUSE Leap 15.5
flyingfishfinger
DD-WRT Novice


Joined: 26 Feb 2023
Posts: 31

PostPosted: Tue May 02, 2023 20:05    Post subject: Reply with quote
Sorry, this is approximately where my current networking knowledge runs out Sad

The gateway should be what, exactly? The host of the internet connection (i.e 10.0.5.1)?

For what it's worth, I did find this: "The PPP protocol is unusual and subnet masks are actually irrelevant to the host's IP settings. That is why the typical display of a PPP adapter connected in Windows will show a subnet mask of 255.255.255.255, and even the gateway IP is usually set to the same value as the acquired IP address."

So I tried setting both the WAN and the Gateway to 10.0.5.2, and also setting the Gateway to 10.0.5.1 (the other end of the link). One resulted in "Destination unreachable" and the other in "Timeout".

R
flyingfishfinger
DD-WRT Novice


Joined: 26 Feb 2023
Posts: 31

PostPosted: Tue May 09, 2023 4:26    Post subject: Reply with quote
Solved it. I needed to add these two rules:
Code:
iptables -I FORWARD -i br0 -o ppp0 -j ACCEPT
iptables -t nat -A POSTROUTING -o ppp0 -j MASQUERADE


R
Per Yngve Berg
DD-WRT Guru


Joined: 13 Aug 2013
Posts: 6858
Location: Romerike, Norway

PostPosted: Tue May 09, 2023 7:36    Post subject: Reply with quote
A solution without NAT will be to add a route in the remote network to the local network through the ppp.
Display posts from previous:    Page 1 of 1
Post new topic   Reply to topic    DD-WRT Forum Index -> Advanced Networking All times are GMT

Navigation

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum