Change default gateway ubuntu

    how to change default gateway in linux
    how to change default gateway in linux permanently
    how to change default route in linux
    how to remove default gateway in linux
  • How to change default gateway in linux
  • Ubuntu change gateway ip address command line

  • Ubuntu change gateway ip address command line
  • Set default gateway linux command line
  • Ifconfig set gateway
  • Set default gateway linux ifconfig
  • Ip route add default gateway command
  • Ifconfig set gateway!

    How to set the preferred network interface in Linux

    Here's the complete answer, in case it helps others:

    To make packets with destinations 192.168.10.* use eth0, and all other packets use eth1:

    1) View your current routing table

    One entry will be something like "default via 192.168.1.1" where 192.168.1.1 is your router (a.k.a.

    gateway) ip address. Remember the gateways for eth0 and eth1, as we'll need them later.

    2) Delete the default route(s).

    Linux set default gateway permanently

    (Warning: this will kick you offline.)

    3) Add a new default route (this will bring you back online). Replace 192.168.1.1, below, with your gateway ip address from above.

    4) Add a specific route that will be served by eth0.

    More-specific routes automatically take precedence over less-specific ones.

    Finally, you can ask Linux which interface will be used to send a packet to a specific ip address:

    If the configuration worked, packets to 8.8.8.8 (Google's server) will use eth1.

    Packets to any ip on your local network:

    will use eth0.

    answered Mar 7, 2017 at 5:16

    LukeLuke

    81111 gold badge77 silver badges44 bronze badges

      how to set default gateway in linux using ifconfig
      how to set default gateway in linux ubuntu