Static IP Address in Pi_Star

Help setting up WiFi
Post Reply
N8OFP
Posts: 10
Joined: Wed Apr 11, 2018 10:22 pm

Static IP Address in Pi_Star

Post by N8OFP »

I have a Verizon MiFi hotspot that I tether my Pi-Star hotspot to when I am away from home. The Hotspot connects up fine and work perfectly via the MiFi. But when I want to connect to Pi-Star, to make a change or shut down, I have to first log into the MiFi and find out which IP Address was given to Pi-Star. The MiFi does not have the ability to Reserve and IP Address. So I was wondering if there was someway to set a static IP in Pi-Star so I wouldn't have to constantly log into the MiFi.

Thank you!
M1DNS
Pi-Star Team
Posts: 1388
Joined: Thu Apr 05, 2018 5:30 am

Re: Static IP Address in Pi_Star

Post by M1DNS »

Yep you can do that. Just Google "setting a static ip in raspbian buster"

Just remember to use the rpi-rw command before you follow any other how-to so the pistar files are writable.

Sent from my SM-G935F using Tapatalk


Andrew M1DNS.
Pi-star Admin Team.
N8OFP
Posts: 10
Joined: Wed Apr 11, 2018 10:22 pm

Re: Static IP Address in Pi_Star

Post by N8OFP »

Thank You!!
User avatar
VK7HSE
Posts: 229
Joined: Sun Apr 15, 2018 6:35 pm
Contact:

Re: Static IP Address in Pi_Star

Post by VK7HSE »

You need to edit the file dhcpcd.conf this is located in /etc

The format is as follows...

Code: Select all

 
Interface eth0
static ip_address=192.168.0.2/24
static routers=192.168.0.1
static domain_name_servers=192.168.0.1

interface wlan0
static ip_address=192.168.0.12/24
static routers=192.168.0.1
static domain_name_servers=192.168.0.1
You can place this at the end of the file as everything is # out so non of the examples are active.

Naturally change the static IP needs to be adjusted to suit your needs and the static routes need to point to your router or a 3rd party service provider if that's what you use (most likely not)

Sent from my Pixel 4 XL using Tapatalk

N8OFP
Posts: 10
Joined: Wed Apr 11, 2018 10:22 pm

Re: Static IP Address in Pi_Star

Post by N8OFP »

Thank you again for all your help. After looking through several web pages on adding a static IP it appears that setting a Static IP Address in Pi-Star would be global setting to all network connections. Here is my current setup, I am using a MMDVM board on a Raspberry Pi Zero W. I want to be able to use it at home, connected to my home WiFi and portable using my MiFi device.

Current setup;
Home Network - When I am at home the hotspot is connected to my home WiFi. My home router has an IP Reservation for the hotspot's mac address of 192.168.1.xxx

Portable MiFi - When I am away from home and using the MiFi Hotspot, the MiFi gives Pi-Star an IP Address of 192.168.2.xxx

I was hoping there would be a way that I could set the Static IP Address only for the MiFi's SSID so it would continue to use the DHCP IP Reservation when it connects to my home network.
NQ4T
Posts: 51
Joined: Mon Aug 06, 2018 11:48 pm

Re: Static IP Address in Pi_Star

Post by NQ4T »

My suggestion is to see if your router has the ability to set static assignments in its DHCP table. This way PiStar uses DHCP at all tines, but your main router will ensure it has the same IP.
AF6VN
Posts: 821
Joined: Fri Jul 20, 2018 1:15 am

Re: Static IP Address in Pi_Star

Post by AF6VN »

N8OFP wrote: Sun Jun 07, 2020 10:39 am Current setup;
Home Network - When I am at home the hotspot is connected to my home WiFi. My home router has an IP Reservation for the hotspot's mac address of 192.168.1.xxx

Portable MiFi - When I am away from home and using the MiFi Hotspot, the MiFi gives Pi-Star an IP Address of 192.168.2.xxx

I was hoping there would be a way that I could set the Static IP Address only for the MiFi's SSID so it would continue to use the DHCP IP Reservation when it connects to my home network.
You have a more significant problem... 192.168.1.* and 192.168.2.* (in original "private LAN class" usage) are two disjoint networks. If you did force the R-Pi to use 192.168.1.* on both systems, it likely would not route through the portable -- which is considering "its" local nodes to be on 192.168.2.*

https://en.wikipedia.org/wiki/Private_n ... _addresses
16-bit block 192.168.0.0 – 192.168.255.255 65536 192.168.0.0/16 (255.255.0.0) 16 bits 16 bits 256 contiguous class C networks
Note the part I underlined... 192.168.0.* to 192.168.255.* are separate networks in this system, each having 254 nodes (not 256 as one value is used as a broadcast address *.*.*.255, and another is considered the network address *.*.*.0 as I recall)

https://en.wikipedia.org/wiki/IP_address
The size of the routing prefix of the address is designated in CIDR notation by suffixing the address with the number of significant bits, e.g., 192.168.1.15/24, which is equivalent to the historically used subnet mask 255.255.255.0.
I suspect the recommended solution is to configure both ROUTERS to use 1) the same subnet (192.168.1.* for example), and 2) use the router configuration to assign a known IP based upon the MAC address of the device connecting.

