[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 3718
  • Last Modified:

How do I add default gateway in Linux Mint?

192.168.0.2 is the machine on the network that is the gateway to the internet
192.168.0.19 is the static address of the machine I am trying to configure

I tried:
sudo route add default gw 192.168.0.2

Then I end up with 2 gateways
route -n
192.168.0.0     0.0.0.0
169.254.0.0     0.0.0.0
0.0.0.0       192.168.0.2
0.0.0.0        192.168.0.19  

I don't know how to restart the network without rebooting.
When I reboot, the gateway I just added disappears:

route -n
192.168.0.0     0.0.0.0
169.254.0.0     0.0.0.0
0.0.0.0        192.168.0.19  


0
LBugbee
Asked:
LBugbee
  • 5
  • 4
1 Solution
 
fosiul01Commented:
which Os you have ??

you can add that route in

/etc/rc.d/rc.local file

so when pc will boot, it wil add automataly

but there should be file call static-route , you can add in their aswell
0
 
Maciej SsysadminCommented:
You can do it permanent as it is written in link fosiul01 provided.

If you want to delete additional route path without restarting your computer, you may use command:
route del -net default gw 192.168.0.19
or even without -net
route del default gw 192.168.0.19
0
Get your Conversational Ransomware Defense e‑book

This e-book gives you an insight into the ransomware threat and reviews the fundamentals of top-notch ransomware preparedness and recovery. To help you protect yourself and your organization. The initial infection may be inevitable, so the best protection is to be fully prepared.

 
LBugbeeAuthor Commented:
I am using Linux Mint 6 which I gather is Ubuntu based which is Debian based

I followed your link, created the /etc/init.d/local file as directed. Now I get:
route -n
192.168.0.0     0.0.0.0    255.255.255.0  U      0     0     0     eth0
169.254.0.0     0.0.0.0    255.255.0.0      U     1000  0   0      eth0
0.0.0.0             192.168.0.2       0.0.0.0  UG    100    0    0    eth0

So the proper gateway is assigned, but it is not working. Maybe because the little network icon on the bottom of the screen says I am connected to the network with "ifupdown (eth1)".

ifconfig shows info for lo and eth0, nothing for eth1

So the computer says I am connected to the network with eth1, but ifconfig does not recognize eth1
0
 
fosiul01Commented:
I think you will have to add to  /etc/rc.local

from route -n command its like eth1 is not connected

you sure your eth1  is connected ??

0
 
LBugbeeAuthor Commented:
I can ping the other computers on the local network.
0
 
fosiul01Commented:
Ok restart network

 /etc/init.d/networking restart


show me the output here, check if it get ip for eth1
0
 
LBugbeeAuthor Commented:
linda@linda-server ~ $ sudo /etc/init.d/networking restart
[sudo] password for linda:
 * Reconfiguring network interfaces...                                                                                        * if-up.d/mountnfs[eth0]: waiting for interface eth1 before doing NFS mounts
eth1: ERROR while getting interface flags: No such device
SIOCSIFADDR: No such device
eth1: ERROR while getting interface flags: No such device
SIOCSIFNETMASK: No such device
SIOCSIFBRDADDR: No such device
eth1: ERROR while getting interface flags: No such device
eth1: ERROR while getting interface flags: No such device
Failed to bring up eth1.



This is the current /etc/init.d/local file
#!/bin/sh
route add default gw 192.168.0.2 eth0
route add default gw 192.168.0.2 eth1
0
 
fosiul01Commented:
omm it looks like your eth1 is not working...

you can still ping because you hvae 2 ethernet which has Same range of IP
so you can ping your network via eth0




0
 
LBugbeeAuthor Commented:
This solution did get the default gateway added as requested, but I never could get it to work. Thanks for your help anyway.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 5
  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now