wiki:add_additional_ip_address_interface
This is an old revision of the document!
Table of Contents
Add additional ip address on interface
ip addr add 94.130.84.168/27 dev eth0
root@server:~# ip addr add 94.130.84.168/27 dev eth0
/etc/network/interfaces example (for persistence over reboot):
root@server ~ # cat /etc/network/interfaces ### Hetzner Online GmbH installimage source /etc/network/interfaces.d/* auto lo iface lo inet loopback iface lo inet6 loopback auto eno1 iface eno1 inet static address 94.130.84.168 netmask 255.255.255.128 gateway 94.130.84.129 # route 94.130.84.128/25 via 94.130.84.129 up route add -net 94.130.84.128 netmask 255.255.255.128 gw 94.130.84.129 dev eno1 up ip addr add 94.130.84.239/25 dev eno1 down ip addr del 94.130.84.239/25 dev eno1 up ip addr add 94.130.84.240/25 dev eno1 down ip addr del 94.130.84.240/25 dev eno1 up ip addr add 94.130.84.231/25 dev eno1 down ip addr del 94.130.84.231/25 dev eno1 up ip addr add 94.130.84.230/25 dev eno1 down ip addr del 94.130.84.230/25 dev eno1 up ip addr add 94.130.84.229/25 dev eno1 down ip addr del 94.130.84.229/25 dev eno1 iface eno1 inet6 static address 2a01:4f8:c0:20cb::2 netmask 64 gateway fe80::1 auto br0 iface br0 inet static address 10.10.10.1 netmask 255.255.255.0 bridge_ports none bridge_fd 0 bridge_stp off bridge_maxwait 5 pre-up /sbin/brctl addbr br0
Adding routes
Change IPs accordingly:
If you get an error:
# ip route add default via 15.235.15.254 dev br0 Error: Nexthop has invalid gateway.
You have to add a route to the gateway itself:
ip route add 15.235.15.0/24 dev br0 src 15.235.15.201 metric 100
Then you can add a default route.
ip route add default via 15.235.15.254 dev br0
Tested on
See also
- Set up IPv6 on host and VM - example of IPv6 addresses and routes
References
wiki/add_additional_ip_address_interface.1760012434.txt.gz · Last modified: by antisa