You are not logged in.
I've just installed arch arm on a pogoplug, and set it up for network printing and scanning on a HP all in one. It all works wonderfully. I'm connnected thru a router on eth0 with dhcp currently set up.
I'd like to switch it now to a static IP address, so I've read about netctl and I created a profile, but I can't get eth0 down by either ifconfig eth0 down, ip link set eth0 down , or ip link set dev eth0 down.
It doesn't come down, and so I can't start using the new netctl profile.
I don't remember what command I brought it up with, or what network control package I'm using, which would help.
Any idea what I can do to get this down?
Offline
I'm not sure if you need netctl for this: https://wiki.archlinux.org/index.php/St … IP_address
Edit: 'ip link set eth0 down' run as root or with sudo should work.
Last edited by karol (2014-01-09 03:18:45)
Offline
netctl is the easiest way to do it.
cp /etc/netctl/examples/ethernet-static /etc/netctl/ethernet-static
then edit the copied file, make sure you have the right interface (use ip addr or link to find out correct name)
start with
netctl start ethernet-static
start at boot with:
netctl enable ethernet-static
Offline
You can certainly use netctl but it is also perfectly possible and quite easy to use systemd to start the network with a static ip. Basically you need to create two files as follows which I will put sample numbers in ( have used network device name enp0s25 but if yours is eth0 then you can use that instead):
First create a file /etc/systemd/system/network.service with the following (adapt the ip addresses, and network device name for your own situation, and you can change the filename used for the EnvironmentFile definition below):
[Unit]
Description=Network Connectivity (enp0s25)
Wants=network.target
Before=network.target
BindsTo=sys-subsystem-net-devices-enp0s25.device
After=sys-subsystem-net-devices-enp0s25.device
[Service]
Type=oneshot
RemainAfterExit=yes
#
# Internal home network
#
EnvironmentFile=/etc/conf.d/network.static
ExecStart=/usr/bin/ip link set dev ${ifin} up
ExecStart=/usr/bin/ip addr add ${addrin}/${nmin} broadcast ${brdin} dev ${ifin}
ExecStart=/usr/bin/ip route add default via ${gwin}
#ExecStart=/usr/bin/ip addr add ${addr2in} dev ${ifin}
ExecStop=/usr/bin/ip addr flush dev ${ifin}
ExecStop=/usr/bin/ip link set dev ${ifin} down
[Install]
WantedBy=multi-user.target
Then create a suitable file which is the EnvironmentFile named in this case /etc/conf.d/network.static referenced by the file above with the contents:
#
# Home Network
#
# device name
ifin=enp0s25
# static address
addrin=10.0.0.10
# netmask
nmin=24
# broadcast address
brdin=10.0.0.255
# gateway
gwin=10.0.0.135
Then all you need to do is to set the current card down as in the previous posts
ip addr flush dev eth0
ip link set dev eth0 down
, and stop and disable the dhcpcd service with
systemctl stop dhcpcd
systemctl disable dhcpcd
and
systemctl disable dhcpcd
, and then start the network service via systemd:
systemctl start network
and to make it come up at boot just do
systemctl enable network
I have this method tried and tested and it works fine - however I also note that you are running arch arm - so if this suggestion does not work you may need to ask the same question on the archlinuxarm forum rather than this mainstream forum for Arch.
Mike C
Offline
You can certainly use netctl but it is also perfectly possible and quite easy to use systemd to start the network with a static ip.
This methos is also documented in the wiki: https://wiki.archlinux.org/index.php/Ne … ng_systemd
Last edited by 2ManyDogs (2014-01-09 17:41:35)
Offline
mcloaked wrote:You can certainly use netctl but it is also perfectly possible and quite easy to use systemd to start the network with a static ip.
This methos is also documented in the wiki: https://wiki.archlinux.org/index.php/Ne … ng_systemd
Yes it is although it uses different variables such as %i - the use of variables is explained in the systemd documentation if you want to vary the method, and it is a very good idea to read the documention on systemd carefully to help getting the service files set up correctly. http://www.freedesktop.org/software/sys … .unit.html
Mike C
Offline