Can i use multiple gateway in one nic card?

sudo nmcli connection modify “[CONNECTION_NAME]”
ipv4.method “manual”
ipv4.addresses “192.168.0.1,192.168.02”
ipv4.gateway “[GATEWAY_IP_ADDRESS]”

i can use multiple ip addresses in one nic card.

But if this multi gateway,

How can add ip addresses?

You can’t set multiple (default) gateways for one connection, thats what routes are for. IP routes determine the way a IP package should take. You can configure them like:

nmcli connection modify <CONNECTION_NAME> +ipv4.routes "<TARGET_NETWORK>/<CIDR_OR_MASK> <GATEWAY>"

The +ipv4.routes adds the route, -ipv4.routes will delete it.

2 Likes