sisif
Posts: 5
Joined: Mon Aug 26, 2013 1:07 pm

Arch linux static local ip address?

Postby sisif » Wed Aug 28, 2013 9:32 am

Hi everyone!
I apologize if my question has been already been answered (it seems soooo basic), but I couldn't find the answer, obviously, neither by googling or by browsing this forum.
I've installed arch (July 22'nd version) on my pi and, for the last few days, I've been trying to set it up. I've got stuck at setting up a local static ip address (not assigned by dhcp). I've tried several methods given on different sites... nothing works!
Does anyone know how to do this?

Thanks in advance for any suggestion!


P.S. Was arch a bad choice? I've installed wheezy before and everything just seem to work. Maybe because is the 'preferred' system, because so many developers are focused on it and is so widespread?
Every step with arch has been a struggle... even the installation itself! I think I wrote the image like 10 times (on different good cards) to get it to start! And when it works, the chances to get a login prompt, without 500 lines or errors, are like 30%... I have to keep re-powering the pi up until, eventually, starts working.
surfatwork
Posts: 62
Joined: Mon May 06, 2013 8:26 am

Re: Arch linux static local ip address?

Postby surfatwork » Wed Aug 28, 2013 1:04 pm

Arch uses netctl. copy over a relevant example from /etc/netctl/examples to /etc/netctl. Edit it and put your static ip there:
An example:

Code: Select all

Description='A simple WPA encrypted wireless connection using a static IP'
Interface=wlan0
Connection=wireless
Security=wpa
ESSID='<your SSID>'
Key='<your key>'
IP=static
Address='192.168.1.85/24'
Gateway='192.168.1.254'
DNS=('192.168.1.254')
# Uncomment this if your ssid is hidden
#Hidden=yes


There are other examples under /etc/netctl/examples.
Arch runs fine on the Raspi - been using it for months.
sisif
Posts: 5
Joined: Mon Aug 26, 2013 1:07 pm

Re: Arch linux static local ip address?

Postby sisif » Wed Aug 28, 2013 3:45 pm

Thanks, surfatwork! I will try it as soon as I get home. I'm at work now, and I can not connect to my pi remotely… ;)

I’m glad to hear Arch works for you. I’m sure there are others that have put it to good use, too. I guess it’s just me. I’ll keep learning.
sdjf
Posts: 1388
Joined: Fri Mar 16, 2012 5:20 am
Location: California
Contact:

Re: Arch linux static local ip address?

Postby sdjf » Thu Aug 29, 2013 6:43 am

With all those errors at startup, it sounds to me like there may be a power supply issue. If you can, make sure that the power between TP1 and TP2 is between 4.75 and 5.25.

I have been using my model B as a primary local headless server for months, and accessing it remotely via static IPs from two PDAs, one over ethernet and the other over USB.

I do sometimes have trouble getting the connections to be recognized automatically, not sure why, but all it takes is entering the proper ifconfig command from command line to bring the connections back up.

And because I am running headless, with hardware keyboard access but no monitor, I created aliases that I type when I need to bring USB or ETH back up, so as not to worry about typing errors. I either enter usbup or ethup and that works.

But iffy power supply can cause all kinds of read errors, so check for that.
FORUM TIP: To view just one person's posting history, sign in, click on their user name, then click on "Search User's Posts." || My 512MB Model B only runs Arch.
sisif
Posts: 5
Joined: Mon Aug 26, 2013 1:07 pm

Re: Arch linux static local ip address?

Postby sisif » Fri Aug 30, 2013 7:08 am

Thanks, sdjf, for your suggestions. I don't think it's a power supply issue here. First, I use a very good quality power supply, able to deliver 2A@5V with no sweat. Second, in the same (headless) setup – supply, pi board, sd card – I never had any errors running wheezy raspbian for weeks in a row. I think the start errors come from a poorly designed reset circuit: if the supply voltage doesn't rise fast enough to the standard 5V, the pi starts running, with insufficient supply – hence the errors. If the adapter is plugged to mains first, and then (with the output already stabilized to 5V) connected to the pi, the pi runs fine. Either way, after a good start-up, it doesn't give any further errors.
Anyways, my main problem is still getting a static ip address. By the way: I'm using a 256MB model B pi with a wired ethernet connection.
What I've done so far is this:
1. copied the /etc/netctl/examples/ethernet-static to /etc/netctl/lup_static
2. edited the new – lup_static – profile to this:

