You can use nmcli
to assign the IP addresses.
For multiple interfaces
nmcli con add con-name static1 type ethernet ipv4.addresses <IP_ADDRESS>/<SUBNET_CIDR> ipv4.method manual ipv4.gateway <GATEWAY_IP> connection.autoconnect yes ifname <INTERFACE> ipv4.dns "8.8.8.8 8.8.4.4"
route add -net <Network> netmask <subnet> dev <interface>
route add default gw <gateway>
Example with data filled...
nmcli con add con-name static1 type ethernet ipv4.addresses 192.168.0.101/24 ipv4.method manual ifname eth0 ipv4.gateway 192.168.0.1 ipv4.dns "8.8.8.8 8.8.4.4" connection.autoconnect yes
nmcli con add con-name static2 type ethernet ipv4.addresses 172.16.0.101/24 ipv4.method manual ifname eth1 ipv4.gateway 172.16.0.1 ipv4.dns "8.8.8.8 8.8.4.4" connection.autoconnect yes
route add -net 192.168.0.0 netmask 255.255.255.0 dev eth1
route add default gw 192.168.0.1
route add -net 172.16.0.0 netmask 255.255.255.0 dev eth0
For a single interface
# For routes nmcli has a ipv4.routes option that is "<IP_NETWORK>/<CIDR> <GATEWAY>, <IP_NETWORK_2> <GATEWAY_2>,..."
nmcli con add con-name static2 type ethernet ipv4.addresses 172.16.0.101/24,192.168.0.101/24 ipv4.method manual ifname eth0 ipv4.gateway 172.16.0.1 ipv4.dns "8.8.8.8 8.8.4.4" connection.autoconnect yes
route add -net 192.168.0.0 netmask 255.255.255.0 dev eth0
route add default gw 192.168.0.1
route add -net 172.16.0.0 netmask 255.255.255.0 dev eth0
Documentation on some of the items shown:
Using route for setting routes
https://www.techrepublic.com/article/understand-the-basics-of-linux-routing/
Basic nmcli documentation
https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/networking_guide/sec-configuring_ip_networking_with_nmcli
Related to using ipv4.routes with nmcli
https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/networking_guide/sec-configuring_static_routes_using_nmcli
https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/html/configuring_and_managing_networking/configuring-static-routes_configuring-and-managing-networking