You are not logged in.

#1 2019-08-23 16:49:10

Jphillips
Member
Registered: 2019-08-23
Posts: 68

Setting static IP with wired connection

I am working through the Arch network configuration wiki for setting a static IP, and while I can get the connection up and running, I can't seem to make it persist across reboots.

Specifically, when I restart my computer I have to run:

$ sudo dhcpcd 

and then

$ systemctl restart systemd-networkd 

At which point the connection is working. When I reboot, I have to re-run these steps. After a bunch of troubleshooting, I can't figure out if the mistake is in /etc/systemd/network/20-wired.network, or /etc/dhcpd.conf, or /etc/resolv.conf, or somewhere else, so I'm not really sure where to begin to debug. Any thoughts or suggestions would be appreciated!

Last edited by Jphillips (2019-08-26 10:14:15)

Offline

#2 2019-08-23 17:40:24

loqs
Member
Registered: 2014-03-06
Posts: 19,101

Re: Setting static IP with wired connection

Welcome to the archlinux forums Jphillips.
Does the network support static IP address use?  What is the contents of /etc/systemd/network/20-wired.network?
What is the status of systemd-networkd  after boot before dhcpcd is started and systemd-networkd is restarted?

Offline

#3 2019-08-26 13:22:20

Jphillips
Member
Registered: 2019-08-23
Posts: 68

Re: Setting static IP with wired connection

Thanks for the reply. The network is set up for static ip, and I have a specific IP tied to my mac address.

Right now the contents of /etc/systemd/network/20-wired.network are (ip numbers are starred out):

[Match]
Name=enp6s0

[Network]
Address=129.*****.235/24
Gateway=129.*****.1
DNS=129.*****.1

When I check on systemd-networkd status upon restart, I get:

systemd-networkd.service - Network Service
   Loaded: loaded (/usr/lib/systemd/system/systemd-networkd.service; enabled; vendor preset: enabled)
   Active: active (running) since Mon 2019-08-26 14:59:44 CEST; 1min 40s ago
     Docs: man:systemd-networkd.service(8)
 Main PID: 419 (systemd-network)
   Status: "Processing requests..."
    Tasks: 1 (limit: 4915)
   Memory: 3.5M
   CGroup: /system.slice/systemd-networkd.service
           └─419 /usr/lib/systemd/systemd-networkd

Aug 26 14:59:44 myarch systemd[1]: Starting Network Service...
Aug 26 14:59:44 myarch systemd-networkd[419]: Enumeration completed
Aug 26 14:59:44 myarch systemd-networkd[419]: enp6s0: Interface name change detected, enp6s0 has been renamed to eth0.
Aug 26 14:59:44 myarch systemd[1]: Started Network Service.
Aug 26 14:59:44 myarch systemd-networkd[419]: eth0: Interface name change detected, eth0 has been renamed to enp6s0.
Aug 26 14:59:45 myarch systemd-networkd[419]: wlan0: Interface name change detected, wlan0 has been renamed to wlp4s0.
Aug 26 14:59:48 myarch systemd-networkd[419]: enp6s0: Gained carrier
Aug 26 14:59:49 myarch systemd-networkd[419]: enp6s0: Gained IPv6LL
Aug 26 14:59:53 myarch systemd-networkd[419]: enp6s0: Configured

After running sudo dhcpcd and restarting systemd-networkd, the status is now:

systemd-networkd.service - Network Service
   Loaded: loaded (/usr/lib/systemd/system/systemd-networkd.service; enabled; vendor preset: enabled)
   Active: active (running) since Mon 2019-08-26 15:03:28 CEST; 15s ago
     Docs: man:systemd-networkd.service(8)
 Main PID: 2720 (systemd-network)
   Status: "Processing requests..."
    Tasks: 1 (limit: 4915)
   Memory: 1.8M
   CGroup: /system.slice/systemd-networkd.service
           └─2720 /usr/lib/systemd/systemd-networkd

