Jump to content
Main menu
Main menu
move to sidebar
hide
Navigation
Main page
Recent changes
Random page
freem
Search
Search
Appearance
Create account
Log in
Personal tools
Create account
Log in
Pages for logged out editors
learn more
Contributions
Talk
Editing
How to Add or Change the Default Gateway in Linux
Add languages
Page
Discussion
English
Read
Edit
Edit source
View history
Tools
Tools
move to sidebar
hide
Actions
Read
Edit
Edit source
View history
General
What links here
Related changes
Special pages
Page information
Appearance
move to sidebar
hide
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
In Linux, the default gateway is the IP address of the router that connects your network to the Internet. It is responsible for forwarding network packets to destinations outside the local network. To add or change the default gateway in Linux, follow these steps: 1. Open a terminal window. 2. Type the command "ip route show" to display the current routing table. 3. Identify the default gateway address listed under "default via" in the routing table. 4. To add a new default gateway, type the command "sudo ip route add default via <gateway-address>" where <gateway-address> is the IP address of the new default gateway. 5. To change the default gateway, type the command "sudo ip route del default" to delete the existing default route, followed by the command "sudo ip route add default via <gateway-address>" to add the new default gateway. For example, if the current default gateway is 192.168.1.1 and you want to change it to 192.168.1.2, you would type the following commands: ``` sudo ip route del default sudo ip route add default via 192.168.1.2 ``` Note: These changes will not be permanent and will be lost when the system is restarted. To make the changes permanent, you will need to modify the network configuration file for your Linux distribution. The file location and format may vary depending on your distribution.
Summary:
Please note that all contributions to freem are considered to be released under the Creative Commons Attribution-ShareAlike 4.0 (see
Freem:Copyrights
for details). If you do not want your writing to be edited mercilessly and redistributed at will, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource.
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)