Page 1 of 1

Setting Static IP address and DNS on Luckfox Pico Pro Max

Posted: 2024-02-23 0:36
by torchris4
I have been trying to set up a static IP and DNS on my Pico Pro Max following the template found in the System Configuration area:

https://wiki.luckfox.com/Luckfox-Pico/L ... -Autostart

(Inserting the IP addresses to what I need.)

What I see in serial debug is udhcpc seems to show up at the end of the boot process and take over and then the static IP doesn't get set and the entry in resolv.conf is wiped out. Also USB0 doesn't seem to get set.

Are there setting changes that need to be made to udhcpc and where are those?

Also, it does not seem to pick up the settings from /etc/network/interfaces.

For my project, I really need a static IP address, but I also need access to DNS.

Re: Setting Static IP address and DNS on Luckfox Pico Pro Max

Posted: 2024-02-23 2:30
by Crocodile
Hello, you can add the startup script S99usb0staticip in /etc/init.d
add

Code: Select all

ifconfig usb0 xxx.xxx.xxx.xxx netmask xxx.xxx.xxx.xxx
route add default gw xxx.xxx.xxx.xxxd
echo "nameserver 114.114.114.114" > /etc/resolv.conf
usb0 ip is already set up in the S50usbdevice and S90usb0config, and you need to make sure that the new scripts run after them.
50 and 90 indicate the execution sequence.
Note: The S99usbstaticip requires the use of chmod a+x to add executable permissions.

To ensure that you can use the network properly, share the network to Remote NDIS based Internet Sharing Device.
share net.jpg

Re: Setting Static IP address and DNS on Luckfox Pico Pro Max

Posted: 2024-02-23 2:37
by torchris4
Thank you. I will try that.

With regards to the Static IP on Eth0, do I need to modify the init.d file S40network or create a new file for the Eth0 interface the same as you have described?

Re: Setting Static IP address and DNS on Luckfox Pico Pro Max

Posted: 2024-02-23 3:02
by Crocodile
torchris4 wrote: 2024-02-23 2:37 Thank you. I will try that.

With regards to the Static IP on Eth0, do I need to modify the init.d file S40network or create a new file for the Eth0 interface the same as you have described?
You don't need to modify S40network. You can create a new file S99eth0staticip with the eth0 configuration.
add

Code: Select all

ifconfig eth0 xxx.xxx.xxx.xxx netmask xxx.xxx.xxx.xxx
route add default gw xxx.xxx.xxx.xxx
echo "nameserver 114.114.114.114" > /etc/resolv.conf
Since I'm in China, I use 114.114.114.114 as my DNS address. You can try changing it to 8.8.8.8.

Re: Setting Static IP address and DNS on Luckfox Pico Pro Max

Posted: 2024-02-23 3:13
by torchris4
Yes, I just figured it out! Thanks!