sim_tcr
Posts: 331
Joined: Tue Nov 06, 2012 1:01 pm
Location: Bangalore
Contact: Website

help in assigning static ip address on arch.

Sun Mar 10, 2013 11:07 am

Hello,

How do I assign static ip address on arch.?

Please provide example values.

Thanks,
Simon Mandy
http://raspisimon.no-ip.org
Raspberry Pi Model B x 2, Raspberry Pi 2 x 2, Transcend 32GB Class 10, Transcend 16GB Class 10, Transcend 8GB Class 4, Custom 12V 1.5A (stepped down to 5.5V)


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

Re: help in assigning static ip address on arch.

Sun Mar 10, 2013 11:48 am

Or lazy way, just edit /etc/network.d/ethernet-eth0

User avatar
KnightMB
Posts: 40
Joined: Sun Dec 23, 2012 4:31 pm
Contact: Website

Re: help in assigning static ip address on arch.

Sun Mar 10, 2013 2:11 pm

pepedog wrote:Or lazy way, just edit /etc/network.d/ethernet-eth0
I prefer the lazy way as well :)

The only issue is the netmask is left out, so you have to add it.

But here is a good example:

Code: Select all

## Change for static
#CONNECTION='ethernet'
#DESCRIPTION='A basic static ethernet connection using iproute'
#INTERFACE='eth0'
IP='static'
ADDR='192.168.1.12'
NETMASK='255.255.255.0'
GATEWAY='192.168.1.1'
DNS=('192.168.1.1' '192.168.1.2')
Raspberry Pi + Timekoin = Next Generation Digital Currency

sdjf
Posts: 1395
Joined: Fri Mar 16, 2012 5:20 am
Location: California
Contact: Website

Re: help in assigning static ip address on arch.

Sun Mar 10, 2013 4:02 pm

Please clarify, what are each of the following in the above example for in /etc/network.d/ethernet-eth0? Which is the pi?

ADDR='192.168.1.12'


DNS of 192.168.1.1
DNS of 192.168.1.2

I am confused as I will only have two ethernet devices - my pi and my pda.
FORUM TIP: To view someone's posting history, sign in, click on their user name, then on "Search User's Posts." || Running ArchLinuxArm on Model 2B and 512MB Model B

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

Re: help in assigning static ip address on arch.

Sun Mar 10, 2013 4:41 pm

The above is for when you are on a network. Basically set settings of what you get with dhcpd.
If it was your arrangement of connecting device to device, you wouldn't mention the other device.

User avatar
KnightMB
Posts: 40
Joined: Sun Dec 23, 2012 4:31 pm
Contact: Website

Re: help in assigning static ip address on arch.

Mon Mar 11, 2013 7:36 pm

sdjf wrote:Please clarify, what are each of the following in the above example for in /etc/network.d/ethernet-eth0? Which is the pi?

ADDR='192.168.1.12'


DNS of 192.168.1.1
DNS of 192.168.1.2

I am confused as I will only have two ethernet devices - my pi and my pda.
ADDR is the static IP you want to set.
ADDR='192.168.1.12'

To use two DNS, you must separate them with a space and enclose in ' ', example
DNS=('192.168.1.1' '192.168.1.2')
Raspberry Pi + Timekoin = Next Generation Digital Currency

sdjf
Posts: 1395
Joined: Fri Mar 16, 2012 5:20 am
Location: California
Contact: Website

Re: help in assigning static ip address on arch.

Mon Mar 11, 2013 8:17 pm

Thanks, Uh, I guess I do not understand why DNS numbers would be in this file for ethernet. Would they be the DNS/IP numbers of other devices getting connected to the Pi?

And will the Pi use the same number for all types of network services? I have it listed as a routing number ending in 5 for my usb0 connection, would I use a different number for it's eth0 connection?

Asking because one PDA can only talk to pi over usb0, the other will be talking to it over eth0 once I get the right adapter for the second PDA.
FORUM TIP: To view someone's posting history, sign in, click on their user name, then on "Search User's Posts." || Running ArchLinuxArm on Model 2B and 512MB Model B

waters
Posts: 5
Joined: Sun Feb 24, 2013 4:27 pm

Re: help in assigning static ip address on arch.

Tue Mar 19, 2013 8:55 pm

The following /etc/network.d/ethernet-eth0 entries provide primary and secondary Arch Linux static ip addresses.

/etc/network.d/ethernet-eth0
CONNECTION='ethernet'
DESCRIPTION='static ethernet connection using iproute'
INTERFACE='eth0'
IP='static'
ADDR='192.168.0.7'
GATEWAY='192.168.0.1'
NETMASK '192.168.0.0/24'
DNS=('192.168.0.1' '192.168.0.2')
SEARCH='your_domain.com'
DOMAIN='your_domain.com'
HOSTNAME='your_host_name'
#secondary ip address
POST_UP='ip addr add 172.16.0.1/24 dev eth0'
PRE_DOWN='ip addr del 172.16.0.1/24 dev eth0'

You enable the configuration with
# systemctl enable netcfg@ethernet-eth0