Addendum: assuming the 4510L manual applies to your device, item 1 appears to be covered by page 38-39 (IP # of the device, and also the range of IP # available for DHCP assignment. Unfortunately, item 2 is not available. So... setting both home and portable routers to the same subnet should be possible, and both should have ranges for DHCP and static IP # provided by client device. Setting the R-Pi to a static address outside the DHCP range of both routers should then work -- so long as both routers are using the same subnet [which could be a problem IF you are in range of both at the same time, as you might randomly be connected to one or the other

--
AF6VN
Dennis L Bieber
NQ4T
Posts: 51
Joined: Mon Aug 06, 2018 11:48 pm

Re: Static IP Address in Pi_Star

Post by NQ4T »

AF6VN wrote: Fri Jun 26, 2020 4:31 pm You have a more significant problem... 192.168.1.* and 192.168.2.* (in original "private LAN class" usage) are two disjoint networks. If you did force the R-Pi to use 192.168.1.* on both systems, it likely would not route through the portable -- which is considering "its" local nodes to be on 192.168.2.*
The main reason they're "disjointed" is merely due to how IP routing works. Why can't a PC with a 192.168.1.0/24 IP talk to a 192.168.2.0/24 IP if they're on the same cable? Because the 192.168.1.0/24 machine defaults all traffic for other networks through the gateway. Same happens on the 192.168.2.0/24 machine. But if you somehow tell the machines that traffic to those subnets is to just go out over the interface and not through a gateway...they'll talk.

As has been mentioned...the easiest solution would be to just set DHCP IP reservations (static assignments as some routers call them) and not actually set a static IP on PiStar itself. My phone's hotspot sticks everything on 192.168.37.0/24 and I have absolutely no ability to set routing to a different subnet; I've seen hotspots that isolate everybody by sticking them on their own subnet and not allowing routing between them. In fact I've moved away from setting static assignments on devices to setting static assignments in a DHCP table...that way if I have to move that device to a different network; I won't have to jump through hoops of adding routes in order to talk to it.

This is basically what I do at home in multiple fashions. Most of my personal devices have their DHCP assignments set static by MAC address; so I know my laptop is always .164, my phone is always .156, my dstar hotspot is always .10, dmr is always .11, fusion is .12, my Dell's iDRAC is .2, hypervisor's dom0 runs on .3, my VMs are all .4 - .9 except the networking/gateway VM which is .253. All the devices themselves are just setup for DHCP. My NAS is physically plugged in to one of my Dell's network ports and it's on a 10.1.1.0/24 network. How do I access it from the LAN? I told my router that 192.168.1.253 was the gateway to 10.1.1.0/24. The Synology gets it's 10.1.1.2/24 assignment from the DHCP server on the networking VM. The VM's have static 10.1.1.0/24 assignments since they're not physical machines.

Hotspots connect to my phone...they get a phone assignment. They do it on someone else's wifi...I just have to scan the subnet and find them if their hostnames aren't resolving.

Sorry for getting off on a tangent...but when it comes to stuff like this networking is a requirement.

Now if the particular model of MiFi doesn't allow DHCP static assignments...then the next option would be to somehow see if you could tell the main router that it's also part of the 192.168.2.0/24 network. But *that* depends on how your home router works. I don't even know if I can do it through mine due to how it's interface limits everything.
VE3ZTZ
Posts: 7
Joined: Tue Jan 07, 2020 10:40 pm
Location: Ontario CANADA

Re: Static IP Address in Pi_Star

Post by VE3ZTZ »

There's NOTHING sacrosanct/absolute about netmask alignment on byte ("dot") boundaries -- i.e. aligned (255) on the a or the b or c or the d of an a.b.c.d subnet mask. 255.255.255.0 (aligned) is as valid as 255.255.253.0 (unaligned). It's called "variable-length subnet masking (VLSM)." The "dot" is not meaningful; only the contiguous "1" bits from left to right are meaningful.

Decimal 255.255.255.0 is binary 11111111.11111111.11111111.0000000. Decimal 255.255.253.0 is 11111111.11111111.11111100.00000000. The router (and other devices) use the contiguous block/mask of "1's" to make their routing decisions. the 1's are network and the 0's are hosts/devices. Thought of differently by the router ... 1's are "care" bits and 0's are "don't care" bits. "Care bits" are sometimes refereed to as "interesting" traffic and "don't care" bits as "uninteresting". Simplified, routers are, generally speaking, only "interested" in the 1's.

Aligned 192.168.0.0/24 255.255.255.0, AND aligned 192.168.1.0/24 255.255.255.0, AND aligned 192.168.2.0/24 255.255.255.0 AND aligned 192.168.3.0/24 255.255.255.0 collectively fall into one VLSM of 255.255.253.0 netmask (or CIDR of /22).

Your router will behave quite properly with the VLSM.

The "default gateway address(es)" may challenge you but that's another discussion.

/S
Post Reply