{{tag>networking routing ipv4}} ====== Add additional ip address on interface ====== First make sure the interface is up: ip link set eth0 up then add an address: 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 If you get: connect: Network unreachable when trying to ping an address, you have to add a default route. ====== Tested on ====== * ====== See also ====== * [[set_up_ipv6_host_vm|Set up IPv6 on host and VM]] - example of IPv6 addresses and routes ====== References ====== * https://access.redhat.com/sites/default/files/attachments/rh_ip_command_cheatsheet_1214_jcs_print.pdf