[SOLVED] Static IP with netctl

Ask questions about Arch Linux ARM. Please search before making a new topic.

[SOLVED] Static IP with netctl

Postby Stashi » Wed Nov 20, 2019 1:21 am

Ok, so I have a few total newbie issues...

I'm trying to set up a 3 x node Arch Linux compute cluster on Raspberry Pi 4s. Installation is a breeze, and I'm able to install all the packages I need; also after finishing the package installations I run $pacman -Syu to update everything.

All the PIs are connected via ethernet to my switch, which assigns 3 x IP addresses with DHCP (10.66.172.52, 10.66.172.60 and 10.66.172.61). $ifconfig shows the interfaces are at 'eth0' - So far so good...
$this->bbcode_second_pass_code('', '
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 10.66.172.52 netmask 255.255.255.224 broadcast 10.66.172.63
inet6 fe80::dea6:32ff:fe24:b7ba prefixlen 64 scopeid 0x20<link>
ether dc:a6:32:24:b7:ba txqueuelen 1000 (Ethernet)
RX packets 5019 bytes 5703032 (5.4 MiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 2610 bytes 201113 (196.3 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10<host>
loop txqueuelen 1000 (Local Loopback)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

')

For using pytthon-mpi4py I need to set static IP addresses, so I look up the netctl instructions...
in /etc/netctl/examples I change the settings in 'ethernet-static' to:

$this->bbcode_second_pass_code('', '
Description='RPi Cluster Static Config'
Interface=eth0
Connection=ethernet
IP=static
Address=('10.66.172.48/27')
#Routes=('192.168.0.0/24 via 192.168.1.2')
Gateway='10.66.172.33'
DNS=('8.8.4.4' '8.8.8.8')
')
I then copy the file as follows:
$this->bbcode_second_pass_code('', 'cp /etc/netctl/examples/ethernet-static /etc/netctl/eth0')

All looks, good, but when I start the service:
$this->bbcode_second_pass_code('', 'netctl start eth0')
I get the error code:

$this->bbcode_second_pass_code('', '
* netctl@eth0.service - Networking for netctl profile eth0
Loaded: loaded (/usr/lib/systemd/system/netctl@.service; static; vendor preset: disabled)
Active: failed (Result: exit-code) since Tue 2019-11-19 22:28:45 UTC; 41s ago
Docs: man:netctl.profile(5)
Process: 424 ExecStart=/usr/lib/netctl/network start eth0 (code=exited, status=1/FAILURE)
Main PID: 424 (code=exited, status=1/FAILURE)

Nov 19 22:28:45 APi-08 systemd[1]: Starting Networking for netctl profile eth0...
Nov 19 22:28:45 APi-08 network[424]: Starting network profile 'eth0'...
Nov 19 22:28:45 APi-08 network[424]: The interface of network profile 'eth0' is already up
Nov 19 22:28:45 APi-08 systemd[1]: netctl@eth0.service: Main process exited, code=exited, status=1/FAILURE
Nov 19 22:28:45 APi-08 systemd[1]: netctl@eth0.service: Failed with result 'exit-code'.
Nov 19 22:28:45 APi-08 systemd[1]: Failed to start Networking for netctl profile eth0.
')

Now, I'm connected to the node remotely via SSH, and as it says eth0 interface is already up, I stop the eth0 service (with netctl), reboot and login via the wlan interface (different IP of 10.66.172.56).

I try $this->bbcode_second_pass_code('', 'netctl start eth0') again and still get the same issue as above!

I've tried stopping and starting the service, rebooting, updating firmware, etc. etc. and it's really baking my noodle now! I'm sure there's a MASSIVELY simple command/process that I'm missing out, but I just can't put my finger on it...

Any help would be very well received!! smile

Thanks,

Nick
Last edited by Stashi on Wed Nov 20, 2019 1:17 pm, edited 1 time in total.
Stashi
 
Posts: 3
Joined: Wed Nov 20, 2019 1:15 am

Re: Static IP with netctl

Postby summers » Wed Nov 20, 2019 10:52 am

Probably easiest is in your dhcp server (usually your router), is to fixed the mac address to a fixed IP. Then that machine always gets the same IP address.

If you really need the machine to set its own IP, me I use systemd-networkd these days. Given that the machine comes up with systemd, I find it easiest to use the solutions that are native to systemd.

So first read: https://wiki.archlinux.org/index.php/Systemd-networkd

Then for me I set the fixed IP in /etc/systemd/network/usb0.network via:
$this->bbcode_second_pass_code('', '[Match]
Name=usb0

[Network]
DNS=192.168.2.1

[Address]
Address=192.168.7.2/30

[Route]
Gateway=192.168.7.1')
You'll have to change the interface to what you use, and think about routing (e.g. thats the gateway bit)
summers
 
Posts: 995
Joined: Sat Sep 06, 2014 12:56 pm

Re: Static IP with netctl

Postby Stashi » Wed Nov 20, 2019 1:17 pm

Worked perfectly - thanks @summers!!

I used systemd networkd to configure the static IPs on the hosts, and it's all up and running. Thanks for saving me a lot of headaches :lol:
Stashi
 
Posts: 3
Joined: Wed Nov 20, 2019 1:15 am

Re: [SOLVED] Static IP with netctl

Postby summers » Wed Nov 20, 2019 4:41 pm

Glad it worked.

Oh yes, don't forget to stop netctl if using networkd, e.g. you don't want two things trying to run the network at the same time, which was probably your problem.
summers
 
Posts: 995
Joined: Sat Sep 06, 2014 12:56 pm

Re: [SOLVED] Static IP with netctl

Postby Stashi » Wed Nov 20, 2019 6:17 pm

Yes, I found out after I had to stop ALL the netctl services - I found there were 6 of them after running $this->bbcode_second_pass_code('', ' systemctl list-unit-files')!!

I also removed netctl for good measure afterwards. systemd networkd has been great for solving the problems, and is now replacing netctl universally I’ve heard :D
Stashi
 
Posts: 3
Joined: Wed Nov 20, 2019 1:15 am


Return to User Questions

Who is online

Users browsing this forum: No registered users and 28 guests