sdjf
Posts: 1395
Joined: Fri Mar 16, 2012 5:20 am
Location: California
Contact: Website

Re: help in assigning static ip address on arch.

Wed Mar 20, 2013 5:45 pm

I am still clueless about why there should be any DNS shown in this file when it is configuring ethernet and has nothing to do with my internet connection, which is over ppp0 and for which the DNS are set in /etc/resolv.conf files

Am I right in thinking Pepedog meant I can leave the DNS lines out since they are not getting set over eth0?
FORUM TIP: To view someone's posting history, sign in, click on their user name, then on "Search User's Posts." || Running ArchLinuxArm on Model 2B and 512MB Model B

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

Re: help in assigning static ip address on arch.

Wed Mar 20, 2013 6:30 pm

Fixed ip address is wanted for many reasons. The most common is to keep to an address that doesn't wander. Normally resolve is filled by dhcpd (literally overwrite anything you enter), so these entries are doing what dhcpd does. then again you don't need dns if you navigate by ip address

sdjf
Posts: 1395
Joined: Fri Mar 16, 2012 5:20 am
Location: California
Contact: Website

Re: help in assigning static ip address on arch.

Mon Apr 15, 2013 2:08 am

My PDA's ethernet adapter is due to arrive shortly, do I use the same IP address for connecting my Zaurus sl6000 PDA over eth0 to my Pi, as I use for connection my other Zaurus to the Pi over usb0?

Address for usb0 connection is 192.168.129.4 for my Pi over usb.

The Pi is going to be the host over ethernet.

Oh, there is no router involved, I will assign a different IP address for eth0 if I need to, but want to get it figured out now.

The addresses in /boot/cmdline.txt are the ones for the other PDA, and both will need to be connected at the same time, one over usb and the other over ethernet.

EDIT: I guess I see that each type of network uses it's own basic IP pattern for the first three elements of the IP address nnn.nnn.nnn.nnn, But I am surmising that, not finding it clearly stated anywhere. Is that right? Pi will need different IP addresses for each type of network it is on?
FORUM TIP: To view someone's posting history, sign in, click on their user name, then on "Search User's Posts." || Running ArchLinuxArm on Model 2B and 512MB Model B

waters
Posts: 5
Joined: Sun Feb 24, 2013 4:27 pm

Re: help in assigning static ip address on arch.

Mon May 27, 2013 11:25 pm

I finally noticed that Arch Linux netcfg does not support NETMASK. My current /etc/network.d/ethernet-eth0 configuration file is similar to the following:

CONNECTION='ethernet'
DESCRIPTION='static ethernet connection using iproute'
INTERFACE='eth0'
IP='static'
ADDR='192.168.0.7'
GATEWAY='192.168.0.1'
DNS=('192.168.0.1' '192.168.0.2')
SEARCH='your_domain.com'
DOMAIN='your_domain.com'
HOSTNAME='your_host_name'
#secondary ip address
POST_UP='ip addr add 172.16.0.1/24 dev eth0'
PRE_DOWN='ip addr del 172.16.0.1/24 dev eth0'

You enable the configuration with
# systemctl enable netcfg@ethernet-eth0

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

Re: help in assigning static ip address on arch.

Tue May 28, 2013 1:00 pm

Things have changed on the May 2013 image, netcfg no longer available, replaced with netctl. Here is how to

Code: Select all

cp /etc/netctl/examples/ethernet-static /etc/netctl/ethernet-static
nano /etc/netctl/ethernet-static #to your liking
systemctl disable netctl-ifplugd@eth0
netctl enable ethernet-static
Netmask is there, ie
Address=('192.168.1.23/24')

drirr
Posts: 54
Joined: Sun Sep 09, 2012 8:06 am

Re: help in assigning static ip address on arch.

Tue May 28, 2013 2:55 pm

For anyone who isn't used to the CIDR notation, have a look at the table over at wikipedia.
Raspberry Pi (rev 000f, 512MB RAM) with heatsinks and a modmypi case running Arch Linux ARM (armv6h) hooked up to a 750GB 2.5" USB-harddrive

User avatar
KnightMB
Posts: 40
Joined: Sun Dec 23, 2012 4:31 pm
Contact: Website

Re: help in assigning static ip address on arch.

Tue Sep 30, 2014 11:47 am

pepedog wrote:Things have changed on the May 2013 image, netcfg no longer available, replaced with netctl. Here is how to

Code: Select all

cp /etc/netctl/examples/ethernet-static /etc/netctl/ethernet-static
nano /etc/netctl/ethernet-static #to your liking
systemctl disable netctl-ifplugd@eth0
netctl enable ethernet-static
Netmask is there, ie
Address=('192.168.1.23/24')
dhcpcd@eth0.service only needs to be disabled for the static IP file to take hold now.

Code: Select all

# as root
cp /etc/netctl/examples/ethernet-static /etc/netctl/ethernet-static
nano /etc/netctl/ethernet-static #edit to your liking
systemctl disable dhcpcd@eth0.service
netctl enable ethernet-static
Raspberry Pi + Timekoin = Next Generation Digital Currency

Return to “Arch”