Find the answer to your Linux question:
Results 1 to 8 of 8
Hello all, I am currently setting up an Internet gateway with the help of a linux machine. I am using the route command to set up the default gateway, giving ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Mar 2005
    Posts
    5

    "route add default gw" command-trouble


    Hello all,

    I am currently setting up an Internet gateway with the help of a linux machine. I am using the route command to set up the default gateway, giving the addres of the router which connects me to the external world.

    The problem now is that, everytime I reboot the linux machine, I have to add the default route, even though the corresponding ethernet interfaces are getting activated automatically.

    I use the command "route add default gw 'ipaddress of the router' " command, but I have to do this everytime I reboot.

    What could be the possible problem ?are there any files that I need to change ?when I went to the man page of route, it indicated me that changes would be made to the file /proc/net/route, but then automatic gateway setting is not being done here.

    Help me out please. Thanks in Advance.

    Regards

  2. #2
    Linux Enthusiast
    Join Date
    Feb 2005
    Location
    SE, Stockholm
    Posts
    512
    What distro are you running on? Because different distros has their own tool to set up the network.

  3. #3
    Just Joined!
    Join Date
    Mar 2005
    Posts
    5
    I am running RHL9.0. "route" is the command for setting up the routing table.

  4. #4
    Linux Enthusiast
    Join Date
    Feb 2005
    Location
    SE, Stockholm
    Posts
    512
    Yes that's correct, "route" command will alter your routing table.
    But it is not more than untill you reboot your system as you stated previous.
    Try the comman netconfig (I think it was that command in RH9 at least), then you will be able to save your parameters and will be able to reboot your system.

  5. #5
    Linux User
    Join Date
    Oct 2004
    Location
    Serbia&Montenegro
    Posts
    281
    You could make a simple bash script and set it to run every time on boot. I did this in Slackware. Create the script and change the /etc/rc.d/rc.local file. So you should add this in rc.local:

    Code:
    if [-x /path to script/ name of the script ]; then
        . /path to script/name of the script
      fi
    Linux registered user #358842
    Human knowledge belongs to the world.

  6. #6
    Just Joined!
    Join Date
    Mar 2005
    Location
    Milano (Italy)
    Posts
    45
    Hi

    in red hats and fedoras there is the directory
    Code:
    /etc/sysconfig/network-scripts
    where there is a file for each net interface.
    I guess the file you are looking for is ifcfg-eth0, edit it
    and change the ip address of the gateway.

    I hope I was helpful

  7. #7
    Just Joined!
    Join Date
    Jan 2005
    Posts
    20
    You shoult put line in to /etc/rc.local file

  8. #8
    Just Joined!
    Join Date
    Aug 2007
    Location
    Midlands, UK
    Posts
    14
    Quote Originally Posted by Diedaz View Post
    You shoult put line in to /etc/rc.local file
    Yes, but surely if you need to be root to run that command, as it says in the file, it runs at user level so won't do anything?

    I've got this problem in Debian 4.... Still looking....

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •