• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Jeanne Boyarsky
  • Liutauras Vilda
Sheriffs:
  • Rob Spoor
  • Bear Bibeault
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:
  • Frits Walraven
  • Himai Minh

Remove Default route in Ubuntu

 
Greenhorn
Posts: 11
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am using Ubuntu and I need some complex networking configuration like removing existing default route.Thanks
 
Saloon Keeper
Posts: 23692
161
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
For instructions that would be actually useful, we'd need more information. You can remove any route using the "ip route delete" command, but if you don't set up a new default route, you won't be able to talk to anything that isn't on the same LAN as the machine whose route was deleted. That can be embarrassing when you've used ssh to login and do the work from somewhere else.
 
Greenhorn
Posts: 6
Python Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can remove default route by using "ip route dell default via 10.0.0.1 dev eth0" command.
 
Tim Holloway
Saloon Keeper
Posts: 23692
161
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

samuel tarcin wrote:You can remove default route by using "ip route dell default via 10.0.0.1 dev eth0"



Only if you have a default route via eth0 on subnet 10.0.0.0. Depending on the machine, I have things like "192.168.10.1 via enp5s2".

The "ip route" list command shows your routes, including the default route, and the display format is such that you can basically copy-and-paste the route display into an ip route del (sic) command.

But again, if you're not careful, you can disconnect the very route you're using and be left without a way to issue further commands.
 
Ranch Hand
Posts: 82
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Hello,Gabriel

Delete the existing default gateway

# ip route del default

Add the new default gateway

# ip route add default via default_gw_ip

where default_gw_ip is the IP Address of the default gateway

You can also combine the above two steps using the single command

# ip route replace default via default_gw_ip

Please note that these changes will not be persistent across reboots
(or network service restarts). If you want to make the changes permanent,
you will have to change the default gateway settings either through the network configuration
tool provided by your distribution or in the network scripts.

and

# vi /etc/sysconfig/network
NETWORKING=yes
HOSTNAME=server.example.com
GATEWAY=192.168.1.1


I hope this will help to you
 
A wop bop a lu bop a womp bam boom! Tiny ad:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
reply
    Bookmark Topic Watch Topic
  • New Topic