Aug 26 15:03:27 myarch systemd[1]: Starting Network Service...
Aug 26 15:03:28 myarch systemd-networkd[2720]: enp6s0: Gained IPv6LL
Aug 26 15:03:28 myarch systemd-networkd[2720]: lo: Gained IPv6LL
Aug 26 15:03:28 myarch systemd-networkd[2720]: Enumeration completed
Aug 26 15:03:28 myarch systemd[1]: Started Network Service.
Aug 26 15:03:28 myarch systemd-networkd[2720]: enp6s0: Configured
Aug 26 15:03:29 myarch systemd-networkd[2720]: enp6s0: DHCPv6 address 2001:***********::87/128 timeout preferred 7200 valid 10800

Perhaps it's a mismatch between my 20-wired.network being in terms of ipv4, when it looks it's connecting through v6?

Offline

#4 2019-08-26 13:34:08

schard
Forum Moderator
From: Hannover
Registered: 2016-05-06
Posts: 2,716
Website

Re: Setting static IP with wired connection

Firstly you should select one, and only one, network management service to run. Dhcpcd is used for obtaining dynamic IP addresses in the interfaces. So you should disable it.
Also post the output of "ip addr" and "ip route"


Inofficial first vice president of the Rust Evangelism Strike Force

Online

#5 2019-08-26 16:52:06

loqs
Member
Registered: 2014-03-06
Posts: 19,101

Re: Setting static IP with wired connection

What connectivity tests have you tried with what results before invoking dhcpcd?

Offline

#6 2019-08-26 17:25:33

Jphillips
Member
Registered: 2019-08-23
Posts: 68

Re: Setting static IP with wired connection

Before invoking dhcpd, I can actually ping sites successfully, and I can search on google.com, and some other sites appear to work as well (e.g., this forum). I have been using the NetworkManager gui, which I thought was just a gui, but now I realize I'm probably just creating a mess of different competing network clients on my system. 

I've disable dhcpch and systemd-networkd, and upon boot I get this for ip addr:

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: enp6s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
    link/ether 04:*****:41 brd ff:ff:ff:ff:ff:ff
3: wlp4s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
    link/ether 38:*****:58 brd ff:ff:ff:ff:ff:ff
    inet 129.*****.229/23 brd 129.*****.255 scope global dynamic noprefixroute wlp4s0
       valid_lft 86257sec preferred_lft 86257sec
    inet6 2001:*****:8000::52/128 scope global dynamic noprefixroute 
       valid_lft 10660sec preferred_lft 7060sec
    inet6 fe80::*****:5685/64 scope link noprefixroute 
       valid_lft forever preferred_lft forever

Once I start dhcpcd and systemd-netword, this becomes:

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: enp6s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
    link/ether 04:*****:41 brd ff:ff:ff:ff:ff:ff
    inet 129.*****.235/24 brd 129.*****.255 scope global noprefixroute enp6s0
       valid_lft forever preferred_lft forever
    inet6 2001:*****::1084/128 scope global dynamic noprefixroute 
       valid_lft 10776sec preferred_lft 7176sec
    inet6 fe80::*****:a30d/64 scope link noprefixroute 
       valid_lft forever preferred_lft forever
3: wlp4s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
    link/ether 38:*****:58 brd ff:ff:ff:ff:ff:ff
    inet 129.*****.229/23 brd 129.*****.255 scope global dynamic noprefixroute wlp4s0
       valid_lft 86049sec preferred_lft 86049sec
    inet6 2001:6*****0::52/128 scope global dynamic noprefixroute 
       valid_lft 10453sec preferred_lft 6853sec
    inet6 fe80::*****:5685/64 scope link noprefixroute 
       valid_lft forever preferred_lft forever

The output of ip route is:

default via 129.*****.1 dev enp6s0 src 129.*****.235 metric 202 
129.*****.0/24 dev enp6s0 proto kernel scope link src 129.*****.235 metric 100 
129.*****.0/24 dev enp6s0 proto dhcp scope link src 129.*****.235 metric 202

Once connected, if I turn off ipv6 through NetworkManager, my connection drops out, and is restarted once I set ipv6 back to "automatic".

Offline

Board footer

Powered by FluxBB