You are not logged in.
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
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
Is it only possible with adresses or also with gateway?
Offline
You can also specify the "Gateway" option multiple times, yes (for a separate ipv4 and ipv6 gateway for example).
Burninate!
Offline
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.
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
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
ip route was the hint I needed. 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.
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.
Last edited by jascha (2014-03-28 11:20:27)
Offline
Good to hear you managed to get it sorted
Also, don't forget to mark the thread as [SOLVED].
Burninate!
Offline