Description='A basic static ethernet connection'
Interface=eth0
Connection=ethernet
IP=static
Address='192.168.1.159/24'
#Routes=('192.168.0.0/24 via 192.168.1.1')
Gateway='192.168.1.1'
DNS=('192.168.1.1')

## For IPv6 autoconfiguration
#IP6=stateless

## For IPv6 static address configuration
#IP6=static
#Address6=('1234:5678:9abc:def::1/64' '1234:3456::123/96')
#Routes6=('abcd::1234')
#Gateway6='1234:0:123::abcd'

I've also tried DNS=('8.8.8.8' '8.8.4.4'), with same results.

3. # netctl enable lup_static
4. # reboot
5. tried with the above and then also disabled dhcp, with: # systemctl disable dhcpcd@eth0.service
no luck, still.
What I get, is this:
netctl@lup_static.service - A basic static ethernet connection
Loaded: loaded (/etc/systemd/system/netctl@lup_static.service; enabled)
Active: failed (Result: exit-code) since Wed 1969-12-31 19:00:08 EST; 43 years 7 months ago
Docs: man:netctl.profile(5)
Process: 108 ExecStart=/usr/lib/network/network start %I (code=exited, status=1/FAILURE)


Not very helpful to me...
Any ideas about what I'm doing wrong here?
Thanks for your help, guys, and sorry for the length of this post.
surfatwork
Posts: 62
Joined: Mon May 06, 2013 8:26 am

Re: Arch linux static local ip address?

Postby surfatwork » Fri Aug 30, 2013 4:15 pm

Is your ethernet interface named eth0?

Code: Select all

 ls /sys/class/net 

should give you the names of your interfaces
sdjf
Posts: 1388
Joined: Fri Mar 16, 2012 5:20 am
Location: California
Contact:

Re: Arch linux static local ip address?

Postby sdjf » Fri Aug 30, 2013 4:33 pm

i commented out all lines except following in profile that works for me:

Description='A basic static ethernet connection'
Interface=eth0
Connection=ethernet
IP=static
Address=('192.168.2.5/24')

check /var/log/everything.log to see what is going on, it might help debug. you could grep eth to get most relenant lines.

also, i forget the exact command, but maybe you need to enable the service (just needed once).

EDIT: on the rare times automatic does not work, i use alias have in my .bashrc so can enter "ethup" (with keyboard) without worries about correct syntax:

alias ethup="ifconfig eth0 192.168.2.5 netmask 255.255.255.0 up"
FORUM TIP: To view just one person's posting history, sign in, click on their user name, then click on "Search User's Posts." || My 512MB Model B only runs Arch.
Kaikz
Posts: 8
Joined: Thu Aug 29, 2013 3:59 am

Re: Arch linux static local ip address?

Postby Kaikz » Sat Aug 31, 2013 1:42 am

sdjf wrote:EDIT: on the rare times automatic does not work, i use alias have in my .bashrc so can enter "ethup" (with keyboard) without worries about correct syntax:

alias ethup="ifconfig eth0 192.168.2.5 netmask 255.255.255.0 up"

I've been having the same issue as you have, with my static IP netctl config not enabling at boot.
This command seems to work, but then I cannot access the internet, it only works over my LAN.
Edit: That config also doesn't work, same issue. :/
Edit2: Just got some help in IRC, try this, it worked for me! https://wiki.archlinux.org/index.php/Ne ... ng_systemd
sisif
Posts: 5
Joined: Mon Aug 26, 2013 1:07 pm

Re: Arch linux static local ip address?

Postby sisif » Sat Aug 31, 2013 3:22 am

to surfatwork: yes, it is eth0.
to sdjf:
I'll try commenting out those lines. The service is enabled, as I mentioned before, with 'netctl enable lup_static'. The 'alias' looks like a good idea, the only thing is: if the Pi reboots without getting the static IP and I want to ssh over internet to it (one reason I need static IP), can I do it?

