You are not logged in.

#1 2014-03-26 14:26:44

jascha
Member
From: Germany
Registered: 2014-03-26
Posts: 12

[solved]Static IPv4 & IPv6 with systemd-network

Hello Community,
I think I do have a problem with understandig the new network config syntax in systemd-networkd. My interface is named 'ens3' and I want to configure a static IPv4 & a static IPv6 on this interface. Is it possible or do I have to to use netctl to configure 2 static IPs? Thanks in advance for helping me.

Last edited by jascha (2014-03-31 06:26:25)

Offline

#2 2014-03-26 17:13:27

Gcool
Member
Registered: 2011-08-16
Posts: 1,456

Re: [solved]Static IPv4 & IPv6 with systemd-network

You can simply use multiple similar statements in the same config file.

[Match]
Name=ens3

[Network]
Address=<your_ipv4_address>
Address=<your_ipv6_address>

Burninate!

Offline

#3 2014-03-27 08:30:30

jascha
Member
From: Germany
Registered: 2014-03-26
Posts: 12

Re: [solved]Static IPv4 & IPv6 with systemd-network

Is it only possible with adresses or also with gateway?

Offline

#4 2014-03-27 08:35:56

Gcool
Member
Registered: 2011-08-16
Posts: 1,456

Re: [solved]Static IPv4 & IPv6 with systemd-network

You can also specify the "Gateway" option multiple times, yes (for a separate ipv4 and ipv6 gateway for example).


Burninate!

Offline

#5 2014-03-28 09:54:51

jascha
Member
From: Germany
Registered: 2014-03-26
Posts: 12

Re: [solved]Static IPv4 & IPv6 with systemd-network

I tried that on my current VPS and it does not work with IPv4 and IPv6 enabled the same time. Can't ping anything. As soon as I use IPv4 only, it works like a charm. Do you have a solution for this? With netctl it worked when enabling both. I could switch back to netctl but it bugs me, that i don't have any idea why it doesn't work with systemd-networkd. sad

Working IPv4 "/etc/systemd/network/ens3.network"

[Match]
Name=ens3

[Network]
Address=5.45.xxx.xxx/22
Gateway=5.45.xxx.xxx

Output ip addr with IPv4 only

2: ens3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP gr
oup default qlen 1000
    link/ether 52:54:xx:xx:xx:xx brd ff:ff:ff:ff:ff:ff
    inet 5.45.xxx.xxx/22 brd 5.45.xxx.xxx scope global ens3
       valid_lft forever preferred_lft forever
    inet6 fe80::5054:fff:fe16:b616/64 scope link
       valid_lft forever preferred_lft forever

Last edited by jascha (2014-03-28 10:02:55)

Offline

#6 2014-03-28 10:13:57

Gcool
Member
Registered: 2011-08-16
Posts: 1,456

Re: [solved]Static IPv4 & IPv6 with systemd-network

Could you post the output of the following when you have both ipv4 and ipv6 enabled?

#ip addr
#ip route
#ping 8.8.8.8
#ping www.google.com
#ping6 2001:4860:4860::8888
#ping6 www.google.com

Burninate!

Offline

#7 2014-03-28 10:48:18

jascha
Member
From: Germany
Registered: 2014-03-26
Posts: 12

Re: [solved]Static IPv4 & IPv6 with systemd-network

ip route was the hint I needed. smile With IPv6 enabled it somehow killed my default route for IPv4. ping6 worked perfectly. My solution is somewhat simple. I have to define the IPv6 stuff before IPv4. Now I can use ping and ping6 for google.de. smile And there was something mentioned in the wiki I just have forgotten. systemd-networkd DOES NOT use /etc/resolve.conf. It uses /run/systemd/network/resolv.conf. I had to create a symlink to /etc/resolv.conf and had to set the DNS=x.y.z.z in my /etc/systemd/network/ens3.network. So this is my final solution:

# ln -sf /run/systemd/network/resolv.conf /etc/resolv.conf

and my network config in /etc/systemd/network/ens3.network

[Match]
Name=ens3

[Network]
DNS=2a03:wxyz:x:y::zzzz
Address=2a03:xxxx:yyyy:zzzz::1/64
Gateway=fe80::1

DNS=46.38.xxx.xxx
DNS=46.38.yyy.yyy
Address=5.45.xxx.yyy/22
Gateway=5.45.xxx.z

Thanks again for your help. smile

Last edited by jascha (2014-03-28 11:20:27)

Offline

#8 2014-03-28 14:46:56

Gcool
Member
Registered: 2011-08-16
Posts: 1,456

Re: [solved]Static IPv4 & IPv6 with systemd-network

Good to hear you managed to get it sorted smile

Also, don't forget to mark the thread as [SOLVED].


Burninate!

Offline

Board footer

Powered by FluxBB