Linux - NetworkingThis forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I've been having some problems switching from using static addresses to using dynamic addresses. Most of these seem to have been ironed out, thanks to help that I have gotten here. For which I am eternally grateful.
But to fix the problem and be able to access the internet, I have to type "/sbin/route add -net 0.0.0.0 gw 192.168.2.1" every time after booting up. It is not all that difficult, of course, but there must be some way not to have to do it every time.
I tried entering that command in /etc/rc.d/rc.local but that didn't do the job. "netstat -rn" shows no gateway after the system restarts.
I then tried entering "GATEWAY=192.168.2.1" in /etc/sysconfig/network but that didn't do the job either. "netstat -rn" shows no gateway after restart.
I suspect there might be some sort of basic reconfiguration necessary, but do not know what it is. Any suggestions will be greatly appreciated.
You talk about using dynamic ip addresses, are you using a dhcp server ? You could add a line in its configuration file to define automatically the default gateway. (option routers 192.168.2.1)
If not, did you take a look at the /etc/sysconfig/network-scripts/route-* files ?
To get these files to work, simply create a file named route-<dev> in the /etc/sysconfig/network-scripts/ directory. Replace <dev> with your device name (eth0 for example)
This file should contain one line like the following :
Thanks. That might very well do it, and I'll check it out. For now, I have solved the problem by just changing the eth0 configuration on each Linux box back to using static addresses (since the IP address they have been assigned by the router will not change), and manually entering the IP address, the gateway address and the DNS server addresses. Not elegant, but it take care of the problem. Thanks again.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.