Setting Up A Static IP Address

Kernel, Main, Utilities & Applications, Miscellaneous Devices.
Stupid Dufus
Posts: 152
Joined: Sun Aug 30, 2020 12:04 am
Has thanked: 87 times
Been thanked: 46 times

Re: Setting Up A Static IP Address

Unread post by Stupid Dufus »

I've got mine set to static on the router side, though after a linux update for mister a few weeks ago, the MAC address changed and had to redo that. But that's the first time it's happened to me since I got mine a year or so ago.
yoshi41
Posts: 10
Joined: Sun May 24, 2020 9:12 pm
Has thanked: 2 times
Been thanked: 6 times

Re: Setting Up A Static IP Address

Unread post by yoshi41 »

I use a couple of shell scripts to set static (and dhcp) ip and mac address. Just change the variables in the script for your network setup and run it on the linux shell. It sometimes works from the MiSTer menu, but most of the time /etc is not writeable.

What it does:

- setup /etc/network/interfaces
- setup dns server
- disable (or enable) dhcp client daemon
- setup mac address

The scripts can be found in the attached zip file.
Attachments
network_ip_static.zip
(2.43 KiB) Downloaded 337 times
gibs
Posts: 66
Joined: Sun May 09, 2021 11:04 pm
Has thanked: 8 times
Been thanked: 14 times

Re: Setting Up A Static IP Address

Unread post by gibs »

yoshi41 wrote: Sat Apr 23, 2022 10:29 am

I use a couple of shell scripts to set static (and dhcp) ip and mac address. Just change the variables in the script for your network setup and run it on the linux shell. It sometimes works from the MiSTer menu, but most of the time /etc is not writeable.

What it does:

  • setup /etc/network/interfaces
  • setup dns server
  • disable (or enable) dhcp client daemon
  • setup mac address

The scripts can be found in the attached zip file.

Thanks but from what I see, it set-up the mac address for eth0.
my issue is on wlan0.

I did the change in u-boot.txt manualy and it did not work.

yoshi41
Posts: 10
Joined: Sun May 24, 2020 9:12 pm
Has thanked: 2 times
Been thanked: 6 times

Re: Setting Up A Static IP Address

Unread post by yoshi41 »

Each wifi adapter has it‘s own unique mac (hardware) address. There is no need to change it.

The mac address for eth0 is by default the same for every MiSTer. This is a problem if you have more than one MiSTer in your network. In this case, you can assign your own unique mac address.

akeley
Top Contributor
Posts: 1303
Joined: Mon May 25, 2020 7:54 pm
Has thanked: 416 times
Been thanked: 399 times

Re: Setting Up A Static IP Address

Unread post by akeley »

I've been struggling with this for quite some time now. Nearly every time I try to log in to MiSTer via WinSCP it fails, because the IP (displayed in the OSD) is different.

I know nothing about networking, it's always been my Kryptonite, so would like to use yoshi41's script. I tried to do it from WinSCP but don't know what command to use - I only get these "not understood errors"

sshot-2023-05-22-13-55-50.png
sshot-2023-05-22-13-55-50.png (23.75 KiB) Viewed 1774 times
Stupid Dufus
Posts: 152
Joined: Sun Aug 30, 2020 12:04 am
Has thanked: 87 times
Been thanked: 46 times

Re: Setting Up A Static IP Address

Unread post by Stupid Dufus »

Not really familiar with WinSCP, but what if you try this?

Code: Select all

./network_ip_static_wlan0.sh
akeley
Top Contributor
Posts: 1303
Joined: Mon May 25, 2020 7:54 pm
Has thanked: 416 times
Been thanked: 399 times

Re: Setting Up A Static IP Address

Unread post by akeley »

I tried it, but get the same "not understood" error.

akeley
Top Contributor
Posts: 1303
Joined: Mon May 25, 2020 7:54 pm
Has thanked: 416 times
Been thanked: 399 times

Re: Setting Up A Static IP Address

Unread post by akeley »

Ok, I managed to run the script from the Linux terminal on the mister itself (F9). But, I didn't change the default values in the script first, so now I can't log in via WinSCP at all.

I suppose I should try and modify the script directly on the SD card and then run it again. Question is, what values should I use? My PC is connected to the router via ethernet and MiSTer uses wifi dongle. The script (I use the wlan0 one) requires to: "set ip address, subnet mask, standard gateway and dns server". Are these the values found in Win Settings>>Network Connections >>Ethernet>>Status>>Details?

yoshi41
Posts: 10
Joined: Sun May 24, 2020 9:12 pm
Has thanked: 2 times
Been thanked: 6 times

Re: Setting Up A Static IP Address

Unread post by yoshi41 »

Yes, you can use the values from the ethernet status details page.

Or from this command in the Windows cmd window...

Code: Select all

ipconfig /all

Regarding the script variables...

Code: Select all

SIA_IP=192.168.1.41
SIA_SM=255.255.255.0
SIA_GW=192.168.1.1
SIA_NS=8.8.8.8

Make sure the IP address (SIA_IP) is not in the router DHCP address pool. For the DNS server (SIA_NS) you can use 8.8.8.8 (Google DNS server).

Also make sure the script remains in "Unix (LF)" format or edit the file with Linux vi (only if you know how to use it).

network_ip_static_wlan0.png
network_ip_static_wlan0.png (48.22 KiB) Viewed 810 times
akeley
Top Contributor
Posts: 1303
Joined: Mon May 25, 2020 7:54 pm
Has thanked: 416 times
Been thanked: 399 times

Re: Setting Up A Static IP Address

Unread post by akeley »

Thank you for the detailed reply, yoshi41. It did help me to sort it out (even though phrases such as "DHCP address pool" still make my mind go blank and using vi was a bit scary ;) - after a few reboots the MiSTer's IP remains stable and WinSCP logs in instantly now every time.

Post Reply