I've tried just about any combination of settings and profiles I could think of... not only they don't work, but most of the changes I make (the most damaging being 'systemctl disable dhcpcd@eth0.service') render 'the most stable OS in the universe' dead, crippled, unusable! Why would changing a setting in a stupid text config. file lead to a million I/O errors (at boot), 'partition is read only', etc. etc. a total crash of the OS, and the SD card filled with garbage, is beyond me. I have a PC next to me running DiskImager 24/7 and writing card after card! Windows crashes/BSOD? Haven't seen one in almost two decades! But, let's not go there...
What drives me crazy is not the horrible quality of this unfinished OS and its documentation – I can anticipate the choir of happy linux users throwing the old saying at me: “if you don't like it, why don't you write it yourself?”; it is the fact that what I'm doing for two weeks now, is basically installing and setting up the OS! A far cry from installing applications and doing something useful with the thing.
Anyways, for anyone interested (I know I'm not alone in this mess called netctl), I found something that looks like a downgrade, but works. This is what I did (probably old news for many of you):

1. # pacman -S initscripts /whatever that is
2. # reboot
3. # vi /etc/rc.conf
4. edited lines 86-90 (originally empty after '=') to look like this:
interface=eth0
address=192.168.1.201
netmask=255.255.255.0
broadcast=192.168.1.255
gateway=192.168.1.255
Of course, use settings appropriate to your situation.
5. reboot

It seems to be using the old netcfg, not the newest and greatest netctl, but it works! No services to start/enable/disable, no errors whatsoever!

Thanks a lot for your help! Anyway, I'll keep trying to find the solution to this netctl thing. It was supposed to be easy, right?!
sdjf
Posts: 1388
Joined: Fri Mar 16, 2012 5:20 am
Location: California
Contact:

Re: Arch linux static local ip address?

Postby sdjf » Sun Sep 01, 2013 1:59 pm

If you need to ssh over internet to your Pi, it needs a different network address in addition to the one you use locally.

If you think you had trouble setting your system up, you ought to read my initial posts here. It took me quite a few months before I got things going because I was doing so headless from very crotchety PDAs. Everyone said it was impossible, but I was determined, and succeeded. But it also was a nightmare.

And netctl is working better for me than netcfg did, but I am only doing local ssh on one ethernet connection. The other connection is over USB and cannot be handled by netctl, I use a udev rule to get my USB connection going.

And could not get the most recent images to work and decided to stick with the May one, as I have too much else to do, to try to see if the more recent images will work better. The old one is working for me to do what I need to do with my Pi, so I understand the concept of sticking with something old. It would eventually be good to figure out how to use netctl (on a different experimental card) so that you can take advantage of updates or adding packages that require newer libraries...things do break when you start picking and choosing packages. So I am not installing new precompiled stuff, to avoid those issues.

I guess just keep dropping in and searching, maybe at some point somebody or something will pop up that helps you figure out how to do what you want. It took me months before I found the udev rule that worked to automate my USB connection.
FORUM TIP: To view just one person's posting history, sign in, click on their user name, then click on "Search User's Posts." || My 512MB Model B only runs Arch.
surfatwork
Posts: 62
Joined: Mon May 06, 2013 8:26 am

Re: Arch linux static local ip address?

Postby surfatwork » Wed Sep 04, 2013 7:56 pm

sisif
Posts: 5
Joined: Mon Aug 26, 2013 1:07 pm

Re: Arch linux static local ip address?

Postby sisif » Thu Sep 05, 2013 1:59 pm

Thanks for your replies, guys. Like I said, I've got it to work using the old netcfg method... The pi does a complete reboot in about 10 sec - not that I‘d care if it was 1 minute. No errors shown and I can ssh to it over internet, using public key only and with the help of a no-ip account, while having dynamic ip address from my isp. I'm currently connecting from 2 desktops running ubuntu (home and work) and an android phone.
To sdjf: ‘sticking with an older OS that works’, plus arch not having a large pool of users to begin with, are probably the reasons very few people are complaining about this netctl issue. I’ve decided to stop pulling my hair, for the time being and move on. Some day they’ll release a new version with this bug(?) fixed and new ones added… Or a guy who had the time/knowledge/nerves to investigate this to death, will come out with something like: remove those parentheses, or replace them with square brackets, or put spaces instead of commas somewhere, etc. etc. I’ll keep an eye on this, but not go crazy, and as long as I have a solution that works, I don’t care if it is a 1745 version!
To surfatwork: of course I’ve been following that thread and tried all that, but it never worked, either for me or for the OP.
pepedog
Posts: 1044
Joined: Fri Oct 07, 2011 9:55 am

Re: Arch linux static local ip address?

Postby pepedog » Thu Sep 05, 2013 7:42 pm

systemctl enable netctl-ifplugd@eth0
This will run through all profiles in /etc/netctl/ where interface is eth0
Of course check ifplugd is installed.

A radical way to bring up network early
http://archlinuxarm.org/forum/viewtopic.php?f=31&t=6037#p34228
BulletProofPoet
Posts: 1
Joined: Fri Dec 13, 2013 11:44 am

Re: Arch linux static local ip address?

Postby BulletProofPoet » Fri Dec 13, 2013 11:59 am

Hi all,

This is my first post, so please excuse any mistakes.

I seem to have just gotten a static IP address working using netctl (I believe). In order to do so, I'm using the archlinux-hf-2013-07-22.img.zip image, downloaded from the Raspberry Pi site.

I've copied the /etc/netctl/examples/ethernet-static file to /etc/netctl/

Code: Select all

cd /etc/netctl
cp examples/ethernet-static .


I then modified it to contain the desired static IP address ('192.168.0.10/24').

Description='A basic static ethernet connection'
Interface=eth0
Connection=ethernet
IP=static
Address='192.168.0.10/24'
Gateway='192.168.0.1'
DNS='192.168.0.1'


Next, I issued the following commands and rebooted:

Code: Select all

netctl enable ethernet-static
systemctl disable dhcpcd@eth0.service


The last command was required as, until I did this, the Pi continued to grab a dynamic IP address from my router. I'm not sure if this is configured correctly, but it seems to be working. Does anybody know how I can check whether this is correct and ensure that I don't have netcfg installed alongside netctl (I'm a little concerned that there may be conficts)?

Cheers

Rich
pepedog
Posts: 1044
Joined: Fri Oct 07, 2011 9:55 am

Re: Arch linux static local ip address?

Postby pepedog » Fri Dec 13, 2013 5:09 pm

Perfect
Later image, which is still not on rpi download page for some reason had systemctl enable netctl-ifplugd@eth0
eth0 is the interface name in the file in /etc/netctl/, not the filename in /etc/netctl/
That service runs through all files where the interface is set to eth0
lanyuliuyun
Posts: 1
Joined: Sun Dec 15, 2013 4:06 pm

Re: Arch linux static local ip address?

Postby lanyuliuyun » Sun Dec 15, 2013 4:22 pm

Hi BulletProofPoet !
Thanks soooo much for your suggestion !
I finally get my Pi connected via static IP using your method !
I tried all configurations about IP on ArchWiki but no one works.
glnds
Posts: 4
Joined: Thu Feb 20, 2014 7:33 pm

Re: Arch linux static local ip address?

Postby glnds » Thu Feb 20, 2014 7:57 pm

Out of the box the latest images of Arch also run the following service: netctl-ifplugd@interface.service.
According to the documentation this service has the following impact on your netctl profiles:

netctl-ifplugd@interface.service will prefer profiles which use DHCP. To prefer a profile with a static IP, you can use AutoWired=yes


So if you define a netctl profile to configure a static ip you have to add the following line:
AutoWired=yes

Here's an example:

Code: Select all

Description='A basic static ethernet connection'
Interface=eth0
Connection=ethernet

AutoWired=yes

IP=static
Address=('192.168.1.31/24')
#Routes=('192.168.0.0/24 via 192.168.1.2')
Gateway='192.168.1.1'
DNS=('192.168.1.1')


Reboot. You're all set.

See also: http://blog.pixxis.be/post/77298179924/setting-up-a-static-ip-on-arch-linux
cd127
Posts: 2
Joined: Fri Mar 28, 2014 8:41 pm

Re: Arch linux static local ip address?

Postby cd127 » Sun May 25, 2014 2:29 pm

I had some problems with a static IP address some time ago as well.
I was using the same example file as many of you posted here, including glnds.
My problem was solved when I noticed that the line with
Gateway='192.168.1.1'
didn't have brackets whereas the other ones did.
I changed it to
Gateway=('192.168.1.1')
and ever since it has worked without problems!