Networking¶
How to find the Default Gateway IP Address?¶
If your VPS is not reachable, please check your local network configuration settings. In most cases the default gateway address is missing in the configuration file on Debian-based distributions.
The usable IP addresses and necessary information about the network configuration (such as IP addresses or gateway address) can be found in our customer portal:
https://my.virtualhosts.de/cloud/ => Control => Server Information => IPv4/IPv6 Settings
To change the network configuration, please edit the file /etc/network/interfaces as in the example below:
auto lo
iface lo inet loopback
auto eth0
iface eth0 inet dhcp
pre-up echo 0 > /proc/sys/net/ipv6/conf/eth0/accept_dad
iface eth0 inet6 static
address 2a02:e00:fffx:13e::1/64
iface eth0 inet6 static
address 2a02:e00:fffx:13e::2/64
...
iface eth0 inet6 static
address 2a02:e00:fffx:13e::a/64
up ip -6 route add 2a02:e00:fff0::1 dev eth0
up ip -6 route add default via 2a02:e00:fff0::1
Ubuntu 18 IPv6 configuration¶
To change the network configuration, please edit the file /etc/netplan/50-cloud-init.yaml as in the example below:
network:
version: 2
ethernets:
net0:
accept-ra: no
addresses:
- 130.xxx.xxx.xx/24
- "2a02:e00:xxxx:xx::x/64"
- "2a02:e00:xxxx:xx::x/64"
[...]
gateway4: 130.xxx.xx.x
gateway6: "2a02:e00:xxxx::x"
match:
macaddress: xx:xx:xx:xx:xx:xx
nameservers:
addresses:
- 8.8.8.8
- 8.8.4.4
search: []
routes:
- to: "2a02:e00:xxxx::/64"
via: "::"
on-link: true
- to: "::/0"
via: "2a02:e00:xxxx::"
on-link: true
set-name: net0
Check for syntax errors:
netplan try
Apply the changes:
netplan apply
To prevent cloud-init to configure your network after rebooting you need to disable it. Just set
echo "network: {config: disabled}" > /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg
CentOS 8 IPv6 Network Configuration¶
CentOS 8 network configuration ist done via cloud-init. Due to a bug the IPv6 configuration isn’t set properly. There are two configuration files created:
/etc/sysconfig/network-scripts/ifcfg-net0
/etc/sysconfig/network-scripts/ifcfg-net0:1
Unfortunately ifcfg-net0:1 will not be used. As a workaround you have to copy the configuration starting from IPV6INIT into your ifcfg-net0. This should look like this:
BOOTPROTO=none
DEFROUTE=yes
DEVICE=net0
GATEWAY=xxx.xxx.xxx.xxx
HWADDR=32:c1:5d:46:29:42
IPADDR=xxx.xxx.xxx.xxx
NETMASK=255.255.255.0
ONBOOT=yes
STARTMODE=auto
TYPE=Ethernet
USERCTL=no
IPV6INIT=yes
NM_CONTROLLED="no"
IPV6_DEFAULTGW=2a02:e00:ffec::1
IPV6ADDR_SECONDARIES= "[...]"
ip -6 route add 2a02:e00:ffec::1 dev net0
ip -6 route add ::/0 via 2a02:e00:ffec::1 dev net0
After that you need to restart your network:
systemctl restart network
To prevent cloud-init to configure your network after rebooting you need to disable it. Just set
echo "network: {config: disabled}" > /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg
IPv6 Network configration via nmcli¶
On operating systems like Rocky Linux 9 network configuration can be done via the tool “nmcli”. It is a tool for the NetworkManager.
First you need to disable cloud-init as it would overwrite your network configuration on the next reboot. This can be done by creating an empty file:
touch /etc/cloud/cloud-init.disabled
After that you can start to configure your network connection. First lets get the current information on your network configuration.
nmcli connection show
will show you the name, uuid, type and device of your system. To see the details of an interface, you can enter the name after the command. If the name is “System net0” the command is
nmcli connection show "System net0"
You can also filter the output by using a pipe
nmcli connection show "System net0" | grep ipv4
nmcli connection show "System net0" | grep ipv6
Now lets add a primary IPv6 address to the interface. In our example we use “System net0” and ‘2a02:e00:ffec:85::1/64’. Please use your own interface name and IPv6 addresses.
nmcli connection modify "System net0" ipv6.addresses '2a02:e00:ffec:85::1/64' ipv6.method manual
To add more IPv6 addresses simply add them by using a plus (+) before “ipv6.addresses”. Use one of your additional IPv6 addresses instead of the one shown in the example. You have 10 IPv6 addresses in total you can use.
nmcli connection modify "System net0" +ipv6.addresses '2a02:e00:ffec:85::2/64'
After you set the IP addresses, you need to set the gateway address for your system. Please look up your gateway address and use it instead of the one shown in this example.
nmcli connection modify "System net0" ipv6.gateway '2a02:e00:ffec::1'
The configuration is now modified, but not applied. To apply the chance you need to bring the device up
nmcli connection up "System net0"
That is it. Now you have added IPv6 addresses to your system. In addition, if you should prefer a gui, you can use
nmtui
to access a gui-based configuration tool.