How to change the default route after the system was booted with the network being up (typically when root is on iSCSI or Clevis is being used)

Solution Verified - Updated -

Issue

  • When booting with network enabled, I see multiple default gateways on different network interfaces

    # ip r
    default via 10.0.0.1 dev ibft0
    default via 192.168.0.1 dev enp6s0 proto static metric 100
    10.0.0.0/16 dev ibft0 proto kernel scope link src 10.0.250.20
    192.168.0.0/24 dev enp6s0 proto kernel scope link src 192.168.0.20
    

    In the example above, the system was booted with root device on iSCSI on ibft0, but we want only enp6s0 as default gateway once booted.

  • When booting with network enabled, typically by specifying ip=dhcp:eth0 on the kernel command line, the default gateway is eth0 but I need to use eth1 instead

Environment

  • Red Hat Enterprise Linux
    • network boot (iSCSI, NFS, Clevis, ...)

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content