Other OS

Static IP config failed

3 8298
Tilmann  
I try to swich from a DHCP network configuration to a static IP configuration, but this won't work.

I am using the ArchLinux_For_BananaPi_v2_0.img.
After the first boot, I have upgraded the system via:
  1. pacman -Syy
  2. pacman -Su
Copy the Code
Then I change the IP-Config to
  1. [root@lemaker ~]# cat /etc/netctl/eth0
  2. Description='static ethernet connection'
  3. Interface=eth0
  4. Connection=ethernet
  5. IP=static
  6. Address='192.168.178.101/24'
  7. Gateway='192.168.178.1'
  8. DNS='192.168.178.1'

  9. [root@lemaker ~]#
Copy the Code
I I try to activate eth0 the result is:
  1. [root@lemaker ~]# netctl start eth0
  2. A dependency job for netctl@eth0.service failed. See 'journalctl -xn' for details.
  3. [root@lemaker ~]# journalctl -xn
  4. -- Logs begin at Fri 2010-01-01 00:00:03 UTC, end at Sat 2014-09-20 19:51:03 UTC. --
  5. Sep 20 19:50:52 lemaker systemd-timesyncd[84]: Using NTP server [2001:4860:4802:32::f]:123 (time1.google.com).
  6. Sep 20 19:50:52 lemaker systemd-timesyncd[84]: Using NTP server 216.239.34.15:123 (time2.google.com).
  7. Sep 20 19:51:03 lemaker systemd-timesyncd[84]: Timed out waiting for reply from 216.239.34.15:123 (time2.google.com).
  8. Sep 20 19:51:03 lemaker systemd-timesyncd[84]: Using NTP server [2001:4860:4802:34::f]:123 (time2.google.com).
  9. Sep 20 19:51:03 lemaker systemd-timesyncd[84]: Using NTP server 216.239.36.15:123 (time3.google.com).
  10. Sep 20 19:51:03 lemaker systemd[1]: Job sys-subsystem-net-devices-eth0.device/start timed out.
  11. Sep 20 19:51:03 lemaker systemd[1]: Timed out waiting for device sys-subsystem-net-devices-eth0.device.
  12. -- Subject: Unit sys-subsystem-net-devices-eth0.device has failed
  13. -- Defined-By: systemd
  14. -- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
  15. --
  16. -- Unit sys-subsystem-net-devices-eth0.device has failed.
  17. --
  18. -- The result is timeout.
  19. Sep 20 19:51:03 lemaker systemd[1]: Dependency failed for static ethernet connection.
  20. -- Subject: Unit netctl@eth0.service has failed
  21. -- Defined-By: systemd
  22. -- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
  23. --
  24. -- Unit netctl@eth0.service has failed.
  25. --
  26. -- The result is dependency.
  27. [root@lemaker ~]#
Copy the Code
Anny ideas?
Tilmann
srtech  
Post Last Edited by srtech at 2014-9-22 14:43

Post Last Edited by srtech at 2014-9-22 14:34

I use systemd to setup a static network configuration since its the newest way of setting up a network and probably will become the default soon.

Create the file /etc/systemd/network/10.eth0.network changing the address and gateway  to your preference:

  1. [Match]
  2. Name=eth0

  3. [Network]
  4. DNS=8.8.8.8
  5. DNS=4.2.2.1
  6. Address=192.168.4.46/16
  7. Gateway=192.168.0.1
  8. DHCP=no
Copy the Code
Now disable dhcpcd:

  1. sudo systemctl stop dhcpcd.service
  2. sudo systemctl disable dhcpcd.service
  3. sudo rm /etc/systemd/system/multi-user.target.wants/dhcpcd.service
Copy the Code
Next enable systemd-networkd:

  1. sudo systemctl enable systemd-networkd
  2. sudo systemctl start systemd-networkd
Copy the Code
And enable systemd-resolved:

  1. sudo systemctl enable systemd-resolved
  2. sudo systemctl start systemd-resolved
Copy the Code
Lastly, symlink the resolve.conf generated by systemd-resolved to the one in /etc:

  1. sudo ln -fs /run/systemd/resolve/resolv.conf /etc/resolv.conf
Copy the Code

srtech  
Post Last Edited by srtech at 2014-9-22 14:36

Post Last Edited by srtech at 2014-9-22 14:35

Follow up notes:
If you change 10.eth0.network to DHCP=yes and re-enable dhcpcd with the commands

  1. sudo systemctl enable dhcpcd.service
  2. sudo systemctl start dhcpcd.service
Copy the Code
You will have the static ip address and obtain a dynamic ip address at the same time. Nifty!

Alternately, If you set DHCP=yes and  comment out the "Address=" and "Gateway=" lines in 10.eth0.network

You will be back to just obtaining a dynamic ip address via dhcp.

cpcnw  
Sorry for necro bumping nearly a year on but like Tilmann I have exactly the same issue!

So, I followed srtech instructions (which are similar to other posts I found on same subject) and rebooted but still no static ip.

So I thought I would try from start with;


# systemctl stop netctl@eth0.service
# systemctl stop dhcpcd.service
# systemctl stop systemd-networkd.socket
# systemctl stop systemd-networkd.service
# systemctl stop systemd-resolved
# systemctl disable netctl@eth0.service
# systemctl disable dhcpcd.service

I then removed my eth0 file

# rm /etc/netctl/eth0

I then created /etc/systemd/network/10.eth0.network as per srtech advice followed by;

# systemctl disable systemd-networkd.socket
# systemctl disable systemd-networkd.service
# systemctl disable systemd-resolved


# systemctl enable systemd-networkd.socket
# systemctl enable systemd-networkd.service
# systemctl enable systemd-resolved


# systemctl start systemd-networkd.socket
# systemctl start systemd-networkd.service
# systemctl start systemd-resolved

I then rebooted but still no connection. I then tried

# ifconfig eth0 up which showed link up but still no ping to outside so I ran the last 3 start commands above again and I have success!


However, this does not survive a reboot. If any seasoned Arch user can advice on systemd networking and how to make this work at boot up that would be great!



You have to log in before you can reply Login | Sign Up

Points Rules